1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-10-17 13:29:17 +00:00
trezor-firmware/bootloader/firmware_align.py
2019-02-21 17:12:38 +01:00

15 lines
322 B
Python
Executable File

#!/usr/bin/env python3
import sys
import os
TOTALSIZE = 32768
MAXSIZE = TOTALSIZE - 32
fn = sys.argv[1]
fs = os.stat(fn).st_size
if fs > MAXSIZE:
raise Exception('bootloader has to be smaller than %d bytes (current size is %d)' % (MAXSIZE, fs))
with open(fn, 'ab') as f:
f.write(b'\x00' * (TOTALSIZE - fs))
f.close()