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,16 +259,18 @@ DIR=$(pwd)
|
|||||||
|
|
||||||
# build core
|
# build core
|
||||||
|
|
||||||
|
for TREZOR_MODEL in ${MODELS[@]}; do
|
||||||
for BITCOIN_ONLY in ${VARIANTS_core[@]}; 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
|
||||||
@ -277,7 +286,7 @@ for BITCOIN_ONLY in ${VARIANTS_core[@]}; do
|
|||||||
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 \
|
||||||
@ -287,11 +296,13 @@ EOF
|
|||||||
-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 TREZOR_MODEL="$TREZOR_MODEL" \
|
||||||
--env PRODUCTION="$PRODUCTION" \
|
--env PRODUCTION="$PRODUCTION" \
|
||||||
--init \
|
--init \
|
||||||
"$SNAPSHOT_NAME" \
|
"$SNAPSHOT_NAME" \
|
||||||
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
|
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
# build legacy
|
# build legacy
|
||||||
|
|
||||||
@ -387,8 +398,9 @@ 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 MODEL in "R" "T"; do
|
||||||
for DIRSUFFIX in "" "-bitcoinonly" "-prodtest"; do
|
for DIRSUFFIX in "" "-bitcoinonly" "-prodtest"; do
|
||||||
BUILD_DIR=build/${VARIANT}${DIRSUFFIX}
|
BUILD_DIR=build/${VARIANT}-${MODEL}${DIRSUFFIX}
|
||||||
for file in $BUILD_DIR/*/*.fingerprint; do
|
for file in $BUILD_DIR/*/*.fingerprint; do
|
||||||
if [ -f "$file" ]; then
|
if [ -f "$file" ]; then
|
||||||
origfile="${file%.fingerprint}"
|
origfile="${file%.fingerprint}"
|
||||||
@ -398,3 +410,4 @@ for VARIANT in core legacy; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user