mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
scripts/signrom: remove Python 2 support, add shebang
Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200204160028.16211-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
351aa2706e
commit
b38c2458d4
1 changed files with 3 additions and 7 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
#
|
#
|
||||||
# Option ROM signing utility
|
# Option ROM signing utility
|
||||||
|
@ -44,14 +46,8 @@ fout.write(data)
|
||||||
|
|
||||||
checksum = 0
|
checksum = 0
|
||||||
for b in data:
|
for b in data:
|
||||||
# catch Python 2 vs. 3 differences
|
checksum = (checksum - b) & 255
|
||||||
if isinstance(b, int):
|
|
||||||
checksum += b
|
|
||||||
else:
|
|
||||||
checksum += ord(b)
|
|
||||||
checksum = (256 - checksum) % 256
|
|
||||||
|
|
||||||
# Python 3 no longer allows chr(checksum)
|
|
||||||
fout.write(struct.pack('B', checksum))
|
fout.write(struct.pack('B', checksum))
|
||||||
|
|
||||||
fin.close()
|
fin.close()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue