Bug fix: The GUIDs of main GPT and backup GPT differed if more than one
System Area was written into the ISO image.
This commit is contained in:
parent
dd27f579eb
commit
a394f4dfd2
@ -1946,6 +1946,7 @@ int ecma119_image_new(IsoImage *src, IsoWriteOpts *in_opts, Ecma119Image **img)
|
|||||||
target->gpt_req[i] = NULL;
|
target->gpt_req[i] = NULL;
|
||||||
target->gpt_req_count = 0;
|
target->gpt_req_count = 0;
|
||||||
target->gpt_req_flags = 0;
|
target->gpt_req_flags = 0;
|
||||||
|
target->gpt_disk_guid_set = 0;
|
||||||
target->gpt_part_start = 0;
|
target->gpt_part_start = 0;
|
||||||
target->gpt_backup_end = 0;
|
target->gpt_backup_end = 0;
|
||||||
target->gpt_backup_size = 0;
|
target->gpt_backup_size = 0;
|
||||||
|
@ -808,6 +808,8 @@ struct ecma119_image
|
|||||||
/* Messages from gpt_tail_writer_compute_data_blocks() to
|
/* Messages from gpt_tail_writer_compute_data_blocks() to
|
||||||
iso_write_system_area().
|
iso_write_system_area().
|
||||||
*/
|
*/
|
||||||
|
uint8_t gpt_disk_guid[16];
|
||||||
|
int gpt_disk_guid_set;
|
||||||
/* Start of GPT entries in System Area, block size 512 */
|
/* Start of GPT entries in System Area, block size 512 */
|
||||||
uint32_t gpt_part_start;
|
uint32_t gpt_part_start;
|
||||||
/* The ISO block number after the backup GPT header , block size 2048 */
|
/* The ISO block number after the backup GPT header , block size 2048 */
|
||||||
|
@ -1385,11 +1385,9 @@ static void iso_write_gpt_entry(Ecma119Image *t, uint8_t *buf,
|
|||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
if (part_uuid[i])
|
if (part_uuid[i])
|
||||||
break;
|
break;
|
||||||
if (i < 16) {
|
if (i == 16)
|
||||||
|
iso_random_uuid(t, part_uuid);
|
||||||
memcpy(wpt, part_uuid, 16);
|
memcpy(wpt, part_uuid, 16);
|
||||||
} else {
|
|
||||||
iso_random_uuid(t, (uint8_t *) wpt);
|
|
||||||
}
|
|
||||||
wpt += 16;
|
wpt += 16;
|
||||||
iso_lsb_to_buf(&wpt, start_lba & 0xffffffff, 4, 0);
|
iso_lsb_to_buf(&wpt, start_lba & 0xffffffff, 4, 0);
|
||||||
iso_lsb_to_buf(&wpt, (start_lba >> 32) & 0xffffffff, 4, 0);
|
iso_lsb_to_buf(&wpt, (start_lba >> 32) & 0xffffffff, 4, 0);
|
||||||
@ -1450,7 +1448,10 @@ int iso_write_gpt_header_block(Ecma119Image *t, uint32_t img_blocks,
|
|||||||
|
|
||||||
/* Disk GUID */
|
/* Disk GUID */
|
||||||
/* >>> Make adjustable */
|
/* >>> Make adjustable */
|
||||||
iso_random_uuid(t, (uint8_t *) wpt);
|
if (!t->gpt_disk_guid_set)
|
||||||
|
iso_random_uuid(t, t->gpt_disk_guid);
|
||||||
|
t->gpt_disk_guid_set = 1;
|
||||||
|
memcpy(wpt, t->gpt_disk_guid, 16);
|
||||||
wpt += 16;
|
wpt += 16;
|
||||||
|
|
||||||
/* Partition entries start */
|
/* Partition entries start */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user