New iso_write_opts_set_system_area() option bits 16: GPT "Legacy BIOS bootable" and 17: GPT writable

This commit is contained in:
Thomas Schmitt 2021-05-25 21:10:28 +02:00
parent 75499bcda9
commit 1c4c04d4e2
3 changed files with 19 additions and 3 deletions

View File

@ -4207,7 +4207,7 @@ int iso_write_opts_set_system_area(IsoWriteOpts *opts, char data[32768],
opts->system_area_size = 32768;
}
if (!(flag & 4))
opts->system_area_options = options & 0xffff;
opts->system_area_options = options & 0x3ffff;
return ISO_SUCCESS;
}

View File

@ -2277,9 +2277,19 @@ int iso_write_opts_set_fifo_size(IsoWriteOpts *opts, size_t fifo_size);
* Is normally combined with options bit0.
* Will not be in effect if options bit1 is set.
* bit15= Only with System area type MBR but not with CHRP
* @since 1.4.4
* Enforce MBR "bootable/active" flag. In worst case by dummy
* partition of type 0x00 which occupies block 0.
* @since 1.4.4
* bit16= "Legacy BIOS bootable" in GPT
* @since 1.5.6
* If this bit is set and a GPT partition for the ISO 9660
* filesystem gets written, then set the GPT partition flags bit 2
* "Legacy BIOS bootable".
* bit17= ISO not read-only
* @since 1.5.6
* Do not set GPT partition flag bit 60 "read-only" for the
* ISO 9660 filesystem partition, if such a partition gets
* written.
* @param flag
* bit0 = invalidate any attached system area data. Same as data == NULL
* (This re-activates eventually loaded image System Area data.

View File

@ -1737,6 +1737,7 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
uint32_t p_arr_crc = 0;
uint64_t start_lba, end_lba, goal, part_end, next_end, backup_end_lba;
uint64_t eff_gpt_flags;
int ret, i, gap_counter = 0, up_to;
struct iso_gpt_partition_request *req;
uint8_t gpt_name[72];
@ -1791,11 +1792,16 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
} else if (part_end < goal) {
memset(gpt_name, 0, 72);
type_guid = basic_data_uuid;
eff_gpt_flags= gpt_flags;
if (goal == t->vol_space_size * (uint64_t) 4 &&
part_end == t->opts->partition_offset * (uint64_t) 4) {
sprintf((char *) gpt_name, "ISO9660");
if (t->opts->iso_gpt_flag & 1)
type_guid = t->opts->iso_gpt_type_guid;
if (t->system_area_options & (1 << 16))
eff_gpt_flags|= 4; /* Legacy BIOS bootable */
if (t->system_area_options & (1 << 17))
eff_gpt_flags&= ~(((uint64_t) 1) << 60);/* Not read-only */
} else {
sprintf((char *) gpt_name, "Gap%d", gap_counter);
}
@ -1804,7 +1810,7 @@ static int iso_write_gpt(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf)
ret = iso_quick_gpt_entry(t->gpt_req, &(t->gpt_req_count),
part_end, goal - part_end,
type_guid, zero_uuid,
gpt_flags, gpt_name);
eff_gpt_flags, gpt_name);
if (ret < 0)
return ret;
/* Mark as automatically placed filler request */