mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
825ccd9df5
[no changelog]
19 lines
420 B
Python
Executable File
19 lines
420 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
|
|
TOTALSIZE = 32768
|
|
MAXSIZE = TOTALSIZE - 32
|
|
|
|
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(outfile, "wb") as f:
|
|
with open(infile, "rb") as i:
|
|
f.write(i.read())
|
|
f.write(b"\x00" * (TOTALSIZE - fs))
|