mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-26 01:18:28 +00:00
build: combine docker scripts for core and legacy into one
This commit is contained in:
parent
a635ba6bff
commit
d9e9fa6ceb
@ -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"
|
@ -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"
|
85
build-docker.sh
Executable file
85
build-docker.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user