From 003aa5832ef2c7feb59d571bf4a06cb19f11c66f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 14 Apr 2015 20:13:06 +0200 Subject: [PATCH] Fixing an omission of rev 1183. Protective MBR was produced for appended GPT partitions only if ISOLINUX isohybrid was enabled. --- libisofs/system_area.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libisofs/system_area.c b/libisofs/system_area.c index 90f655c..38bd1e5 100644 --- a/libisofs/system_area.c +++ b/libisofs/system_area.c @@ -1828,7 +1828,16 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf) t->partition_heads_per_cyl, buf, 2); if (ret != ISO_SUCCESS) /* error should never happen */ return ISO_ASSERT_FAILURE; - if (t->opts->partition_offset == 0) { + if (t->opts->appended_as_gpt && t->have_appended_partitions) { + /* Re-write partion entry 1 : protective MBR for GPT */ + part_type = 0xee; + ret = write_mbr_partition_entry(1, part_type, + (uint64_t) 1, ((uint64_t) gpt_blocks) * 4 - 1, + t->partition_secs_per_head, t->partition_heads_per_cyl, + buf, 2); + if (ret < 0) + return ret; + } else if (t->opts->partition_offset == 0) { /* Re-write partion entry 1 : start at 0, type Linux */ ret = write_mbr_partition_entry(1, 0x83, (uint64_t) 0, (uint64_t) img_blocks,