Skip to content

Commit

Permalink
Set partition array size to 128
Browse files Browse the repository at this point in the history
  • Loading branch information
swysocki committed Nov 26, 2021
1 parent e308574 commit ed111ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions pygpt_disk/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, disk: Disk) -> None:
self._partition_last_lba = Table.HeaderEntry(48, 8, int(self.disk.sectors - 34))
self._disk_guid = Table.HeaderEntry(56, 16, uuid.uuid4().bytes_le)
self._partition_array_start = Table.HeaderEntry(72, 8, 2)
self._partition_array_length = Table.HeaderEntry(80, 4, 0)
self._partition_array_length = Table.HeaderEntry(80, 4, 128)
self._partition_entry_size = Table.HeaderEntry(84, 4, 128)
self._partition_array_crc = Table.HeaderEntry(88, 4, 0)

Expand Down Expand Up @@ -120,5 +120,9 @@ def _checksum_header(self, offset: int):
self._header_crc.content = binascii.crc32(raw_header)
self._write_section(self._header_crc, offset)

def update_header(self):
pass

if __name__ == "__main__":
disk = Disk(8 * 1024 * 1024, "/tmp/testgpt.img")
t = Table(disk)
t.write()
disk.write()
2 changes: 1 addition & 1 deletion tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def read_header(primary=True):
# partition array start LBA
assert t.disk.buffer.read(8) == (2).to_bytes(8, "little")
# partition array length
assert t.disk.buffer.read(4) == (0).to_bytes(4, "little")
assert t.disk.buffer.read(4) == (128).to_bytes(4, "little")
# partition entry length
assert t.disk.buffer.read(4) == (128).to_bytes(4, "little")
# partition array crc
Expand Down

0 comments on commit ed111ad

Please sign in to comment.