Skip to content

Commit fe346a2

Browse files
committed
ptool: Dynamically erase main GPT based on sector size
Erase main GPT sectors dynamically based on sector size. Use 34 sectors for 512-byte sectors and 6 for 4096-byte sectors. Improve accuracy and compatibility with different storage configurations. Signed-off-by: Xiaoming Zhao <[email protected]>
1 parent aab48ce commit fe346a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ptool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def CreateGPTPartitionTable(PhysicalPartitionNumber,UserProvided=False):
799799
PhyPartition[k][j]['partofsingleimage'])
800800

801801
if j==0:
802-
UpdateRawProgram(RawProgramXML_Blank,0, 33*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, FileOffset[z], 33, "gpt_empty%d.bin" % k, "false", "PrimaryGPT", "false", "false")
802+
UpdateRawProgram(RawProgramXML_Blank,0, PrimaryGPTNumLBAs*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, FileOffset[z], PrimaryGPTNumLBAs, "gpt_empty%d.bin" % k, "false", "PrimaryGPT", "false", "false")
803803

804804

805805
LastLBA += 1 ## move to the next free sector, also, 0 to 9 inclusive means it's 10

0 commit comments

Comments
 (0)