diff options
author | Johannes Krampf <johannes.krampf@googlemail.com> | 2014-01-19 16:03:49 +0100 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2014-01-20 12:42:44 -0500 |
commit | 19f789bdfd58eba2ed8fe604bbabf8df0fcc0771 (patch) | |
tree | 51c49104aec5b420382f82f71e3b4a8edf0be8f1 /scripts/buildrom.py | |
parent | 0a82fc743c5ec1553f745bec6fc8bc8780088fd8 (diff) | |
download | seabios-19f789bdfd58eba2ed8fe604bbabf8df0fcc0771.zip seabios-19f789bdfd58eba2ed8fe604bbabf8df0fcc0771.tar.gz seabios-19f789bdfd58eba2ed8fe604bbabf8df0fcc0771.tar.bz2 |
build: Be careful with unicode and byte strings for python3 compatibility.
Signed-off-by: Johannes Krampf <johannes.krampf@googlemail.com>
Diffstat (limited to 'scripts/buildrom.py')
-rwxr-xr-x | scripts/buildrom.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/buildrom.py b/scripts/buildrom.py index 36de14e..8ff60e2 100755 --- a/scripts/buildrom.py +++ b/scripts/buildrom.py @@ -7,6 +7,8 @@ import sys +from python23compat import as_bytes + def alignpos(pos, alignbytes): mask = alignbytes - 1 return (pos + mask) & ~mask @@ -26,7 +28,7 @@ def main(): count = len(data) # Pad to a 512 byte boundary - data += "\0" * (alignpos(count, 512) - count) + data += as_bytes("\0") * (alignpos(count, 512) - count) count = len(data) # Check if a pci header is present @@ -35,7 +37,7 @@ def main(): data = data[:pcidata + 16] + chr(int(count/512)) + chr(0) + data[pcidata + 18:] # Fill in size field; clear checksum field - data = data[:2] + chr(int(count/512)) + data[3:6] + "\0" + data[7:] + data = data[:2] + chr(int(count/512)) + data[3:6] + as_bytes("\0") + data[7:] # Checksum rom newsum = (256 - checksum(data)) & 0xff |