factory: Use 'L' in pygpt.StructField for crc32 value
`binascii.crc32` will returns unsigned integer in python3, so we need to
use 'L' (unsigned) for pygpt.StructField.
BUG=chromium:999876
TEST=None
Change-Id: Ide52ce1f50153f7a6c9d9fad7e06bceb53b4209a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/1991275
Tested-by: Yilin Yang (kerker) <kerker@chromium.org>
Commit-Queue: Yilin Yang (kerker) <kerker@chromium.org>
Reviewed-by: Chun-Tsen Kuo <chuntsen@chromium.org>
Reviewed-by: Kevin Lin <kevinptt@chromium.org>
diff --git a/py/utils/pygpt.py b/py/utils/pygpt.py
index 2e4240e..f5a0785 100755
--- a/py/utils/pygpt.py
+++ b/py/utils/pygpt.py
@@ -190,14 +190,14 @@
return PartitionAttributes(value)
-# The binascii.crc32 returns signed integer, so CRC32 in in struct must be
-# declared as 'signed' (l) instead of 'unsigned' (L).
+# The binascii.crc32 returns unsigned integer in python3, so CRC32 in struct
+# must be declared as 'unsigned' (L).
# http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_table_header_.28LBA_1.29
HEADER_FIELDS = [
StructField('8s', 'Signature'),
StructField('4s', 'Revision'),
StructField('L', 'HeaderSize'),
- StructField('l', 'CRC32'),
+ StructField('L', 'CRC32'),
StructField('4s', 'Reserved'),
StructField('Q', 'CurrentLBA'),
StructField('Q', 'BackupLBA'),
@@ -207,7 +207,7 @@
StructField('Q', 'PartitionEntriesStartingLBA'),
StructField('L', 'PartitionEntriesNumber'),
StructField('L', 'PartitionEntrySize'),
- StructField('l', 'PartitionArrayCRC32'),
+ StructField('L', 'PartitionArrayCRC32'),
]
# http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_entries