Made use of new libisofs isohybrid capability
This commit is contained in:
@ -846,6 +846,60 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_set_isolinux_options(struct XorrisO *xorriso,
|
||||
IsoImage *image, int flag)
|
||||
{
|
||||
int make_isohybrid_mbr= 0, ret;
|
||||
unsigned char buf[68];
|
||||
ElToritoBootImage *bootimg;
|
||||
IsoFile *bootimg_node;
|
||||
void *data_stream= NULL;
|
||||
|
||||
ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, NULL);
|
||||
if(ret != 1) {
|
||||
sprintf(xorriso->info_text, "Programming error: No boot image available in Xorriso_set_isolinux_options()");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(xorriso->boot_image_isohybrid == 0) {
|
||||
ret= el_torito_set_isolinux_options(bootimg, 1, 0);
|
||||
return(ret == 1);
|
||||
}
|
||||
if(xorriso->boot_image_isohybrid == 3) {
|
||||
make_isohybrid_mbr= 1;
|
||||
} else {
|
||||
ret= Xorriso_iso_file_open(xorriso, "", (void *) bootimg_node,
|
||||
&data_stream, 1);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
ret= Xorriso_iso_file_read(xorriso, data_stream, (char *) buf, 68, 0);
|
||||
Xorriso_iso_file_close(xorriso, &data_stream, 0);
|
||||
if(ret<=0)
|
||||
return(ret);
|
||||
if(buf[64] == 0xfb && buf[65] == 0xc0 && buf[66] == 0x78 && buf[67] == 0x70)
|
||||
make_isohybrid_mbr= 1;
|
||||
}
|
||||
|
||||
if(xorriso->boot_image_isohybrid == 2 && !make_isohybrid_mbr) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Isohybrid signature is demanded but not found in boot image file.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
if(make_isohybrid_mbr) {
|
||||
sprintf(xorriso->info_text, "Will write isohybrid MBR.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
}
|
||||
|
||||
ret= el_torito_set_isolinux_options(bootimg, 1 | (make_isohybrid_mbr << 1),0);
|
||||
return(ret == 1);
|
||||
}
|
||||
|
||||
|
||||
#define Xorriso_with_make_isohybrid_mbR 1
|
||||
|
||||
|
||||
/* @param flag bit0= do not write but only prepare and return size in sectors
|
||||
*/
|
||||
int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
@ -928,7 +982,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
relax= isoburn_igopt_allow_deep_paths;
|
||||
|
||||
/* Adjust or discard boot image */
|
||||
/* Activate, adjust or discard boot image */
|
||||
image= isoburn_get_attached_image(source_drive);
|
||||
/* >>> ??? move down to libisoburn ? */
|
||||
if(image!=NULL && !(flag&1)) {
|
||||
@ -951,7 +1005,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
cpt++;
|
||||
strcpy(cpt, "boot.cat");
|
||||
}
|
||||
|
||||
sprintf(xorriso->info_text, "Activating alleged isolinux boot image %s",
|
||||
Text_shellsafe(xorriso->boot_image_bin_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
@ -1003,13 +1056,34 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
el_torito_set_load_size(bootimg, xorriso->boot_image_load_size / 512);
|
||||
|
||||
#ifdef Xorriso_with_make_isohybrid_mbR
|
||||
|
||||
ret= Xorriso_set_isolinux_options(xorriso, image, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
#else
|
||||
el_torito_patch_isolinux_image(bootimg);
|
||||
#endif
|
||||
|
||||
} else if(xorriso->patch_isolinux_image) {
|
||||
if(ret==1) {
|
||||
relax|= isoburn_igopt_allow_full_ascii;
|
||||
sprintf(xorriso->info_text, "Patching alleged isolinux boot image");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
|
||||
|
||||
#ifdef Xorriso_with_make_isohybrid_mbR
|
||||
|
||||
ret= Xorriso_set_isolinux_options(xorriso, image, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
|
||||
#else
|
||||
el_torito_patch_isolinux_image(bootimg);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
sprintf(xorriso->info_text,
|
||||
"Could not find any boot image for -boot_image isolinux patch");
|
||||
|
Reference in New Issue
Block a user