[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-xorriso] PMBR sizing with appended_part_as=gpt
From: |
Thomas Schmitt |
Subject: |
Re: [Bug-xorriso] PMBR sizing with appended_part_as=gpt |
Date: |
Tue, 08 Jan 2019 12:42:51 +0100 |
Hi,
weighing the risk for use cases which i currently might not have in mind
it seems best to check for the special situation of a requested Protective
MBR after the case distinction which has among others
} else if ((t->opts->partition_offset > 0 || will_append) &&
sa_type == 0 && t->mbr_req_count == 0) {
For now i have successfully tested:
--- libisofs/system_area.c 2018-06-04 09:34:44.818390310 +0200
+++ libisofs/system_area.c 2019-01-08 12:22:40.274406152 +0100
@@ -2079,6 +2079,21 @@ int iso_write_system_area(Ecma119Image *
}
}
+ /* Check for protective MBR in mbr_req and adjust to GPT size */
+ if (t->gpt_req_count > 0 && sa_type == 0 && t->mbr_req_count == 1) {
+ if (t->mbr_req[0]->type_byte == 0xee && buf[450] == 0xee &&
+ t->mbr_req[0]->desired_slot <= 1) {
+ part_type = 0xee;
+ risk_of_ee = 1;
+ 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;
+ }
+ }
+
if (t->opts->partition_offset > 0 && sa_type == 0 &&
t->mbr_req_count == 0) {
/* Adjust partition table to partition offset.
It can hardly be wrong to do this if there are requested GPT partitions
and a requested protective partition and partition 1 in the MBR buffer
already bears type 0xee.
Nevertheless, it might be that this will not become the final solution.
I still have to explore why partprepend_writer_compute_data_blocks()
requests the protective MBR partition entry on the first hand.
Have a nice day :)
Thomas