Allowing 1 BIOS boot image and 1 EFI boot image: -boot_image grub efi_path=
This commit is contained in:
parent
8bf6e31379
commit
83e41ceabd
@ -4900,6 +4900,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->boot_image_isohybrid= 0;
|
||||
#endif
|
||||
|
||||
m->boot_image_efi_path[0]= 0;
|
||||
m->system_area_disk_path[0]= 0;
|
||||
m->system_area_options= 0;
|
||||
m->patch_system_area= 0;
|
||||
@ -11248,7 +11249,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
int *weight_list= NULL, weight_count= 0;
|
||||
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
|
||||
char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt;
|
||||
struct stat stbuf;
|
||||
char *boot_path;
|
||||
static char *lower_r_args[3]= {"/", "-exec", "mkisofs_r"};
|
||||
static char *sort_weight_args[4]= {"", "-exec", "sort_weight", ""};
|
||||
|
||||
@ -11338,33 +11339,26 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
i++;
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
if(argv[i][0] != '/')
|
||||
strcat(xorriso->boot_image_bin_path, "/");
|
||||
ret= Sfile_str(xorriso->boot_image_bin_path
|
||||
+ strlen(xorriso->boot_image_bin_path), argv[i], 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
option_b= 1;
|
||||
xorriso->keep_boot_image= 0;
|
||||
|
||||
/* >>> provisory: ts B00419
|
||||
Only one boot image with parameters determined now.
|
||||
/* >>> provisory: ts B00421
|
||||
Only one BIOS boot image and one EFI boot image are possible.
|
||||
Later:
|
||||
Several boot images shall be kept in a list. One is the Default.
|
||||
They can have type BIOS or EFI. If an EFI boot image is present,
|
||||
then platform ID shall be 0xef.
|
||||
The following parameters shall be set later according to the type
|
||||
of the particular boot image list items.
|
||||
They can have type BIOS or EFI.
|
||||
*/
|
||||
if(strcmp(argv[i - 1], "--efi-boot") == 0) {
|
||||
xorriso->boot_platform_id= 0xef;
|
||||
no_emul_boot= 1;
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
/* -load-size is done in pass 2 */
|
||||
was_other_option= 1;
|
||||
} else
|
||||
if(strcmp(argv[i - 1], "--efi-boot") == 0)
|
||||
boot_path= xorriso->boot_image_efi_path;
|
||||
else {
|
||||
boot_path= xorriso->boot_image_bin_path;
|
||||
xorriso->boot_platform_id= 0x00;
|
||||
option_b= 1;
|
||||
}
|
||||
boot_path[0]= 0;
|
||||
if(argv[i][0] != '/')
|
||||
strcat(boot_path, "/");
|
||||
ret= Sfile_str(boot_path + strlen(boot_path), argv[i], 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
xorriso->keep_boot_image= 0;
|
||||
|
||||
} else if(strcmp(argv[i], "-c") == 0 ||
|
||||
strcmp(argv[i], "-eltorito-catalog") == 0) {
|
||||
@ -11750,21 +11744,6 @@ problem_handler_2:;
|
||||
continue;
|
||||
goto ex;
|
||||
}
|
||||
if(xorriso->boot_image_bin_path[0] && xorriso->boot_platform_id == 0xef) {
|
||||
/* >>> provisory: ts B00419
|
||||
get size of xorriso->boot_image_bin_path, round up to 512
|
||||
*/;
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi,
|
||||
xorriso->boot_image_bin_path, sfe, 2 | 8);
|
||||
if(ret<=0)
|
||||
goto problem_handler_2;
|
||||
ret= Xorriso_iso_lstat(xorriso, sfe, &stbuf, 2 | 4);
|
||||
if(ret < 0)
|
||||
goto problem_handler_2;
|
||||
xorriso->boot_image_load_size= ((stbuf.st_size / (off_t) 512) +
|
||||
!!(stbuf.st_size % (off_t) 512)) * 512;
|
||||
}
|
||||
|
||||
if(do_print_size) {
|
||||
ret= Xorriso_option_print_size(xorriso, 1);
|
||||
if(ret<=0)
|
||||
@ -13920,6 +13899,8 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
} else
|
||||
was_ok= 0;
|
||||
|
||||
} else if(strcmp(treatpt, "bin_path=") == 0) {
|
||||
xorriso->boot_image_bin_path[0] = 0;
|
||||
} else if(strncmp(treatpt, "bin_path=", 9) == 0) {
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
||||
xorriso->boot_image_bin_path, 2);
|
||||
@ -13934,6 +13915,15 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
} else
|
||||
strcpy(xorriso->boot_image_bin_form, "any");
|
||||
|
||||
} else if(strcmp(treatpt, "efi_path=") == 0) {
|
||||
xorriso->boot_image_efi_path[0] = 0;
|
||||
} else if(strncmp(treatpt, "efi_path=", 9) == 0) {
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
||||
xorriso->boot_image_efi_path, 2);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
xorriso->keep_boot_image= 0;
|
||||
|
||||
} else if(strncmp(treatpt, "boot_info_table=", 16)==0) {
|
||||
if(strcmp(treatpt + 16, "off") == 0)
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
@ -13942,6 +13932,8 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
else
|
||||
was_ok= 0;
|
||||
|
||||
} else if(strcmp(treatpt, "cat_path=") == 0) {
|
||||
xorriso->boot_image_cat_path[0] = 0;
|
||||
} else if(strncmp(treatpt, "cat_path=", 9) == 0) {
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
||||
xorriso->boot_image_cat_path, 2);
|
||||
|
@ -270,6 +270,7 @@ struct XorrisO { /* the global context of xorriso */
|
||||
char boot_image_cat_path[SfileadrL];
|
||||
off_t boot_image_load_size;
|
||||
int boot_image_isohybrid; /* 0=off , 1=auto , 2=on , 3=force */
|
||||
char boot_image_efi_path[SfileadrL];
|
||||
char system_area_disk_path[SfileadrL];
|
||||
int system_area_options; /* bit0= "GRUB protective msdos label"
|
||||
(a simple partition table)
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2010.04.20.142540"
|
||||
#define Xorriso_timestamP "2010.04.22.143944"
|
||||
|
@ -1826,10 +1826,13 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
enum burn_disc_status s;
|
||||
IsoImage *image= NULL;
|
||||
IsoNode *node, *root_node;
|
||||
ElToritoBootImage *bootimg;
|
||||
ElToritoBootImage *bootimg, *efi_bootimg;
|
||||
enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL;
|
||||
int profile_number;
|
||||
char profile_name[80];
|
||||
char profile_name[80], *boot_image_bin_path;
|
||||
int boot_image_emul, boot_platform_id;
|
||||
off_t boot_image_load_size;
|
||||
struct stat stbuf;
|
||||
|
||||
ret= Xorriso_finish_hl_update(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
@ -1910,21 +1913,41 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
goto ex;
|
||||
|
||||
/* Activate, adjust or discard boot image */
|
||||
boot_image_bin_path= xorriso->boot_image_bin_path;
|
||||
boot_image_emul= xorriso->boot_image_emul;
|
||||
boot_platform_id= xorriso->boot_platform_id;
|
||||
boot_image_load_size= xorriso->boot_image_load_size;
|
||||
|
||||
/* >>> This is kindof a quick hack.
|
||||
Needed would be a list of boot images with own parameters each.
|
||||
*/
|
||||
if(xorriso->boot_image_efi_path[0]) {
|
||||
if(xorriso->boot_image_bin_path[0] == 0) {
|
||||
/* Let EFI boot image be the default image */
|
||||
boot_image_bin_path= xorriso->boot_image_efi_path;
|
||||
boot_image_emul= ELTORITO_NO_EMUL;
|
||||
boot_platform_id= 0xef;
|
||||
ret= Xorriso_iso_lstat(xorriso, xorriso->boot_image_efi_path,
|
||||
&stbuf, 2 | 4);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
boot_image_load_size= ((stbuf.st_size / (off_t) 512) +
|
||||
!!(stbuf.st_size % (off_t) 512)) * 512;
|
||||
}
|
||||
}
|
||||
/* >>> ??? move down to libisoburn ? */
|
||||
if(image!=NULL && !(flag&1)) {
|
||||
ret= iso_image_get_boot_image(image, &bootimg, NULL, NULL);
|
||||
|
||||
/* >>> || xorriso->system_area_disk_path[0] */
|
||||
if(xorriso->boot_image_bin_path[0]) {
|
||||
if(boot_image_bin_path[0]) {
|
||||
/* discard old boot image, set new one */
|
||||
if(ret == 1)
|
||||
iso_image_remove_boot_image(image);
|
||||
if(xorriso->boot_image_emul == 1)
|
||||
if(boot_image_emul == 1)
|
||||
emul_type= ELTORITO_HARD_DISC_EMUL;
|
||||
else if(xorriso->boot_image_emul == 2)
|
||||
else if(boot_image_emul == 2)
|
||||
emul_type= ELTORITO_FLOPPY_EMUL;
|
||||
if(xorriso->boot_image_cat_path[0] == 0) {
|
||||
strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path);
|
||||
strcpy(xorriso->boot_image_cat_path, boot_image_bin_path);
|
||||
cpt= strrchr(xorriso->boot_image_cat_path, '/');
|
||||
if(cpt == NULL)
|
||||
cpt= xorriso->boot_image_cat_path;
|
||||
@ -1933,18 +1956,18 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
strcpy(cpt, "boot.cat");
|
||||
}
|
||||
sprintf(xorriso->info_text, "Activating boot image %s",
|
||||
Text_shellsafe(xorriso->boot_image_bin_path, sfe, 0));
|
||||
Text_shellsafe(boot_image_bin_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
sprintf(xorriso->info_text, "Creating El Torito boot catalog file %s",
|
||||
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
|
||||
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_bin_path,
|
||||
ret= Xorriso_node_from_path(xorriso, image, boot_image_bin_path,
|
||||
&node, 1);
|
||||
if(ret <= 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Cannot find in ISO image: -boot_image ... bin_path=%s",
|
||||
Text_shellsafe(xorriso->boot_image_bin_path, sfe, 0));
|
||||
Text_shellsafe(boot_image_bin_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
@ -1969,7 +1992,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
}
|
||||
}
|
||||
|
||||
ret= iso_image_set_boot_image(image, xorriso->boot_image_bin_path,
|
||||
ret= iso_image_set_boot_image(image, boot_image_bin_path,
|
||||
emul_type, xorriso->boot_image_cat_path,
|
||||
&bootimg);
|
||||
if(ret < 0) {
|
||||
@ -1982,13 +2005,35 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
{ret= 0; goto ex;}
|
||||
}
|
||||
el_torito_set_boot_platform_id(bootimg,
|
||||
(uint8_t) xorriso->boot_platform_id);
|
||||
el_torito_set_boot_platform_id(bootimg, (uint8_t) boot_platform_id);
|
||||
iso_image_set_boot_catalog_weight(image, 1000000000);
|
||||
el_torito_set_load_size(bootimg, xorriso->boot_image_load_size / 512);
|
||||
el_torito_set_load_size(bootimg, boot_image_load_size / 512);
|
||||
ret= Xorriso_set_isolinux_options(xorriso, image, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(boot_image_bin_path == xorriso->boot_image_bin_path &&
|
||||
xorriso->boot_image_efi_path[0]) {
|
||||
/* Add EFI image */
|
||||
sprintf(xorriso->info_text, "Activating additional EFI boot image %s",
|
||||
Text_shellsafe(xorriso->boot_image_efi_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
|
||||
ret= iso_image_add_boot_image(image, xorriso->boot_image_efi_path,
|
||||
ELTORITO_NO_EMUL, 0, &efi_bootimg);
|
||||
if(ret < 0) {
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
Xorriso_report_iso_error(xorriso, "", ret,
|
||||
"Error when adding EFI boot image", 0, "FAILURE", 1);
|
||||
goto ex;
|
||||
}
|
||||
el_torito_set_boot_platform_id(efi_bootimg, (uint8_t) 0xef);
|
||||
ret= Xorriso_iso_lstat(xorriso, xorriso->boot_image_efi_path,
|
||||
&stbuf, 2 | 4);
|
||||
if(ret != 0)
|
||||
goto ex;
|
||||
boot_image_load_size= ((stbuf.st_size / (off_t) 512) +
|
||||
!!(stbuf.st_size % (off_t) 512));
|
||||
el_torito_set_load_size(efi_bootimg, boot_image_load_size);
|
||||
}
|
||||
} else if(xorriso->patch_isolinux_image) {
|
||||
if(ret==1) {
|
||||
relax|= isoburn_igopt_allow_full_ascii;
|
||||
@ -5311,7 +5356,7 @@ int Xorriso_toc_line(struct XorrisO *xorriso, int flag)
|
||||
*/
|
||||
int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret, bin_path_valid= 0,has_isolinux_mbr= 0, i;
|
||||
int ret, bin_path_valid= 0,has_isolinux_mbr= 0, i, num_boots;
|
||||
unsigned int mbr_lba= 0;
|
||||
off_t lb0_count;
|
||||
char *respt, sfe[5*SfileadrL], path[SfileadrL];
|
||||
@ -5319,8 +5364,8 @@ int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag)
|
||||
struct burn_drive_info *dinfo;
|
||||
struct burn_drive *drive;
|
||||
IsoImage *image= NULL;
|
||||
ElToritoBootImage *bootimg;
|
||||
IsoFile *bootimg_node;
|
||||
ElToritoBootImage *bootimg, **boots = NULL;
|
||||
IsoFile *bootimg_node, **bootnodes = NULL;
|
||||
IsoBoot *bootcat_node;
|
||||
|
||||
respt= xorriso->result_line;
|
||||
@ -5336,14 +5381,11 @@ no_boot:;
|
||||
sprintf(respt, "Boot record : none\n");
|
||||
Xorriso_toc_line(xorriso, flag & 8);
|
||||
}
|
||||
return(ret);
|
||||
goto ex;
|
||||
}
|
||||
/* Important: no return before iso_image_unref(image); */
|
||||
|
||||
/* Using the nodes with extreme care . They might be deleted meanwhile. */
|
||||
ret= iso_image_get_boot_image(image, &bootimg, &bootimg_node, &bootcat_node);
|
||||
iso_image_unref(image); /* release obtained reference */
|
||||
image= NULL;
|
||||
if(ret != 1)
|
||||
goto no_boot;
|
||||
ret= Xorriso_path_from_lba(xorriso, NULL, xorriso->loaded_boot_bin_lba,
|
||||
@ -5388,7 +5430,7 @@ no_boot:;
|
||||
strcat(respt, "\n");
|
||||
Xorriso_toc_line(xorriso, flag & 8);
|
||||
if(flag & 2)
|
||||
return(1);
|
||||
{ret= 1; goto ex;}
|
||||
if(bin_path_valid)
|
||||
sprintf(respt, "Boot bin_path: %s\n", Text_shellsafe(path, sfe, 0));
|
||||
else if(xorriso->loaded_boot_bin_lba <= 0)
|
||||
@ -5397,13 +5439,37 @@ no_boot:;
|
||||
sprintf(respt, "Boot bin_path: -not-found-any-more-by-lba=%d\n",
|
||||
xorriso->loaded_boot_bin_lba);
|
||||
Xorriso_toc_line(xorriso, flag & 8);
|
||||
|
||||
ret= iso_image_get_all_boot_imgs(image, &num_boots, &boots, &bootnodes, 0);
|
||||
Xorriso_process_msg_queues(xorriso,0);
|
||||
if(ret == 1 && num_boots > 1) {
|
||||
for(i= 1; i < num_boots; i++) {
|
||||
ret= el_torito_get_boot_platform_id(boots[i]);
|
||||
if(ret == 0xef) {
|
||||
ret= Xorriso_path_from_node(xorriso, (IsoNode *) bootnodes[i], path, 0);
|
||||
if(ret > 0) {
|
||||
sprintf(respt, "Boot efi_path: %s\n", Text_shellsafe(path, sfe, 0));
|
||||
Xorriso_toc_line(xorriso, flag & 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(xorriso->loaded_boot_cat_path[0])
|
||||
sprintf(respt, "Boot cat_path: %s\n",
|
||||
Text_shellsafe(xorriso->loaded_boot_cat_path, sfe, 0));
|
||||
else
|
||||
sprintf(respt, "Boot cat_path: -not-found-at-load-time-\n");
|
||||
Xorriso_toc_line(xorriso, flag & 8);
|
||||
return(1);
|
||||
ret= 1;
|
||||
ex:;
|
||||
if(boots != NULL)
|
||||
free(boots);
|
||||
if(bootnodes != NULL);
|
||||
free(bootnodes);
|
||||
if(image != NULL)
|
||||
iso_image_unref(image); /* release obtained reference */
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user