Enabled GPT type GUIDs with -append_partition, -boot_image any iso_mbr_part_type=, and -as mkisofs -iso_mbr_part_type
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2016 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2019 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -627,7 +627,7 @@ int Xorriso_boot_status_non_mbr(struct XorrisO *xorriso, IsoImage *image,
|
||||
int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image,
|
||||
char *filter, FILE *fp, int flag)
|
||||
{
|
||||
int i, is_default;
|
||||
int i, l, is_default;
|
||||
|
||||
is_default= (xorriso->appended_as_gpt == 0);
|
||||
sprintf(xorriso->result_line, "-boot_image any appended_part_as=%s\n",
|
||||
@ -637,8 +637,16 @@ int Xorriso_append_part_status(struct XorrisO *xorriso, IsoImage *image,
|
||||
for(i= 0; i < Xorriso_max_appended_partitionS; i++) {
|
||||
if(xorriso->appended_partitions[i] == NULL)
|
||||
continue;
|
||||
sprintf(xorriso->result_line, "-append_partition %d 0x%2.2x ",
|
||||
i + 1, (unsigned int) xorriso->appended_part_types[i]);
|
||||
sprintf(xorriso->result_line, "-append_partition %d ", i + 1);
|
||||
l= strlen(xorriso->result_line);
|
||||
if(xorriso->appended_part_gpt_flags[i] & 1) {
|
||||
Xorriso__format_guid(xorriso->appended_part_type_guids[i],
|
||||
xorriso->result_line + l, 0);
|
||||
strcpy(xorriso->result_line + l + 32, " ");
|
||||
} else {
|
||||
sprintf(xorriso->result_line + l, "0x%2.2x ",
|
||||
(unsigned int) xorriso->appended_part_types[i]);
|
||||
}
|
||||
Text_shellsafe(xorriso->appended_partitions[i], xorriso->result_line, 1);
|
||||
strcat(xorriso->result_line, "\n");
|
||||
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
||||
@ -1654,12 +1662,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
int appended_partition= 0;
|
||||
#endif
|
||||
|
||||
int iso_mbr_part_type= -1;
|
||||
int iso_mbr_part_type= -1, iso_gpt_part_idx= -1;
|
||||
unsigned int prev_pltf= 0;
|
||||
unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks;
|
||||
unsigned long int part_status, part_type, start_block, partition_offset= 0;
|
||||
uint32_t high_block= 0;
|
||||
char name[24], *textpt, *contentpt, *buf= NULL;
|
||||
char name[24], *textpt, *contentpt, *buf= NULL, part_type_text[37];
|
||||
char **lines= NULL;
|
||||
double num[8];
|
||||
char *cat_path= "";
|
||||
@ -1687,6 +1695,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
|
||||
struct gpt_par {
|
||||
int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */
|
||||
uint8_t type_guid[16];
|
||||
int is_gap;
|
||||
int has_path;
|
||||
char *path;
|
||||
@ -1942,13 +1951,18 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
gpts[idx].ptype= 3; /* EFI System Partition */
|
||||
else
|
||||
gpts[idx].ptype= 0;
|
||||
Xorriso_parse_guid(xorriso, textpt, gpts[idx].type_guid, 1);
|
||||
|
||||
} else if(strcmp(name, "GPT start and size :") == 0) {
|
||||
idx= num[0] - 1;
|
||||
if(num[2] > 0)
|
||||
appended_as_gpt= 1;
|
||||
gpts[idx].start_block= num[1];
|
||||
gpts[idx].block_count= num[2];
|
||||
start_block= gpts[idx].start_block= num[1];
|
||||
num_blocks= gpts[idx].block_count= num[2];
|
||||
if(start_block == partition_offset * 4 &&
|
||||
(start_block + num_blocks) >= high_block * 4 &&
|
||||
iso_gpt_part_idx < 0)
|
||||
iso_gpt_part_idx= idx;
|
||||
|
||||
} else if(strcmp(name, "GPT partition path :") == 0) {
|
||||
idx= num[0] - 1;
|
||||
@ -2210,9 +2224,13 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
}
|
||||
}
|
||||
if(mbr_idx >= mbr_count) {
|
||||
if(appended_as_gpt == 1)
|
||||
if(appended_as_gpt == 1) {
|
||||
appended_as_gpt= 2;
|
||||
sprintf(buf, "-append_partition %d 0x%lx ", idx + 1, part_type);
|
||||
Xorriso__format_guid(gpts[idx].type_guid, part_type_text, 0);
|
||||
} else {
|
||||
sprintf(part_type_text, "0x%lx", part_type);
|
||||
}
|
||||
sprintf(buf, "-append_partition %d %s ", idx + 1, part_type_text);
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) num[1],
|
||||
(uint64_t) (num[1] + num[2] - 1.0), "d",
|
||||
imported_iso);
|
||||
@ -2476,7 +2494,16 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
Xorriso_record_cmd_linE
|
||||
did_sysarea= 1;
|
||||
}
|
||||
if(iso_mbr_part_type >= 0) {
|
||||
if(iso_gpt_part_idx >= 0) {
|
||||
if(mkisofs)
|
||||
sprintf(buf, "-iso_mbr_part_type ");
|
||||
else
|
||||
sprintf(buf, "-boot_image any iso_mbr_part_type=");
|
||||
Xorriso__format_guid(gpts[iso_gpt_part_idx].type_guid, buf + strlen(buf),
|
||||
0);
|
||||
Xorriso_record_cmd_linE
|
||||
|
||||
} else if(iso_mbr_part_type >= 0) {
|
||||
if(mkisofs)
|
||||
sprintf(buf, "-iso_mbr_part_type 0x%2.2x",
|
||||
(unsigned int) iso_mbr_part_type);
|
||||
|
Reference in New Issue
Block a user