2 # Option ROM signing utility
5 # Jan Kiszka <jan.kiszka@siemens.com>
7 # This work is licensed under the terms of the GNU GPL, version 2 or later.
8 # See the COPYING file in the top-level directory.
14 print('usage: signrom.py input output')
17 fin = open(sys.argv[1], 'rb')
18 fout = open(sys.argv[2], 'wb')
21 size = ord(fin.read(1)) * 512 - 1
29 # catch Python 2 vs. 3 differences
30 if isinstance(b, int):
34 checksum = (256 - checksum) % 256
36 # Python 3 no longer allows chr(checksum)
37 fout.write(struct.pack('B', checksum))