1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-03 00:36:06 +00:00

build(core): embed bootloader according to trezor model

[no changelog]
This commit is contained in:
tychovrahe 2023-01-10 16:47:23 +01:00 committed by TychoVrahe
parent ab949053e8
commit 4603b9ee74
4 changed files with 19 additions and 2 deletions

View File

@ -772,12 +772,18 @@ obj_program.extend(
' --rename-section .data=.vendorheader,alloc,load,readonly,contents'
' $SOURCE $TARGET', ))
BOOTLOADER_SUFFIX = tools.get_model_identifier(TREZOR_MODEL)
obj_program.extend(
env.Command(
target='embed/firmware/bootloader.o',
source='embed/firmware/bootloader.bin',
target='embed/firmware/bootloaders/bootloader.o',
source=f'embed/firmware/bootloaders/bootloader_{BOOTLOADER_SUFFIX}.bin',
action='$OBJCOPY -I binary -O elf32-littlearm -B arm'
' --rename-section .data=.bootloader'
f' --redefine-sym _binary_embed_firmware_bootloaders_bootloader_{BOOTLOADER_SUFFIX}_bin_start=_binary_embed_firmware_bootloader_bin_start'
f' --redefine-sym _binary_embed_firmware_bootloaders_bootloader_{BOOTLOADER_SUFFIX}_bin_end=_binary_embed_firmware_bootloader_bin_end'
f' --redefine-sym _binary_embed_firmware_bootloaders_bootloader_{BOOTLOADER_SUFFIX}_bin_size=_binary_embed_firmware_bootloader_bin_size'
' $SOURCE $TARGET', ))
env.Depends(obj_program, qstr_generated)

Binary file not shown.

View File

@ -44,3 +44,14 @@ def configure_board(model, env, defines, sources):
defines += [f'HW_REVISION={hw_revision}', ]
sources += [f'embed/trezorhal/displays/{display}', ]
env.get('ENV')['TREZOR_BOARD'] = board
def get_model_identifier(model):
if model == '1':
return "T1B1"
elif model == 'T':
return "T2T1"
elif model == 'R':
return "T2B1"
else:
raise Exception("Unknown model")