New -boot_image settings gpt_iso_bootable= and gpt_iso_not_ro=

This commit is contained in:
2021-05-25 21:18:48 +02:00
parent a1f9d03df0
commit db5d4eb867
8 changed files with 171 additions and 54 deletions

View File

@ -1698,6 +1698,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
int was_force_bootable= 0, have_mbr_force_bootable= 0;
uint64_t gpt_bheader_block= 0, start_block, num_blocks;
uint64_t img_blocks= 0, iso_part_blocks;
char *cpt;
unsigned char bin_data[8];
uint64_t gpt_part_flags;
int was_gpt_iso_bootable= 0, was_gpt_iso_not_ro= 0, bin_count;
struct mbr_par {
uint8_t ptype;
@ -2261,7 +2265,43 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "GPT partition flags:") == 0) {
/* >>> check whether 0x1000000000000001 . Else: complain */;
/* >>> check whether 0x100000000000000[15] . Else: complain */;
cpt= strstr(contentpt, "0x");
if(cpt != NULL) {
ret= Hex_to_bin(cpt + 2, 8, &bin_count, bin_data, 0);
if(ret > 0) {
/* convert big-endian bin_data to local endianness */
gpt_part_flags= 0;
for(gpt_idx= 0; gpt_idx < bin_count; gpt_idx++)
gpt_part_flags|= (((uint64_t) bin_data[gpt_idx]) <<
(8 * (bin_count - 1 - gpt_idx)));
if((gpt_part_flags & 4) && !was_gpt_iso_bootable) {
was_gpt_iso_bootable= 1;
if(buf[0]) {
Xorriso_record_cmd_linE
}
if(mkisofs)
sprintf(buf, "--gpt-iso-bootable");
else
sprintf(buf, "-boot_image any gpt_iso_bootable=on");
}
if(num_count > 0 && num[0] == 1 &&
(!(gpt_part_flags & (((uint64_t) 1) << 60))) &&
!was_gpt_iso_not_ro) {
was_gpt_iso_not_ro= 1;
if(buf[0]) {
Xorriso_record_cmd_linE
}
if(mkisofs)
sprintf(buf, "--gpt-iso-not-ro");
else
sprintf(buf, "-boot_image any gpt_iso_not_ro=on");
}
}
}
} else if(strcmp(name, "GPT partition path :") == 0) {
idx= num[0] - 1;