1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-21 23:18:13 +00:00

build: differentiate between models for prodtest build

This commit is contained in:
matejcik 2023-06-14 12:23:03 +02:00
parent b5b98b26eb
commit f04aff1e47

View File

@ -351,38 +351,41 @@ EOF
done
if [ "$OPT_BUILD_PRODTEST" -eq "1" ]; then
DIRSUFFIX="-prodtest"
SCRIPT_NAME=".build_prodtest.sh"
cat <<EOF > "build/$SCRIPT_NAME"
# DO NOT MODIFY!
# this file was generated by ${BASH_SOURCE[0]}
# variant: core build prodtest
set -e -o pipefail
cd /reproducible-build/trezor-firmware/core
$GIT_CLEAN_REPO
poetry run make clean vendor build_prodtest
poetry run ../python/tools/firmware-fingerprint.py \
-o build/prodtest/prodtest.bin.fingerprint \
build/prodtest/prodtest.bin
rm -rf /build/*
cp -r build/* /build
chown -R $USER:$GROUP /build
for TREZOR_MODEL in ${MODELS[@]}; do
DIRSUFFIX="-${TREZOR_MODEL}-prodtest"
SCRIPT_NAME=".build_${TREZOR_MODEL}-prodtest.sh"
cat <<EOF > "build/$SCRIPT_NAME"
# DO NOT MODIFY!
# this file was generated by ${BASH_SOURCE[0]}
# variant: core build prodtest
set -e -o pipefail
cd /reproducible-build/trezor-firmware/core
$GIT_CLEAN_REPO
poetry run make clean vendor build_prodtest
poetry run ../python/tools/firmware-fingerprint.py \
-o build/prodtest/prodtest.bin.fingerprint \
build/prodtest/prodtest.bin
rm -rf /build/*
cp -r build/* /build
chown -R $USER:$GROUP /build
EOF
echo
echo ">>> DOCKER RUN core prodtest PRODUCTION=$PRODUCTION"
echo
echo
echo ">>> DOCKER RUN core prodtest TREZOR_MODEL=$TREZOR_MODEL PRODUCTION=$PRODUCTION"
echo
$DOCKER run \
--network=host \
-it \
--rm \
-v "$DIR:/local" \
-v "$DIR/build/core$DIRSUFFIX":/build:z \
--env PRODUCTION="$PRODUCTION" \
--init \
"$SNAPSHOT_NAME" \
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
$DOCKER run \
--network=host \
-it \
--rm \
-v "$DIR:/local" \
-v "$DIR/build/core$DIRSUFFIX":/build:z \
--env TREZOR_MODEL="$TREZOR_MODEL" \
--env PRODUCTION="$PRODUCTION" \
--init \
"$SNAPSHOT_NAME" \
/nix/var/nix/profiles/default/bin/nix-shell --run "bash /local/build/$SCRIPT_NAME"
done
fi