Some corrections about -report_system_area cmd and as_mkisofs

This commit is contained in:
Thomas Schmitt 2015-05-11 16:04:21 +00:00
parent 2bc1acf90b
commit 8c1a77fdd8
2 changed files with 90 additions and 41 deletions

View File

@ -1516,6 +1516,50 @@ int Xorriso_add_intvl_adr(struct XorrisO *xorriso, char *buf,
} }
struct elto_img_par {
int n, ldsiz, boot_info_table, grub2_boot_info;
int do_gpt_basdat, do_gpt_hfsplus, do_apm_hfsplus;
unsigned int ld_seg, hdpt, platform_id;
unsigned long int lba;
char pltf[8], b[8], emul[8], boot_image_type[16];
char *path, *id_string, *sel_crit;
};
/* @param ptype 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI
@param flag bit0= isohybrid
*/
static int Xorriso_search_eltorito_path(struct XorrisO *xorriso,
struct elto_img_par *et_imgs,
int elto_count, char *path, int ptype,
int *found, int *efi_boot_part,
int flag)
{
int first_efi= 1, et_idx;
for(et_idx= 0; et_idx < elto_count; et_idx++) {
if(strcmp(et_imgs[et_idx].path, path) != 0)
continue;
if(flag & 1) {
if(ptype == 1 || ptype == 3)
et_imgs[et_idx].do_gpt_basdat= 1;
else if(ptype == 2)
et_imgs[et_idx].do_gpt_hfsplus= 1;
break;
} else if(first_efi && et_imgs[et_idx].platform_id == 0xef) {
*efi_boot_part= 1;
break;
}
if(et_imgs[et_idx].platform_id == 0xef)
first_efi= 0;
}
*found= et_idx;
if(et_idx < elto_count)
return(1);
return(0);
}
/* @param flag bit0= do not record but only count /* @param flag bit0= do not record but only count
*/ */
static int Xorriso_scan_report_lines(struct XorrisO *xorriso, static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
@ -1524,7 +1568,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
char **cmds, int *cmd_count, int flag) char **cmds, int *cmd_count, int flag)
{ {
int ret= 0, i, num_count, mkisofs, line_count, idx, et_idx, isohybrid= 0; int ret= 0, i, num_count, mkisofs, line_count, idx, et_idx, isohybrid= 0;
int efi_boot_part= 0, first_efi, full_sparc_part= 0, have_sparc_part= 0; int ptype, gpt_idx;
int efi_boot_part= 0, full_sparc_part= 0, have_sparc_part= 0;
int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0; int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0;
int cared_for_sparc= 0; int cared_for_sparc= 0;
int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0; int have_sysarea= 0, ptable_killer, imported_iso, have_alpha_ldr_path= 0;
@ -1534,14 +1579,6 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
char **lines= NULL; char **lines= NULL;
double num[8]; double num[8];
char *cat_path= ""; char *cat_path= "";
struct elto_img_par {
int n, ldsiz, boot_info_table, grub2_boot_info;
int do_gpt_basdat, do_gpt_hfsplus, do_apm_hfsplus;
unsigned int ld_seg, hdpt, platform_id;
unsigned long int lba;
char pltf[8], b[8], emul[8], boot_image_type[16];
char *path, *id_string, *sel_crit;
};
struct elto_img_par *et_imgs= NULL; struct elto_img_par *et_imgs= NULL;
int elto_count= 0; int elto_count= 0;
uint32_t img_blocks= 0; uint32_t img_blocks= 0;
@ -1555,6 +1592,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
struct gpt_par { struct gpt_par {
int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */ int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */
int has_path; int has_path;
char *path;
}; };
struct gpt_par *gpts= NULL; struct gpt_par *gpts= NULL;
int gpt_count= 0; int gpt_count= 0;
@ -1624,12 +1662,18 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} }
} }
if(elto_count > 0) if(elto_count > 0) {
Xorriso_alloc_meM(et_imgs, struct elto_img_par, elto_count); Xorriso_alloc_meM(et_imgs, struct elto_img_par, elto_count);
for(et_idx= 0; et_idx < elto_count; et_idx++)
et_imgs[et_idx].path= NULL;
}
if(mbr_count > 0) if(mbr_count > 0)
Xorriso_alloc_meM(mbrpts, struct mbr_par, mbr_count); Xorriso_alloc_meM(mbrpts, struct mbr_par, mbr_count);
if(gpt_count > 0) if(gpt_count > 0) {
Xorriso_alloc_meM(gpts, struct gpt_par, gpt_count); Xorriso_alloc_meM(gpts, struct gpt_par, gpt_count);
for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++)
gpts[gpt_idx].path= NULL;
}
if(apm_count > 0) if(apm_count > 0)
Xorriso_alloc_meM(apms, struct apm_par, apm_count); Xorriso_alloc_meM(apms, struct apm_par, apm_count);
@ -1724,6 +1768,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "GPT partition path :") == 0) { } else if(strcmp(name, "GPT partition path :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
gpts[idx].has_path= 1; gpts[idx].has_path= 1;
gpts[idx].path= textpt;
} else if(strcmp(name, "APM partition type :") == 0) { } else if(strcmp(name, "APM partition type :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
@ -1845,19 +1890,38 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "MBR partition path :") == 0) { } else if(strcmp(name, "MBR partition path :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
if(mbrpts[idx].ptype == 0xef) { if(!(flag & 1)) {
if(gpt_count < 1 && !(flag & 1)) { if(mbrpts[idx].ptype == 0x41) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR ESP without being in GPT : "); "Cannot make proposal to mark PReP partition by data file: ");
Text_shellsafe(textpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
continue;
}
ptype= 0;
if(mbrpts[idx].ptype == 0xef)
ptype= 3;
ret= Xorriso_search_eltorito_path(xorriso, et_imgs, elto_count,
textpt, ptype,
&et_idx, &efi_boot_part, !!isohybrid);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being an El Torito boot image : ");
Text_shellsafe(textpt, xorriso->info_text, 1); Text_shellsafe(textpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
} /* else "GPT partition path :" will produce -efi-boot-part */ } else {
} else if(!(flag & 1)) { for(gpt_idx= 0; gpt_idx < gpt_count; gpt_idx++) {
sprintf(xorriso->info_text, if(gpts[gpt_idx].path != NULL)
"Cannot make proposal to mark data file as MBR partition of type 0x%x : ", if(strcmp(gpts[gpt_idx].path, textpt) == 0)
(unsigned int) mbrpts[idx].ptype); break;
Text_shellsafe(textpt, xorriso->info_text, 1); }
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); if(gpt_idx >= gpt_count) {
sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as MBR partition without being in GPT : ");
Text_shellsafe(textpt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
}
}
} }
} else if(strcmp(name, "GPT disk GUID :") == 0) { } else if(strcmp(name, "GPT disk GUID :") == 0) {
@ -1878,25 +1942,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
} else if(strcmp(name, "GPT partition path :") == 0) { } else if(strcmp(name, "GPT partition path :") == 0) {
idx= num[0] - 1; idx= num[0] - 1;
/* Check El Torito boot images for same path */ ret= Xorriso_search_eltorito_path(xorriso, et_imgs, elto_count,
first_efi= 1; textpt, gpts[idx].ptype,
for(et_idx= 0; et_idx < elto_count; et_idx++) { &et_idx, &efi_boot_part, !!isohybrid);
if(strcmp(et_imgs[et_idx].path, textpt) != 0) if(ret <= 0) {
continue;
if(isohybrid) {
if(gpts[idx].ptype == 1 || gpts[idx].ptype == 3)
et_imgs[et_idx].do_gpt_basdat= 1;
else if(gpts[idx].ptype == 2)
et_imgs[et_idx].do_gpt_hfsplus= 1;
break;
} else if(first_efi && et_imgs[et_idx].platform_id == 0xef) {
efi_boot_part= 1;
break;
}
if(et_imgs[et_idx].platform_id == 0xef)
first_efi= 0;
}
if(et_idx >= elto_count) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"Cannot make proposal to mark data file as GPT partition : "); "Cannot make proposal to mark data file as GPT partition : ");
Text_shellsafe(textpt, xorriso->info_text, 1); Text_shellsafe(textpt, xorriso->info_text, 1);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.05.10.093325" #define Xorriso_timestamP "2015.05.11.160333"