2019-01-27 10:58:30 +00:00
|
|
|
#!/usr/bin/env python3
|
2014-10-23 16:09:41 +00:00
|
|
|
import os
|
2019-04-18 14:27:27 +00:00
|
|
|
import sys
|
2014-10-23 16:09:41 +00:00
|
|
|
|
2019-02-21 14:18:00 +00:00
|
|
|
TOTALSIZE = 32768
|
|
|
|
MAXSIZE = TOTALSIZE - 32
|
|
|
|
|
2014-10-23 16:09:41 +00:00
|
|
|
fn = sys.argv[1]
|
|
|
|
fs = os.stat(fn).st_size
|
2019-02-21 14:18:00 +00:00
|
|
|
if fs > MAXSIZE:
|
2019-04-18 14:27:27 +00:00
|
|
|
raise Exception(
|
2021-09-27 10:13:51 +00:00
|
|
|
f"bootloader has to be smaller than {MAXSIZE} bytes (current size is {fs})"
|
2019-04-18 14:27:27 +00:00
|
|
|
)
|
|
|
|
with open(fn, "ab") as f:
|
|
|
|
f.write(b"\x00" * (TOTALSIZE - fs))
|
|
|
|
f.close()
|