1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-29 17:48:10 +00:00
trezor-firmware/legacy/bootloader/firmware_align.py
2021-10-13 11:53:17 +02:00

17 lines
339 B
Python
Executable File

#!/usr/bin/env python3
import os
import sys
TOTALSIZE = 32768
MAXSIZE = TOTALSIZE - 32
fn = sys.argv[1]
fs = os.stat(fn).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:
f.write(b"\x00" * (TOTALSIZE - fs))
f.close()