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

syslinux-bot for Thomas Schmitt scdbackup at gmx.net
Mon Jun 23 20:09:05 PDT 2014


Commit-ID:  ee9c8a36dc63c54794f5836d5c908d7e4c84fa04
Gitweb:     http://www.syslinux.org/commit/ee9c8a36dc63c54794f5836d5c908d7e4c84fa04
Author:     Thomas Schmitt <scdbackup at gmx.net>
AuthorDate: Sun, 22 Jun 2014 22:24:18 +0200
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 23 Jun 2014 19:48:55 -0700

utils/isohybrid.c: Correct blocking factor in APM partition block counts

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.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 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);


More information about the Syslinux-commits mailing list