[syslinux] [PATCH 2/6] utils/isohybrid.c: Correct blocking factor in APM partition block counts

Thomas Schmitt scdbackup at gmx.net
Sun Jun 22 13:24:18 PDT 2014


The block counts in the APM partitions assumed 512 bytes per block,
whereas the start block numbers assume 2048 as announced in the APM header.

This change divides the affected block counts by 4 to correct the assumption.
---
 utils/isohybrid.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index c5b4281..7d0864e 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -842,7 +842,7 @@ initialise_apm(uint8_t *gpt, uint32_t start)
     part->signature = bendian_short(0x504d);
     part->map_count = bendian_int(apm_parts);
     part->start_block = bendian_int(1);
-    part->block_count = bendian_int(0x10);
+    part->block_count = bendian_int(4);
     strcpy(part->name, "Apple");
     strcpy(part->type, "Apple_partition_map");
     part->data_start = bendian_int(0);
@@ -854,11 +854,11 @@ initialise_apm(uint8_t *gpt, uint32_t start)
     part->signature = bendian_short(0x504d);
     part->map_count = bendian_int(3);
     part->start_block = bendian_int(efi_lba);
-    part->block_count = bendian_int(efi_count);
+    part->block_count = bendian_int(efi_count / 4);
     strcpy(part->name, "EFI");
     strcpy(part->type, "Apple_HFS");
     part->data_start = bendian_int(0);
-    part->data_count = bendian_int(efi_count);
+    part->data_count = bendian_int(efi_count / 4);
     part->status = bendian_int(0x33);
 
     part = (struct apple_part_header *)(gpt + 4096);
@@ -868,11 +868,11 @@ initialise_apm(uint8_t *gpt, uint32_t start)
 	part->signature = bendian_short(0x504d);
 	part->map_count = bendian_int(3);
 	part->start_block = bendian_int(mac_lba);
-	part->block_count = bendian_int(mac_count);
+	part->block_count = bendian_int(mac_count / 4);
 	strcpy(part->name, "EFI");
 	strcpy(part->type, "Apple_HFS");
 	part->data_start = bendian_int(0);
-	part->data_count = bendian_int(mac_count);
+	part->data_count = bendian_int(mac_count / 4);
 	part->status = bendian_int(0x33);
     } else {
 	part->signature = bendian_short(0x504d);
-- 
1.8.4.2



More information about the Syslinux mailing list