Skip to content

Commit 658e05e

Browse files
committed
ptool: Dynamically erase MBR sector according to sector size
Erase MBR sector dynamically based on actual sector size. Use 0.5KB for 512-byte sectors and 4KB for 4096-byte sectors. Improve compatibility across devices with varying sector sizes. Signed-off-by: Xiaoming Zhao <[email protected]>
1 parent bcc2087 commit 658e05e

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
@@ -397,7 +397,7 @@ def CreateErasingRawProgramFiles():
397397
temp.append(Comment('NOTE: Sector size is %ibytes'%SECTOR_SIZE_IN_BYTES))
398398

399399
CreateFileOfZeros("zeros_33sectors.bin",33)
400-
UpdateRawProgram(temp,0, 0.5, i, 0, 1, "zeros_33sectors.bin", "false", "Overwrite MBR sector")
400+
UpdateRawProgram(temp,0, 1*SECTOR_SIZE_IN_BYTES/1024.0, i, 0, 1, "zeros_1sector.bin", "false", "Overwrite MBR sector")
401401
UpdateRawProgram(temp,1, BackupGPTNumLBAs*SECTOR_SIZE_IN_BYTES/1024.0, i, 0, BackupGPTNumLBAs, "zeros_%dsectors.bin" % BackupGPTNumLBAs, "false", "Overwrite Primary GPT Sectors")
402402

403403
backup_gpt_lba = -BackupGPTNumLBAs

0 commit comments

Comments
 (0)