Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions gpt_bin/gpt_ini2bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import uuid
import struct
import os
import sys
if sys.version_info < (3, 0, 1):
import ConfigParser
Expand All @@ -27,7 +28,7 @@
def zero_pad(s, size):
if (len(s) > size):
print('error', len(s))
s += '\0' * (size - len(s))
s += b'\0' * (size - len(s))
return s

def copy_section(cfg, a, b):
Expand Down Expand Up @@ -139,9 +140,9 @@ def main():
gpt_in = sys.argv[1]

if sys.version_info < (3, 0, 1):
cfg = ConfigParser.SafeConfigParser()
cfg = ConfigParser.ConfigParser()
else:
cfg = configparser.SafeConfigParser(strict=False)
cfg = configparser.ConfigParser(strict=False)

cfg.read(gpt_in)

Expand All @@ -154,7 +155,7 @@ def main():
start_lba = cfg.getint('base', 'start_lba')
npart = len(part)

out = sys.stdout
out = os.fdopen(sys.stdout.fileno(), 'wb')
out.write(struct.pack('<I', magic))
out.write(struct.pack('<I', start_lba))
out.write(struct.pack('<I', npart))
Expand Down