1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

fix(core): fix invalid symbol for deflated bootloader

[no changelog]
This commit is contained in:
cepetr 2024-11-20 08:35:37 +01:00 committed by cepetr
parent b0dd521c5d
commit 9c0a37717c
3 changed files with 10 additions and 17 deletions

View File

@ -374,7 +374,8 @@ tools.embed_compressed_binary(
'bootloader',
'embed/projects/bootloaders/bootloader.o',
f'embed/models/{MODEL_IDENTIFIER}/bootloaders/bootloader_{BOOTLOADER_SUFFIX}.bin',
'kernel'
'kernel',
'bootloader',
)
linkerscript_gen = env.Command(

View File

@ -29,8 +29,8 @@
#include "uzlib.h"
// symbols from bootloader.bin => bootloader.o
extern const void _binary_embed_bootloaders_bootloader_bin_deflated_start;
extern const void _binary_embed_bootloaders_bootloader_bin_deflated_size;
extern const void _deflated_bootloader_start;
extern const void _deflated_bootloader_size;
#define CONCAT_NAME_HELPER(prefix, name, suffix) prefix##name##suffix
#define CONCAT_NAME(name, var) CONCAT_NAME_HELPER(BOOTLOADER_, name, var)
@ -99,11 +99,8 @@ void check_and_replace_bootloader(void) {
}
// replace bootloader with the latest one
const uint32_t *data =
(const uint32_t
*)&_binary_embed_bootloaders_bootloader_bin_deflated_start;
const uint32_t len =
(const uint32_t)&_binary_embed_bootloaders_bootloader_bin_deflated_size;
const uint32_t *data = (const uint32_t *)&_deflated_bootloader_start;
const uint32_t len = (const uint32_t)&_deflated_bootloader_size;
struct uzlib_uncomp decomp = {0};
uint8_t decomp_window[UZLIB_WINDOW_SIZE] = {0};

View File

@ -85,22 +85,17 @@ def get_bindgen_defines(
return ",".join(rest_defs)
def embed_compressed_binary(obj_program, env, section, target_, file, build):
def embed_compressed_binary(obj_program, env, section, target_, file, build, symbol):
_in = f"embedded_{section}.bin.deflated"
def redefine_sym(name):
def redefine_sym(suffix):
src = (
f"_binary_build_{build}_"
+ _in.replace("/", "_").replace(".", "_")
+ "_"
+ name
)
dest = (
"_binary_"
+ target_.replace("/", "_").replace(".o", "_bin_deflated")
+ "_"
+ name
+ suffix
)
dest = f"_deflated_{symbol}_{suffix}"
return f" --redefine-sym {src}={dest}"
def compress_action(target, source, env):