Some corrections about -report_system_area cmd and as_mkisofs
This commit is contained in:
parent
1d287c0b74
commit
6125508b79
@ -1488,12 +1488,16 @@ ex:;
|
||||
/* @param flag bit0= zeroize MBR partition table
|
||||
bit1= zeroize GPT
|
||||
bit2= zeroize APM
|
||||
bit30= Source imported_iso rather than local_fs
|
||||
*/
|
||||
int Xorriso_add_intvl_adr(struct XorrisO *xorriso, char *buf,
|
||||
uint64_t start_adr, uint64_t end_adr, char *suffix,
|
||||
int flag)
|
||||
{
|
||||
sprintf(buf + strlen(buf), "--interval:local_fs:%.f%s-%.f%s:",
|
||||
char *path;
|
||||
|
||||
sprintf(buf + strlen(buf), "--interval:%s:%.f%s-%.f%s:",
|
||||
((flag & (1 << 30)) ? "imported_iso" : "local_fs"),
|
||||
(double) start_adr, suffix, (double) end_adr, suffix);
|
||||
if(flag & 1)
|
||||
strcat(buf, "zero_mbrpt,");
|
||||
@ -1504,7 +1508,10 @@ int Xorriso_add_intvl_adr(struct XorrisO *xorriso, char *buf,
|
||||
if(buf[strlen(buf) - 1] == ',')
|
||||
buf[strlen(buf) - 1] = 0;
|
||||
strcat(buf, ":");
|
||||
Text_shellsafe(xorriso->indev, buf, 1);
|
||||
path= xorriso->indev;
|
||||
if(strncmp(path, "stdio:", 6) == 0)
|
||||
path+= 6;
|
||||
Text_shellsafe(path, buf, 1);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@ -1519,7 +1526,8 @@ 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, have_prep= 0, did_sysarea= 0, cared_for_apm= 0;
|
||||
int have_sysarea= 0, ptable_killer, have_alpha_ldr_path= 0;
|
||||
int cared_for_sparc= 0;
|
||||
int have_sysarea= 0, ptable_killer, imported_iso, 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;
|
||||
char name[24], *textpt, *contentpt, *buf= NULL, *sa_summary= "";
|
||||
@ -1538,7 +1546,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
int elto_count= 0;
|
||||
uint32_t img_blocks= 0;
|
||||
|
||||
struct mbr_par {
|
||||
uint8_t ptype;
|
||||
};
|
||||
struct mbr_par *mbrpts= NULL;
|
||||
int mbr_count= 0;
|
||||
|
||||
struct gpt_par {
|
||||
int ptype; /* 0= unknown, 1= gpt-basdat, 2=gpt-hfsplus, 3=EFI */
|
||||
int has_path;
|
||||
@ -1559,6 +1572,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
mkisofs= !!(flag & 2);
|
||||
imported_iso= (!mkisofs) << 30;
|
||||
|
||||
*cmd_count= 0;
|
||||
line_count= et_line_count + sa_line_count;
|
||||
@ -1612,6 +1626,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
|
||||
if(elto_count > 0)
|
||||
Xorriso_alloc_meM(et_imgs, struct elto_img_par, elto_count);
|
||||
if(mbr_count > 0)
|
||||
Xorriso_alloc_meM(mbrpts, struct mbr_par, mbr_count);
|
||||
if(gpt_count > 0)
|
||||
Xorriso_alloc_meM(gpts, struct gpt_par, gpt_count);
|
||||
if(apm_count > 0)
|
||||
@ -1681,6 +1697,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
idx= num[0] - 1;
|
||||
et_imgs[idx].sel_crit= textpt;
|
||||
|
||||
} else if(strcmp(name, "MBR partition :") == 0) {
|
||||
sscanf(contentpt, "%lu 0x%lx 0x%lx %lu %lu",
|
||||
&partno, &part_status, &part_type, &start_block, &num_blocks);
|
||||
idx= partno - 1;
|
||||
mbrpts[idx].ptype= part_type;
|
||||
|
||||
} else if(strcmp(name, "GPT type GUID :") == 0) {
|
||||
idx= num[0] - 1;
|
||||
if(strcmp(textpt, "a2a0d0ebe5b9334487c068b6b72699c7") == 0)
|
||||
@ -1740,7 +1762,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
else
|
||||
sprintf(buf, "-boot_image isolinux system_area=");
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s",
|
||||
ptable_killer);
|
||||
imported_iso | ptable_killer);
|
||||
Xorriso_record_cmd_linE
|
||||
did_sysarea= 1;
|
||||
}
|
||||
@ -1750,7 +1772,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
else
|
||||
sprintf(buf, "-boot_image grub grub2_mbr=");
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s",
|
||||
ptable_killer);
|
||||
imported_iso | ptable_killer);
|
||||
Xorriso_record_cmd_linE
|
||||
did_sysarea= 1;
|
||||
}
|
||||
@ -1807,7 +1829,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
if(!appended_as_gpt) {
|
||||
sprintf(buf, "-append_partition %lu 0x%lx ", partno, part_type);
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) start_block,
|
||||
((uint64_t) start_block) + num_blocks - 1, "d", 0);
|
||||
((uint64_t) start_block) + num_blocks - 1, "d",
|
||||
imported_iso);
|
||||
}
|
||||
} else if(part_type == 0x41 && have_prep) {
|
||||
if(mkisofs) {
|
||||
@ -1816,9 +1839,27 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
sprintf(buf, "-boot_image any prep_boot_part=");
|
||||
}
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) start_block,
|
||||
((uint64_t) start_block) + num_blocks - 1, "d", 0);
|
||||
((uint64_t) start_block) + num_blocks - 1, "d",
|
||||
imported_iso);
|
||||
}
|
||||
|
||||
} else if(strcmp(name, "MBR partition path :") == 0) {
|
||||
idx= num[0] - 1;
|
||||
if(mbrpts[idx].ptype == 0xef) {
|
||||
if(gpt_count < 1 && !(flag & 1)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot make proposal to mark data file as MBR ESP without being in GPT : ");
|
||||
Text_shellsafe(textpt, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
} /* else "GPT partition path :" will produce -efi-boot-part */
|
||||
} else if(!(flag & 1)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot make proposal to mark data file as MBR partition of type 0x%x : ",
|
||||
(unsigned int) mbrpts[idx].ptype);
|
||||
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) {
|
||||
|
||||
/* >>> ??? need command to set disk GUID */;
|
||||
@ -1855,6 +1896,12 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
if(et_imgs[et_idx].platform_id == 0xef)
|
||||
first_efi= 0;
|
||||
}
|
||||
if(et_idx >= elto_count) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot make proposal to mark data file as GPT partition : ");
|
||||
Text_shellsafe(textpt, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
||||
}
|
||||
|
||||
} else if(strcmp(name, "GPT start and size :") == 0) {
|
||||
idx= num[0] - 1;
|
||||
@ -1871,9 +1918,10 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
Xorriso_record_cmd_linE
|
||||
appended_as_gpt= 2;
|
||||
}
|
||||
sprintf(buf, "-append_partition %lu 0x%lx ", partno, part_type);
|
||||
sprintf(buf, "-append_partition %d 0x%lx ", idx + 1, part_type);
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) num[1],
|
||||
(uint64_t) (num[1] + num[2] - 1.0), "d", 0);
|
||||
(uint64_t) (num[1] + num[2] - 1.0), "d",
|
||||
imported_iso);
|
||||
|
||||
} else if(gpts[idx].ptype == 3 && gpts[idx].has_path == 0 &&
|
||||
img_blocks >= num[1] + num[2] && !efi_boot_part) {
|
||||
@ -1882,7 +1930,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
else
|
||||
sprintf(buf, "-boot_image any efi_boot_part=");
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) num[1],
|
||||
(uint64_t) (num[1] + num[2] - 1.0), "d", 0);
|
||||
(uint64_t) (num[1] + num[2] - 1.0), "d",
|
||||
imported_iso);
|
||||
efi_boot_part= 2;
|
||||
|
||||
}
|
||||
@ -1944,6 +1993,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
} else
|
||||
sprintf(buf, "-boot_image grub grub2_sparc_core=");
|
||||
Text_shellsafe(textpt, buf, 1);
|
||||
cared_for_sparc= 1;
|
||||
|
||||
} else if(strcmp(name, "SUN SPARC partition:") == 0) {
|
||||
have_sparc_part= 1;
|
||||
@ -2020,14 +2070,16 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
if(full_sparc_part == 255) {
|
||||
if(mkisofs) {
|
||||
sprintf(buf, "-G ");
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s", 0);
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s",
|
||||
imported_iso);
|
||||
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_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s",
|
||||
imported_iso);
|
||||
Xorriso_record_cmd_linE
|
||||
did_sysarea= 1;
|
||||
for(i= 2; i <= 8; i++) {
|
||||
@ -2035,7 +2087,8 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
Xorriso_record_cmd_linE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cared_for_sparc= 1;
|
||||
} else if(!cared_for_sparc) {
|
||||
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);
|
||||
@ -2048,7 +2101,7 @@ static int Xorriso_scan_report_lines(struct XorrisO *xorriso,
|
||||
else
|
||||
sprintf(buf, "-boot_image any system_area=");
|
||||
Xorriso_add_intvl_adr(xorriso, buf, (uint64_t) 0, (uint64_t) 15, "s",
|
||||
ptable_killer);
|
||||
imported_iso | ptable_killer);
|
||||
Xorriso_record_cmd_linE
|
||||
did_sysarea= 1;
|
||||
}
|
||||
@ -2222,6 +2275,7 @@ after_el_torito:
|
||||
ex:
|
||||
Xorriso_free_meM(apms);
|
||||
Xorriso_free_meM(gpts);
|
||||
Xorriso_free_meM(mbrpts);
|
||||
Xorriso_free_meM(et_imgs);
|
||||
Xorriso_free_meM(lines);
|
||||
Xorriso_free_meM(buf);
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2015.05.07.151926"
|
||||
#define Xorriso_timestamP "2015.05.10.093325"
|
||||
|
Loading…
Reference in New Issue
Block a user