1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-19 17:46:07 +00:00

build(legacy): make bootloader_align target repeatable

[no changelog]
This commit is contained in:
matejcik 2022-02-10 10:42:46 +01:00 committed by matejcik
parent e81bb0f856
commit 825ccd9df5
3 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
NAME = bootloader
NAME = bootloader-unaligned
OBJS += bootloader.o
OBJS += signatures.o
@ -44,5 +44,7 @@ include ../Makefile.include
# Remove libtrezor from linking since we specified the small versions
LDLIBS := $(filter-out -ltrezor,$(LDLIBS))
align: $(NAME).bin
./firmware_align.py $(NAME).bin
bootloader.bin: $(NAME).bin
./firmware_align.py $< $@
all: bootloader.bin

View File

@ -5,12 +5,14 @@ import sys
TOTALSIZE = 32768
MAXSIZE = TOTALSIZE - 32
fn = sys.argv[1]
fs = os.stat(fn).st_size
infile = sys.argv[1]
outfile = sys.argv[2]
fs = os.stat(infile).st_size
if fs > MAXSIZE:
raise Exception(
f"bootloader has to be smaller than {MAXSIZE} bytes (current size is {fs})"
)
with open(fn, "ab") as f:
with open(outfile, "wb") as f:
with open(infile, "rb") as i:
f.write(i.read())
f.write(b"\x00" * (TOTALSIZE - fs))
f.close()

View File

@ -16,7 +16,7 @@ fi
make
if [ "$EMULATOR" != 1 ]; then
make -C bootloader align
make -C bootloader
fi
# invoking nanopb_generator to make sure its proto files are generated