diff --git a/xorriso/iso_img.c b/xorriso/iso_img.c index 16800b0e..0f85b8b1 100644 --- a/xorriso/iso_img.c +++ b/xorriso/iso_img.c @@ -1518,9 +1518,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, { 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 appended_as_gpt= 0; + int appended_as_gpt= 0, have_prep= 0, did_sysarea= 0, cared_for_apm= 0; + int have_sysarea= 0, ptable_killer, have_alpha_ldr_path= 0; unsigned long int sa_options= 0, partno, id_tag, perms, start_cyl, num_blocks; - unsigned long int part_status, part_type, start_block, have_prep= 0; + unsigned long int part_status, part_type, start_block; char name[24], *textpt, *contentpt, *buf= NULL, *sa_summary= ""; char **lines= NULL; double num[8]; @@ -1537,6 +1538,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, int elto_count= 0; uint32_t img_blocks= 0; + int mbr_count= 0; struct gpt_par { int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */ int has_path; @@ -1581,6 +1583,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, } else if(strcmp(name, "System area summary:") == 0) { sa_summary= contentpt; + have_sysarea= 1; } else if(strcmp(name, "El Torito boot img :") == 0) { if(num[0] > elto_count) @@ -1589,6 +1592,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, } else if(strcmp(name, "PReP boot partition:") == 0) { have_prep= 1; + } else if(strcmp(name, "MBR partition :") == 0) { + if(num[0] > mbr_count) + mbr_count= num[0]; + } else if(strcmp(name, "GPT partition name :") == 0) { if(num[0] > gpt_count) gpt_count= num[0]; @@ -1610,6 +1617,9 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, if(apm_count > 0) Xorriso_alloc_meM(apms, struct apm_par, apm_count); + ptable_killer= (mbr_count > 0) | ((gpt_count > 0) << 1) | + ((apm_count > 0) << 2); + /* First pass: set up objects, record El Torito and info needed in 2nd pass */ for(i= 0; i < line_count; i++) { buf[0]= 0; @@ -1700,6 +1710,9 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, else apms[idx].ptype= 0; + } else if(strcmp(name, "DEC Alpha ldr path :") == 0) { + have_alpha_ldr_path= 1; + } } @@ -1726,16 +1739,20 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, sprintf(buf, "-isohybrid-mbr "); else sprintf(buf, "-boot_image isolinux system_area="); - Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", 7); + Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", + ptable_killer); Xorriso_record_cmd_linE + did_sysarea= 1; } if(strstr(textpt, "grub2-mbr") != NULL) { if(mkisofs) sprintf(buf, "--grub2-mbr "); else sprintf(buf, "-boot_image grub grub2_mbr="); - Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", 7); + Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", + ptable_killer); Xorriso_record_cmd_linE + did_sysarea= 1; } if(strstr(textpt, "protective-msdos-label") != NULL) { if(mkisofs) @@ -1887,13 +1904,16 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, if(strcmp(et_imgs[et_idx].path, textpt) == 0) { if(apms[idx].ptype == 1) et_imgs[et_idx].do_apm_hfsplus= 1; + cared_for_apm= 1; break; } } else if(strcmp(name, "APM start and size :") == 0) { /* >>> check for -hfsplus : APM inside ISO, type Apple_HFS, - no path, isofs.hb and isofs.hx in image */; + no path, isofs.hb and isofs.hx in image + >>> HFS+ magic number ? + */; } else if(strcmp(name, "MIPS-BE boot path :") == 0) { if(mkisofs) @@ -1976,6 +1996,13 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, sprintf(buf, "-boot_image any hppa_bootloader="); Text_shellsafe(textpt, buf, 1); + } else if(strcmp(name, "DEC Alpha ldr adr :") == 0) { + if(!have_alpha_ldr_path) { + sprintf(xorriso->info_text, + "Cannot enable DEC Alpha boot loader because it is not a data file in the ISO filesystem"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } + } else if(strcmp(name, "DEC Alpha ldr path :") == 0) { if(mkisofs) sprintf(buf, "-alpha-boot "); @@ -1983,8 +2010,6 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, sprintf(buf, "-boot_image any alpha_boot="); Text_shellsafe(textpt, buf, 1); - /* >>> what to do if "DEC Alpha ldr adr :" without path ? */; - } if(buf[0]) @@ -1997,25 +2022,38 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, sprintf(buf, "-G "); Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", 0); Xorriso_record_cmd_linE + did_sysarea= 1; sprintf(buf, "-B ..."); Xorriso_record_cmd_linE } else { sprintf(buf, "-boot_image any system_area="); Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", 0); Xorriso_record_cmd_linE + did_sysarea= 1; for(i= 2; i <= 8; i++) { sprintf(buf, "-append_partition %d 0x00 .", i); Xorriso_record_cmd_linE } } } else { - - /* >>> Warn of non-trivial partition situation */; - + sprintf(xorriso->info_text, + "Cannot enable SUN Disk Label because of non-trivial partition layout"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); } } + if(have_sysarea && !did_sysarea) { + /* Zeroize old partition tables from -indev */ + if(mkisofs) + sprintf(buf, "-G "); + else + sprintf(buf, "-boot_image any system_area="); + Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", + ptable_killer); + Xorriso_record_cmd_linE + did_sysarea= 1; + } - /* >>> Issue commands related to El Torito */; + /* Issue commands related to El Torito */ if(elto_count <= 0) goto after_el_torito; @@ -2041,9 +2079,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, Xorriso_record_cmd_linE for(idx= 0; idx < elto_count; idx++) { if(et_imgs[idx].ld_seg != 0 && et_imgs[idx].ld_seg != 0x07c0) { - - /* >>> Warn that load segment cannot be represented */; - + if(!(flag & 1)) { + sprintf(xorriso->info_text, + "Cannot enable EL Torito boot image #%d because its Load Segment is neither 0x0 nor 0x7c0", + idx + 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } continue; } if(idx > 0) { @@ -2064,19 +2105,25 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, else sprintf(buf, "-boot_image %s efi_path=", et_imgs[idx].boot_image_type); } else { - if(mkisofs) { - - /* >>> Warn that platform id cannot be represented by -as mkisofs */; - + if(mkisofs && !(flag & 1)) { + sprintf(xorriso->info_text, + "Cannot enable EL Torito boot image #%d because Platform Id 0x%2.2x cannot be expressed in mkisofs emulation", + idx + 1, et_imgs[idx].platform_id); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); continue; } } if(et_imgs[idx].path[0] == 0) { - /* >>> need way to eploit El Torito img blks : */; - - /* >>> Warn that no file was found which matches LBA of boot image */; + /* >>> need way to eploit El Torito img blks : */; + if(!(flag & 1)) { + sprintf(xorriso->info_text, + "Cannot enable EL Torito boot image #%d because it is not a data file in the ISO filesystem", + idx + 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } + buf[0]= 0; continue; } Text_shellsafe(et_imgs[idx].path, buf, 1); @@ -2165,6 +2212,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso, } after_el_torito: + if((apm_count > 0 && !cared_for_apm) && !(flag & 1)) { + sprintf(xorriso->info_text, + "Cannot make proposal to produce APM of loaded image"); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + } + ret= 1; ex: Xorriso_free_meM(apms); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index e9b7722f..7716f16f 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2015.05.07.075329" +#define Xorriso_timestamP "2015.05.07.151926"