diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 05d03b8837..822ee218f9 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -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) diff --git a/core/embed/firmware/bootloaders/bootloader_T1B1.bin b/core/embed/firmware/bootloaders/bootloader_T1B1.bin new file mode 100644 index 0000000000..ac9d56f230 Binary files /dev/null and b/core/embed/firmware/bootloaders/bootloader_T1B1.bin differ diff --git a/core/embed/firmware/bootloader.bin b/core/embed/firmware/bootloaders/bootloader_T2T1.bin similarity index 100% rename from core/embed/firmware/bootloader.bin rename to core/embed/firmware/bootloaders/bootloader_T2T1.bin diff --git a/core/site_scons/tools.py b/core/site_scons/tools.py index a9953d4190..2e4e558794 100644 --- a/core/site_scons/tools.py +++ b/core/site_scons/tools.py @@ -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")