Skip to content

Commit 69af899

Browse files
committed
ptool: Correct MBR sector occupancy calculation
Fix MBR sector occupancy calculation to reflect dynamic sector sizes. Ensure MBR occupies one sector: 0.5KB or 4KB depending on configuration. Match actual device layout for correctness. Signed-off-by: Xiaoming Zhao <[email protected]>
1 parent 58b3eef commit 69af899

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
@@ -1000,7 +1000,7 @@ def CreateGPTPartitionTable(PhysicalPartitionNumber,UserProvided=False):
10001000
#ShowBackupGPT(32)
10011001

10021002
UpdateRawProgram(RawProgramXML,0, PrimaryGPTNumLBAs*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, 0, PrimaryGPTNumLBAs, os.path.basename(GPTMAIN), 'false', 'PrimaryGPT','false','true')
1003-
UpdateRawProgram(RawProgramXML_Wipe,0, 1*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, 0, 1, "zeros_33sectors.bin", 'false', 'PrimaryGPT','false','true')
1003+
UpdateRawProgram(RawProgramXML_Wipe,0, 1*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, 0, 1, "zeros_1sector.bin", 'false', 'PrimaryGPT-MBR','false','true')
10041004
UpdateRawProgram(RawProgramXML_Wipe,1, BackupGPTNumLBAs*SECTOR_SIZE_IN_BYTES/1024.0, PhysicalPartitionNumber, 0, BackupGPTNumLBAs, "zeros_%dsectors.bin" % BackupGPTNumLBAs, 'false', 'PrimaryGPT','false','true')
10051005

10061006
#print "szStartSector=%s" % szStartSector

0 commit comments

Comments
 (0)