mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 04:18:10 +00:00
build: add support for model R to build-docker
provisional, we will want to use the internal model names here too, but that's gonna need to wait for the change of the TREZOR_MODEL env vars
This commit is contained in:
parent
d8cd298cd6
commit
ddd974b56a
@ -55,6 +55,7 @@ function help_and_die() {
|
|||||||
echo " --prodtest - build core prodtest"
|
echo " --prodtest - build core prodtest"
|
||||||
echo " --repository path/to/repo - checkout the repository from the given path/url"
|
echo " --repository path/to/repo - checkout the repository from the given path/url"
|
||||||
echo " --no-init - do not recreate docker environments"
|
echo " --no-init - do not recreate docker environments"
|
||||||
|
echo " --models - comma-separated list of models. default: --models R,T"
|
||||||
echo " --help"
|
echo " --help"
|
||||||
echo
|
echo
|
||||||
echo "Set PRODUCTION=0 to run non-production builds."
|
echo "Set PRODUCTION=0 to run non-production builds."
|
||||||
@ -67,6 +68,7 @@ OPT_BUILD_NORMAL=1
|
|||||||
OPT_BUILD_BITCOINONLY=1
|
OPT_BUILD_BITCOINONLY=1
|
||||||
OPT_BUILD_PRODTEST=0
|
OPT_BUILD_PRODTEST=0
|
||||||
INIT=1
|
INIT=1
|
||||||
|
MODELS=(R T)
|
||||||
|
|
||||||
REPOSITORY="/local"
|
REPOSITORY="/local"
|
||||||
|
|
||||||
@ -103,6 +105,11 @@ while true; do
|
|||||||
INIT=0
|
INIT=0
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--models)
|
||||||
|
# take comma-separated next argument and turn it into an array
|
||||||
|
IFS=',' read -r -a MODELS <<< "$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@ -252,45 +259,49 @@ DIR=$(pwd)
|
|||||||
|
|
||||||
# build core
|
# build core
|
||||||
|
|
||||||
for BITCOIN_ONLY in ${VARIANTS_core[@]}; do
|
for TREZOR_MODEL in ${MODELS[@]}; do
|
||||||
|
for BITCOIN_ONLY in ${VARIANTS_core[@]}; do
|
||||||
|
|
||||||
DIRSUFFIX=${BITCOIN_ONLY/1/-bitcoinonly}
|
DIRSUFFIX=${BITCOIN_ONLY/1/-bitcoinonly}
|
||||||
DIRSUFFIX=${DIRSUFFIX/0/}
|
DIRSUFFIX=${DIRSUFFIX/0/}
|
||||||
|
DIRSUFFIX="-${TREZOR_MODEL}${DIRSUFFIX}"
|
||||||
|
|
||||||
SCRIPT_NAME=".build_core_$BITCOIN_ONLY.sh"
|
SCRIPT_NAME=".build_core_${TREZOR_MODEL}_${BITCOIN_ONLY}.sh"
|
||||||
cat <<EOF > "build/$SCRIPT_NAME"
|
cat <<EOF > "build/$SCRIPT_NAME"
|
||||||
# DO NOT MODIFY!
|
# DO NOT MODIFY!
|
||||||
# this file was generated by ${BASH_SOURCE[0]}
|
# this file was generated by ${BASH_SOURCE[0]}
|
||||||
# variant: core build BITCOIN_ONLY=$BITCOIN_ONLY
|
# variant: core build BITCOIN_ONLY=$BITCOIN_ONLY TREZOR_MODEL=$TREZOR_MODEL
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
cd /reproducible-build/trezor-firmware/core
|
cd /reproducible-build/trezor-firmware/core
|
||||||
$GIT_CLEAN_REPO
|
$GIT_CLEAN_REPO
|
||||||
poetry run make clean vendor build_bootloader build_firmware
|
poetry run make clean vendor build_bootloader build_firmware
|
||||||
for item in bootloader firmware; do
|
for item in bootloader firmware; do
|
||||||
poetry run ../python/tools/firmware-fingerprint.py \
|
poetry run ../python/tools/firmware-fingerprint.py \
|
||||||
-o build/\$item/\$item.bin.fingerprint \
|
-o build/\$item/\$item.bin.fingerprint \
|
||||||
build/\$item/\$item.bin
|
build/\$item/\$item.bin
|
||||||
done
|
done
|
||||||
rm -rf /build/*
|
rm -rf /build/*
|
||||||
cp -r build/* /build
|
cp -r build/* /build
|
||||||
chown -R $USER:$GROUP /build
|
chown -R $USER:$GROUP /build
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo ">>> DOCKER RUN core BITCOIN_ONLY=$BITCOIN_ONLY PRODUCTION=$PRODUCTION"
|
echo ">>> DOCKER RUN core BITCOIN_ONLY=$BITCOIN_ONLY TREZOR_MODEL=$TREZOR_MODEL PRODUCTION=$PRODUCTION"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
$DOCKER run \
|
$DOCKER run \
|
||||||
--network=host \
|
--network=host \
|
||||||
-it \
|
-it \
|
||||||
--rm \
|
--rm \
|
||||||
-v "$DIR:/local" \
|
-v "$DIR:/local" \
|
||||||
-v "$DIR/build/core$DIRSUFFIX":/build:z \
|
-v "$DIR/build/core$DIRSUFFIX":/build:z \
|
||||||
--env BITCOIN_ONLY="$BITCOIN_ONLY" \
|
--env BITCOIN_ONLY="$BITCOIN_ONLY" \
|
||||||
--env PRODUCTION="$PRODUCTION" \
|
--env TREZOR_MODEL="$TREZOR_MODEL" \
|
||||||
--init \
|
--env PRODUCTION="$PRODUCTION" \
|
||||||
"$SNAPSHOT_NAME" \
|
--init \
|
||||||
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
|
"$SNAPSHOT_NAME" \
|
||||||
|
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
# build legacy
|
# build legacy
|
||||||
@ -387,14 +398,16 @@ echo "Built from commit $COMMIT_HASH"
|
|||||||
echo
|
echo
|
||||||
echo "Fingerprints:"
|
echo "Fingerprints:"
|
||||||
for VARIANT in core legacy; do
|
for VARIANT in core legacy; do
|
||||||
for DIRSUFFIX in "" "-bitcoinonly" "-prodtest"; do
|
for MODEL in "R" "T"; do
|
||||||
BUILD_DIR=build/${VARIANT}${DIRSUFFIX}
|
for DIRSUFFIX in "" "-bitcoinonly" "-prodtest"; do
|
||||||
for file in $BUILD_DIR/*/*.fingerprint; do
|
BUILD_DIR=build/${VARIANT}-${MODEL}${DIRSUFFIX}
|
||||||
if [ -f "$file" ]; then
|
for file in $BUILD_DIR/*/*.fingerprint; do
|
||||||
origfile="${file%.fingerprint}"
|
if [ -f "$file" ]; then
|
||||||
fingerprint=$(tr -d '\n' < $file)
|
origfile="${file%.fingerprint}"
|
||||||
echo "$fingerprint $origfile"
|
fingerprint=$(tr -d '\n' < $file)
|
||||||
fi
|
echo "$fingerprint $origfile"
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user