1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

refactor(core): move vendor headers to model specific directories

[no changelog]
This commit is contained in:
tychovrahe 2024-07-16 14:42:39 +02:00 committed by TychoVrahe
parent 15b42afc55
commit 7c94080227
99 changed files with 26 additions and 14 deletions

View File

@ -143,10 +143,10 @@ docs_summary_check: ## check if there are unlinked documentation files
python3 tools/check_docs_summary.py
vendorheader: ## generate vendor header
./core/embed/vendorheader/generate.sh --quiet
./core/tools/generate_vendorheader.sh --quiet
vendorheader_check: ## check that vendor header is up to date
./core/embed/vendorheader/generate.sh --quiet --check
./core/tools/generate_vendorheader.sh --quiet --check
gen: templates mocks icons protobuf ci_docs vendorheader solana_templates ## regenerate auto-generated files from sources

View File

@ -892,7 +892,7 @@ else:
else:
vendor = "trezor_signed_prod"
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/vendorheader_{vendor}.bin'
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_{vendor}.bin'
if TREZOR_MODEL not in ('1',):

View File

@ -227,13 +227,13 @@ elif (vh := os.environ.get("VENDOR_HEADER", None)):
# of vendor header which does not affect reproducibility of the build. Nonetheless,
# we should figure out a cleaner way to pass in this argument, without having to teach
# the Makefile about it.
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/{vh}'
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/{vh}'
elif PRODUCTION:
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/vendorheader_prodtest_signed_prod.bin'
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_prodtest_signed_prod.bin'
elif BOOTLOADER_DEVEL:
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/vendorheader_dev_DO_NOT_SIGN_signed_dev.bin'
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_dev_DO_NOT_SIGN_signed_dev.bin'
else:
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/vendorheader_unsafe_signed_prod.bin'
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_unsafe_signed_prod.bin'

View File

@ -182,7 +182,7 @@ obj_program += env.Object(source=SOURCE_HAL)
MODEL_IDENTIFIER = models.get_model_identifier(TREZOR_MODEL)
VENDORHEADER = f'embed/vendorheader/{MODEL_IDENTIFIER}/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
VENDORHEADER = f'embed/models/{MODEL_IDENTIFIER}/vendorheader/vendorheader_' + ('unsafe_signed_dev.bin' if ARGUMENTS.get('PRODUCTION', '0') == '0' else 'satoshilabs_signed_prod.bin')
obj_program.extend(
env.Command(

View File

@ -4,8 +4,8 @@ set -e
cd $(dirname $0)
BUILDVH=$(realpath ../../tools/build_vendorheader)
BINCTL=$(realpath ../../tools/headertool.py)
BUILDVH=$(realpath ./build_vendorheader)
BINCTL=$(realpath ./headertool.py)
for arg in "$@"; do
if [ "$arg" == "--check" ]; then
@ -16,10 +16,21 @@ for arg in "$@"; do
fi
done
MODELS=(T2T1 T2B1 T3T1 T3B1 D001 D002)
cd ../embed/models/
# Find directories and store them in an array
dirs=($(find . -maxdepth 1 -type d ! -name '.' | sed 's|^\./||'))
# Filter directories that have 'vendorheader' subdirectory
MODELS=()
for dir in "${dirs[@]}"; do
if [ -d "$dir/vendorheader" ]; then
MODELS+=("$dir")
fi
done
for MODEL in ${MODELS[@]}; do
cd $MODEL
cd ./$MODEL/vendorheader
echo "Generating vendor headers for $MODEL"
# construct all vendor headers
for fn in *.json; do
@ -42,5 +53,5 @@ for MODEL in ${MODELS[@]}; do
fi
cp -a "$TMPDIR/$DEST_NAME" "$DEST_NAME"
done
cd ..
cd ../../
done

View File

@ -28,8 +28,9 @@ VENDOR_HEADER = (
HERE.parent.parent
/ "core"
/ "embed"
/ "vendorheader"
/ "models"
/ "T2T1"
/ "vendorheader"
/ "vendorheader_satoshilabs_signed_prod.bin"
)