From d9e9fa6cebd081958c1aa716229692ca4dda072b Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 8 Sep 2019 17:16:53 +0200 Subject: [PATCH] build: combine docker scripts for core and legacy into one --- build-docker-core.sh | 46 ----------------------- build-docker-legacy.sh | 51 ------------------------- build-docker.sh | 85 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 97 deletions(-) delete mode 100755 build-docker-core.sh delete mode 100755 build-docker-legacy.sh create mode 100755 build-docker.sh diff --git a/build-docker-core.sh b/build-docker-core.sh deleted file mode 100755 index cae3566fd9..0000000000 --- a/build-docker-core.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = "--gcc_source" ]; then - TOOLCHAIN_FLAVOR=src - shift -else - TOOLCHAIN_FLAVOR=linux -fi - -IMAGE=trezor-firmware-build.$TOOLCHAIN_FLAVOR - -TAG=${1:-master} -REPOSITORY=${2:-local} -PRODUCTION=${PRODUCTION:-1} -BITCOIN_ONLY=${BITCOIN_ONLY:-0} - -if [ "$REPOSITORY" = "local" ]; then - REPOSITORY=file:///local/ -else - REPOSITORY=https://github.com/$REPOSITORY/trezor-firmware.git -fi - -docker build -t "$IMAGE" --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR ci/ - -USER=$(ls -lnd . | awk '{ print $3 }') -GROUP=$(ls -lnd . | awk '{ print $4 }') - -mkdir -p $(pwd)/build/core - -docker run -it \ - -v $(pwd):/local \ - -v $(pwd)/build/core:/build:z \ - --env BITCOIN_ONLY="$BITCOIN_ONLY" \ - --env PRODUCTION="$PRODUCTION" \ - --user="$USER:$GROUP" \ - "$IMAGE" \ - /bin/sh -c "\ - cd /tmp && \ - git clone $REPOSITORY trezor-firmware && \ - cd trezor-firmware/core && \ - ln -s /build build && - git checkout $TAG && \ - git submodule update --init --recursive && \ - pipenv install && \ - pipenv run make clean vendor build_boardloader build_bootloader build_firmware" diff --git a/build-docker-legacy.sh b/build-docker-legacy.sh deleted file mode 100755 index 528330a186..0000000000 --- a/build-docker-legacy.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = "--gcc_source" ]; then - TOOLCHAIN_FLAVOR=src - shift -else - TOOLCHAIN_FLAVOR=linux -fi - -IMAGE=trezor-firmware-build.$TOOLCHAIN_FLAVOR - -TAG=${1:-master} -REPOSITORY=${2:-local} -MEMORY_PROTECT=${MEMORY_PROTECT:-1} -BITCOIN_ONLY=${BITCOIN_ONLY:-0} - -if [ "$REPOSITORY" = "local" ]; then - REPOSITORY=file:///local/ -else - REPOSITORY=https://github.com/$REPOSITORY/trezor-firmware.git -fi - -docker build -t "$IMAGE" --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR ci/ - -USER=$(ls -lnd . | awk '{ print $3 }') -GROUP=$(ls -lnd . | awk '{ print $4 }') - -mkdir -p $(pwd)/build/legacy - -docker run -it \ - -v $(pwd):/local \ - -v $(pwd)/build/legacy:/build:z \ - --env BITCOIN_ONLY="$BITCOIN_ONLY" \ - --env MEMORY_PROTECT="$MEMORY_PROTECT" \ - --user="$USER:$GROUP" \ - "$IMAGE" \ - /bin/sh -c "\ - cd /tmp && \ - git clone $REPOSITORY trezor-firmware && \ - cd trezor-firmware/legacy && \ - ln -s /build build && - git checkout $TAG && \ - git submodule update --init --recursive && \ - pipenv install && \ - pipenv run script/cibuild && \ - mkdir -p build/bootloader build/firmware && \ - cp bootloader/bootloader.bin build/bootloader/bootloader.bin && \ - cp bootloader/bootloader.elf build/bootloader/bootloader.elf && \ - cp firmware/trezor.bin build/firmware/firmware.bin && \ - cp firmware/trezor.elf build/firmware/firmware.elf" diff --git a/build-docker.sh b/build-docker.sh new file mode 100755 index 0000000000..bb8616d843 --- /dev/null +++ b/build-docker.sh @@ -0,0 +1,85 @@ +#!/bin/bash +set -e + +if [ "$1" = "--gcc_source" ]; then + TOOLCHAIN_FLAVOR=src + shift +else + TOOLCHAIN_FLAVOR=linux +fi + +IMAGE=trezor-firmware-build.$TOOLCHAIN_FLAVOR + +TAG=${1:-master} +REPOSITORY=${2:-local} +PRODUCTION=${PRODUCTION:-1} +MEMORY_PROTECT=${MEMORY_PROTECT:-1} + +if [ "$REPOSITORY" = "local" ]; then + REPOSITORY=file:///local/ +else + REPOSITORY=https://github.com/$REPOSITORY/trezor-firmware.git +fi + +docker build -t "$IMAGE" --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR ci/ + +USER=$(ls -lnd . | awk '{ print $3 }') +GROUP=$(ls -lnd . | awk '{ print $4 }') + +mkdir -p $(pwd)/build/core $(pwd)/build/legacy +mkdir -p $(pwd)/build/core-bitcoinonly $(pwd)/build/legacy-bitcoinonly + +# build core + +for BITCOIN_ONLY in 0 1; do + + DIRSUFFIX=${BITCOIN_ONLY/1/-bitcoinonly} + DIRSUFFIX=${DIRSUFFIX/0/} + + docker run -it \ + -v $(pwd):/local \ + -v $(pwd)/build/core"${DIRSUFFIX}":/build:z \ + --env BITCOIN_ONLY="$BITCOIN_ONLY" \ + --env PRODUCTION="$PRODUCTION" \ + --user="$USER:$GROUP" \ + "$IMAGE" \ + /bin/sh -c "\ + cd /tmp && \ + git clone $REPOSITORY trezor-firmware && \ + cd trezor-firmware/core && \ + ln -s /build build && + git checkout $TAG && \ + git submodule update --init --recursive && \ + pipenv install && \ + pipenv run make clean vendor build_firmware" + +done + +# build legacy + +for BITCOIN_ONLY in 0 1; do + + DIRSUFFIX=${BITCOIN_ONLY/1/-bitcoinonly} + DIRSUFFIX=${DIRSUFFIX/0/} + + docker run -it \ + -v $(pwd):/local \ + -v $(pwd)/build/legacy"${DIRSUFFIX}":/build:z \ + --env BITCOIN_ONLY="$BITCOIN_ONLY" \ + --env MEMORY_PROTECT="$MEMORY_PROTECT" \ + --user="$USER:$GROUP" \ + "$IMAGE" \ + /bin/sh -c "\ + cd /tmp && \ + git clone $REPOSITORY trezor-firmware && \ + cd trezor-firmware/legacy && \ + ln -s /build build && + git checkout $TAG && \ + git submodule update --init --recursive && \ + pipenv install && \ + pipenv run script/cibuild && \ + mkdir -p build/firmware && \ + cp firmware/trezor.bin build/firmware/firmware.bin && \ + cp firmware/trezor.elf build/firmware/firmware.elf" + +done