diff --git a/legacy/bootloader/Makefile b/legacy/bootloader/Makefile index b17dedab7..3366c1362 100644 --- a/legacy/bootloader/Makefile +++ b/legacy/bootloader/Makefile @@ -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 diff --git a/legacy/bootloader/firmware_align.py b/legacy/bootloader/firmware_align.py index 80be7cd0e..b30be5582 100755 --- a/legacy/bootloader/firmware_align.py +++ b/legacy/bootloader/firmware_align.py @@ -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() diff --git a/legacy/script/cibuild b/legacy/script/cibuild index 10046563d..377e339fd 100755 --- a/legacy/script/cibuild +++ b/legacy/script/cibuild @@ -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