Allowing up to 32 boot images, -boot_image any id_string=, sel_crit=
This commit is contained in:
@ -137,7 +137,7 @@ or
|
||||
#endif /* ! Xorriso_with_old_readlinE */
|
||||
#endif /* Xorriso_with_readlinE */
|
||||
|
||||
#define TSOB_FELD(typ,anz) (typ *) malloc((anz)*sizeof(typ));
|
||||
#define TSOB_FELD(typ,anz) (typ *) calloc(1, (anz)*sizeof(typ));
|
||||
|
||||
|
||||
/* Diet facility: exclude help texts from binaries */
|
||||
@ -2040,6 +2040,41 @@ overflow:;
|
||||
}
|
||||
|
||||
|
||||
int Hex_to_bin(char *hex,
|
||||
int bin_size, int *bin_count, unsigned char *bin_data, int flag)
|
||||
{
|
||||
int i, l, acc;
|
||||
|
||||
l= strlen(hex);
|
||||
if(l % 2 || l == 0)
|
||||
return(-1); /* malformed */
|
||||
*bin_count= 0;
|
||||
for(i= 0; i < l; i+= 2) {
|
||||
if(hex[i] >= '0' && hex[i] <= '9')
|
||||
acc= (hex[i] - '0') << 4;
|
||||
else if(hex[i] >= 'A' && hex[i] <= 'F')
|
||||
acc= (hex[i] - 'A' + 10) << 4;
|
||||
else if(hex[i] >= 'a' && hex[i] <= 'f')
|
||||
acc= (hex[i] - 'a' + 10) << 4;
|
||||
else
|
||||
return(-1);
|
||||
if(hex[i + 1] >= '0' && hex[i + 1] <= '9')
|
||||
acc|= (hex[i + 1] - '0');
|
||||
else if(hex[i + 1] >= 'A' && hex[i + 1] <= 'F')
|
||||
acc|= (hex[i + 1] - 'A' + 10);
|
||||
else if(hex[i + 1] >= 'a' && hex[i + 1] <= 'f')
|
||||
acc|= (hex[i + 1] - 'a' + 10);
|
||||
else
|
||||
return(-1);
|
||||
if(*bin_count >= bin_size)
|
||||
return(0); /* overflow */
|
||||
bin_data[*bin_count]= acc;
|
||||
(*bin_count)++;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
#ifndef Xorriso_fileliste_externaL
|
||||
|
||||
/* ??? ts A71006 : Is this compatible with mkisofs pathspecs ?
|
||||
@ -2892,6 +2927,8 @@ int Findjob_destroy(struct FindjoB **o, int flag)
|
||||
return(0);
|
||||
if(m->test_tree != NULL)
|
||||
Exprnode_destroy(&(m->test_tree), 0);
|
||||
if(m->start_path != NULL)
|
||||
free(m->start_path);
|
||||
free((char *) *o);
|
||||
*o= NULL;
|
||||
return(1);
|
||||
@ -4885,14 +4922,17 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->do_stream_recording= 0;
|
||||
m->dvd_obs= 0;
|
||||
m->stdio_sync= 0;
|
||||
m->boot_platform_id= 0x00; /* El Torito Boot Catalog Platform ID: 0 = 80x86 */
|
||||
m->keep_boot_image= 0;
|
||||
m->boot_image_cat_path[0]= 0;
|
||||
m->boot_count= 0;
|
||||
m->boot_platform_id= 0x00; /* El Torito Boot Catalog Platform ID: 0 = 80x86 */
|
||||
m->patch_isolinux_image= 0;
|
||||
m->boot_image_bin_path[0]= 0;
|
||||
m->boot_image_bin_form[0]= 0;
|
||||
m->boot_image_emul= 0;
|
||||
m->boot_image_cat_path[0]= 0;
|
||||
m->boot_image_load_size= 4 * 512; /* hearsay out of libisofs/demo/iso.c */
|
||||
memset(m->boot_id_string, 0, sizeof(m->boot_id_string));
|
||||
memset(m->boot_selection_crit, 0, sizeof(m->boot_selection_crit));
|
||||
|
||||
#ifdef Xorriso_with_isohybriD
|
||||
m->boot_image_isohybrid= 1;
|
||||
@ -4900,7 +4940,12 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->boot_image_isohybrid= 0;
|
||||
#endif
|
||||
|
||||
m->boot_efi_default= 0;
|
||||
|
||||
#ifndef Xorriso_multi_booT
|
||||
m->boot_image_efi_path[0]= 0;
|
||||
#endif
|
||||
|
||||
m->system_area_disk_path[0]= 0;
|
||||
m->system_area_options= 0;
|
||||
m->patch_system_area= 0;
|
||||
@ -6745,10 +6790,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
-options_from_file:${resume_state_file}_pos
|
||||
*/
|
||||
{
|
||||
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0, do_single;
|
||||
int show_indev= 1, show_outdev= 1, show_dev= 0, patch_is_implicit= 0;
|
||||
int part_table_implicit= 0, efi_path_in_use= 0;
|
||||
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment, *bin_form;
|
||||
int is_default, no_defaults, i, ret, adr_mode, do_single;
|
||||
int show_indev= 1, show_outdev= 1, show_dev= 0;
|
||||
int part_table_implicit= 0;
|
||||
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
|
||||
char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt;
|
||||
char *dev_filter= NULL;
|
||||
static char channel_prefixes[4][4]= {".","R","I","M"};
|
||||
@ -6756,6 +6801,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
static int max_load_mode= 4;
|
||||
struct Xorriso_lsT *paths, *leafs, *s;
|
||||
|
||||
#ifndef Xorriso_multi_booT
|
||||
char *bin_form;
|
||||
int patch_is_implicit= 0, efi_path_in_use= 0, bin_path_in_use= 0;
|
||||
#endif
|
||||
|
||||
no_defaults= flag&1;
|
||||
line= xorriso->result_line;
|
||||
|
||||
@ -6932,6 +6982,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
#ifdef Xorriso_multi_booT
|
||||
|
||||
Xorriso_boot_image_status(xorriso, filter, fp, flag & 3);
|
||||
|
||||
#else /* Xorriso_multi_booT */
|
||||
|
||||
is_default= (xorriso->keep_boot_image == 0
|
||||
&& xorriso->patch_isolinux_image == 0
|
||||
&& xorriso->boot_image_bin_path[0] == 0);
|
||||
@ -6970,12 +7026,14 @@ bin_path:;
|
||||
treatment= sfe;
|
||||
bin_path_in_use= 1;
|
||||
}
|
||||
|
||||
} else if(xorriso->boot_image_efi_path[0]) {
|
||||
form= "grub";
|
||||
strcpy(sfe, "efi_path=");
|
||||
Text_shellsafe(xorriso->boot_image_efi_path, sfe + strlen(sfe), 0);
|
||||
treatment= sfe;
|
||||
efi_path_in_use= 1;
|
||||
|
||||
} else if(xorriso->patch_isolinux_image) {
|
||||
treatment= "patch";
|
||||
if(xorriso->patch_system_area & 1)
|
||||
@ -7010,6 +7068,7 @@ bin_path:;
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
}
|
||||
|
||||
if(xorriso->boot_image_efi_path[0] && xorriso->boot_image_bin_path[0]) {
|
||||
strcpy(line,"-boot_image grub efi_path=");
|
||||
Text_shellsafe(xorriso->boot_image_efi_path, line + strlen(line), 0);
|
||||
@ -7017,6 +7076,7 @@ bin_path:;
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
efi_path_in_use= 1;
|
||||
}
|
||||
|
||||
if(xorriso->boot_image_cat_path[0] && (bin_path_in_use || efi_path_in_use)) {
|
||||
is_default= 0;
|
||||
sprintf(line,"-boot_image %s cat_path=%s\n",
|
||||
@ -7024,6 +7084,9 @@ bin_path:;
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
}
|
||||
|
||||
#endif /* Xorriso_multi_booT */
|
||||
|
||||
is_default= (xorriso->system_area_disk_path[0] == 0);
|
||||
sprintf(line,"-boot_image %s system_area=%s\n",
|
||||
xorriso->system_area_disk_path[0] && (xorriso->system_area_options & 2)
|
||||
@ -11176,6 +11239,28 @@ no_volunteer:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_genisofs_add_boot(struct XorrisO *xorriso, char *whom,
|
||||
int *option_b, int *no_emul_boot, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(*option_b && !*no_emul_boot) {
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
sprintf(xorriso->info_text,
|
||||
"-as %s: Option -b is supported only if option -no-emul-boot is given",
|
||||
whom);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
ret= Xorriso_attach_boot_image(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
*option_b= 0;
|
||||
*no_emul_boot= 1;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
static char helptext[][160]= {
|
||||
@ -11262,6 +11347,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
int do_print_size= 0, fd, idx, iso_level= 0, no_emul_boot= 0;
|
||||
int option_b= 0, was_failure= 0, fret, lower_r= 0, zero= 0;
|
||||
int *weight_list= NULL, weight_count= 0;
|
||||
int *boot_opt_list= NULL, boot_opt_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;
|
||||
char *boot_path;
|
||||
@ -11275,6 +11361,11 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
||||
return(-1);
|
||||
}
|
||||
boot_opt_list= TSOB_FELD(int, argc + 1);
|
||||
if(boot_opt_list == NULL) {
|
||||
Xorriso_no_malloc_memory(xorriso, (char **) &weight_list, 0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
adr[0]= indev[0]= msc[0]= 0;
|
||||
for(i= 0; i<argc; i++) {
|
||||
@ -11344,6 +11435,9 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
((off_t) 4) * ((off_t) 1024*1024*1024) - ((off_t) 1);
|
||||
else
|
||||
xorriso->file_size_limit= 0;
|
||||
|
||||
#ifndef Xorriso_multi_booT
|
||||
|
||||
} else if(strcmp(argv[i], "-no-emul-boot")==0) {
|
||||
no_emul_boot= 1;
|
||||
} else if(strcmp(argv[i], "-boot-info-table")==0) {
|
||||
@ -11360,11 +11454,13 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
Several boot images shall be kept in a list. One is the Default.
|
||||
They can have type BIOS or EFI.
|
||||
*/
|
||||
if(strcmp(argv[i - 1], "--efi-boot") == 0)
|
||||
if(strcmp(argv[i - 1], "--efi-boot") == 0) {
|
||||
boot_path= xorriso->boot_image_efi_path;
|
||||
else {
|
||||
xorriso->boot_efi_default= 1;
|
||||
} else {
|
||||
boot_path= xorriso->boot_image_bin_path;
|
||||
xorriso->boot_platform_id= 0x00;
|
||||
xorriso->boot_efi_default= 0;
|
||||
option_b= 1;
|
||||
}
|
||||
boot_path[0]= 0;
|
||||
@ -11398,6 +11494,9 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
|
||||
ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_1;
|
||||
|
||||
#endif /* ! Xorriso_multi_booT */
|
||||
|
||||
} else if(strcmp(argv[i], "-input-charset")==0) {
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
@ -11479,6 +11578,9 @@ problem_handler_1:;
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
#ifndef Xorriso_multi_booT
|
||||
|
||||
if(option_b && !no_emul_boot) {
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
sprintf(xorriso->info_text,
|
||||
@ -11487,6 +11589,9 @@ problem_handler_1:;
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
#endif /* ! Xorriso_multi_booT */
|
||||
|
||||
if(was_other_option && xorriso->out_drive_handle==NULL) {
|
||||
ret= Xorriso_option_dev(xorriso, "-", 2|4); /* set outdev to stdout */
|
||||
if(ret<=0)
|
||||
@ -11652,6 +11757,33 @@ not_enough_args:;
|
||||
} else if(strcmp(argv[i], "-iso-level")==0) {
|
||||
i++;
|
||||
/* was already handled in first argument scan */;
|
||||
|
||||
#ifdef Xorriso_multi_booT
|
||||
|
||||
} else if(strcmp(argv[i], "-no-emul-boot")==0 ||
|
||||
strcmp(argv[i], "-boot-info-table")==0 ||
|
||||
strncmp(argv[i], "isolinux_mbr=", 13)==0 ||
|
||||
strncmp(argv[i], "isolinux_mbr=", 13)==0 ||
|
||||
strcmp(argv[i], "-eltorito-alt-boot")==0 ||
|
||||
strcmp(argv[i], "--protective-msdos-label")==0) {
|
||||
boot_opt_list[boot_opt_count++]= i;
|
||||
} else if(strcmp(argv[i], "-b") == 0 ||
|
||||
strcmp(argv[i], "-eltorito-boot") == 0 ||
|
||||
strcmp(argv[i], "--efi-boot") == 0 ||
|
||||
strcmp(argv[i], "-c") == 0 ||
|
||||
strcmp(argv[i], "-eltorito-catalog") == 0 ||
|
||||
strcmp(argv[i], "-boot-load-size") == 0 ||
|
||||
strcmp(argv[i], "--embedded-boot")==0 ||
|
||||
strcmp(argv[i], "-generic-boot")==0 ||
|
||||
strcmp(argv[i], "-G") == 0 ||
|
||||
strcmp(argv[i], "-isohybrid-mbr")==0) {
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
boot_opt_list[boot_opt_count++]= i;
|
||||
i++;
|
||||
|
||||
#else /* Xorriso_multi_booT */
|
||||
|
||||
} else if(strcmp(argv[i], "-no-emul-boot")==0) {
|
||||
/* was already handled in first argument scan */;
|
||||
} else if(strcmp(argv[i], "-b") == 0 ||
|
||||
@ -11676,17 +11808,21 @@ not_enough_args:;
|
||||
goto ex;
|
||||
if(strcmp(argv[i - 1], "-isohybrid-mbr")==0)
|
||||
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 2;
|
||||
} else if(strcmp(argv[i], "--protective-msdos-label")==0) {
|
||||
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 1;
|
||||
} else if(strncmp(argv[i], "--modification-date=", 20)==0) {
|
||||
ret= Xorriso_option_volume_date(xorriso, "uuid", argv[i] + 20, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_1;
|
||||
} else if(strcmp(argv[i], "-boot-load-size") == 0) {
|
||||
i++;
|
||||
/* was already handled in first argument scan */;
|
||||
} else if(strcmp(argv[i], "-boot-info-table")==0) {
|
||||
;
|
||||
} else if(strcmp(argv[i], "--protective-msdos-label")==0) {
|
||||
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 1;
|
||||
|
||||
#endif /* ! Xorriso_multi_booT */
|
||||
|
||||
} else if(strncmp(argv[i], "--modification-date=", 20)==0) {
|
||||
ret= Xorriso_option_volume_date(xorriso, "uuid", argv[i] + 20, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_1;
|
||||
|
||||
} else if(strcmp(argv[i], "-input-charset")==0) {
|
||||
i++;
|
||||
/* was already handled in first argument scan */;
|
||||
@ -11778,10 +11914,118 @@ problem_handler_2:;
|
||||
sort_weight_args[0]= argv[i + 2];
|
||||
sort_weight_args[3]= argv[i + 1];
|
||||
ret= Xorriso_option_find(xorriso, 4, sort_weight_args, &zero, 2);
|
||||
if(ret<=0)
|
||||
if(ret > 0)
|
||||
continue;
|
||||
/* Problem handler */
|
||||
was_failure= 1;
|
||||
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
|
||||
if(fret>=0)
|
||||
continue;
|
||||
goto ex;
|
||||
}
|
||||
|
||||
#ifdef Xorriso_multi_booT
|
||||
|
||||
/* After all pathspecs are added: perform boot related options */
|
||||
for(j= 0; j < boot_opt_count; j++) {
|
||||
i= boot_opt_list[j];
|
||||
if(strcmp(argv[i], "-no-emul-boot")==0) {
|
||||
no_emul_boot= 1;
|
||||
} else if(strcmp(argv[i], "-boot-info-table")==0) {
|
||||
xorriso->patch_isolinux_image= 1;
|
||||
} else if(strcmp(argv[i], "-b") == 0 ||
|
||||
strcmp(argv[i], "-eltorito-boot") == 0 ||
|
||||
strcmp(argv[i], "--efi-boot") == 0) {
|
||||
i++;
|
||||
if(strcmp(argv[i - 1], "--efi-boot") == 0) {
|
||||
if(xorriso->boot_image_bin_path[0]) {
|
||||
ret= Xorriso_genisofs_add_boot(xorriso, whom,
|
||||
&option_b, &no_emul_boot, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
}
|
||||
boot_path= xorriso->boot_image_bin_path;
|
||||
xorriso->boot_efi_default= 1;
|
||||
} else {
|
||||
boot_path= xorriso->boot_image_bin_path;
|
||||
xorriso->boot_platform_id= 0x00;
|
||||
xorriso->boot_efi_default= 0;
|
||||
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;
|
||||
if(xorriso->boot_efi_default && xorriso->boot_image_bin_path[0]) {
|
||||
option_b= 0;
|
||||
ret= Xorriso_genisofs_add_boot(xorriso, whom,
|
||||
&option_b, &no_emul_boot, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
}
|
||||
xorriso->keep_boot_image= 0;
|
||||
} else if(strcmp(argv[i], "-c") == 0 ||
|
||||
strcmp(argv[i], "-eltorito-catalog") == 0) {
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
i++;
|
||||
xorriso->boot_image_cat_path[0]= 0;
|
||||
if(argv[i][0] != '/')
|
||||
strcat(xorriso->boot_image_cat_path, "/");
|
||||
ret= Sfile_str(xorriso->boot_image_cat_path
|
||||
+ strlen(xorriso->boot_image_cat_path), argv[i], 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
} else if(strcmp(argv[i], "-boot-load-size") == 0) {
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
i++;
|
||||
sscanf(argv[i], "%d", &ret);
|
||||
xorriso->boot_image_load_size= ret * 512;
|
||||
} else if(strncmp(argv[i], "isolinux_mbr=", 13)==0) {
|
||||
sprintf(sfe, "isohybrid=%s", argv[i] + 13);
|
||||
ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
} else if(strcmp(argv[i], "-eltorito-alt-boot")==0) {
|
||||
ret= Xorriso_genisofs_add_boot(xorriso, whom,
|
||||
&option_b, &no_emul_boot, 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
} else if(strcmp(argv[i], "--embedded-boot")==0 ||
|
||||
strcmp(argv[i], "-generic-boot")==0 ||
|
||||
strcmp(argv[i], "-G") == 0 ||
|
||||
strcmp(argv[i], "-isohybrid-mbr")==0) {
|
||||
if(i+1>=argc)
|
||||
goto not_enough_args;
|
||||
i++;
|
||||
ret= Xorriso_set_system_area_path(xorriso, argv[i], 0);
|
||||
if(ret <= 0)
|
||||
goto problem_handler_boot;
|
||||
if(strcmp(argv[i - 1], "-isohybrid-mbr")==0)
|
||||
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 2;
|
||||
} else if(strcmp(argv[i], "--protective-msdos-label")==0) {
|
||||
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 1;
|
||||
}
|
||||
continue; /* regular bottom of loop */
|
||||
problem_handler_boot:;
|
||||
/* Problem handler */
|
||||
was_failure= 1;
|
||||
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
|
||||
if(fret>=0)
|
||||
continue;
|
||||
goto ex;
|
||||
}
|
||||
if(xorriso->boot_image_bin_path[0]) {
|
||||
ret= Xorriso_genisofs_add_boot(xorriso, whom, &option_b, &no_emul_boot, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
|
||||
#endif /* Xorriso_multi_booT */
|
||||
|
||||
ret= !was_failure;
|
||||
ex:;
|
||||
if(was_path && !do_print_size)
|
||||
@ -11791,6 +12035,8 @@ ex:;
|
||||
Xorriso_option_rollback(xorriso, 0);
|
||||
if(weight_list != NULL)
|
||||
free(weight_list);
|
||||
if(boot_opt_list != NULL)
|
||||
free(boot_opt_list);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -13816,7 +14062,7 @@ unusable_size:;
|
||||
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
char *treatment, int flag)
|
||||
{
|
||||
int was_ok= 1, ret, isolinux_grub= 0;
|
||||
int was_ok= 1, ret, isolinux_grub= 0, count;
|
||||
unsigned int u;
|
||||
char *formpt, *treatpt;
|
||||
double num;
|
||||
@ -13831,12 +14077,21 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0)
|
||||
isolinux_grub= 1;
|
||||
if(strcmp(treatpt, "keep")==0) {
|
||||
if(xorriso->boot_count > 0) {
|
||||
cannot_keep_or_patch:;
|
||||
sprintf(xorriso->info_text,
|
||||
"Loaded boot image has already been replaced. Cannot keep or patch it.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
xorriso->keep_boot_image= 1;
|
||||
xorriso->patch_isolinux_image= !!isolinux_grub;
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
xorriso->patch_system_area= 0;
|
||||
|
||||
} else if(strcmp(treatpt, "patch")==0) {
|
||||
if(xorriso->boot_count > 0)
|
||||
goto cannot_keep_or_patch;
|
||||
xorriso->keep_boot_image= 0;
|
||||
xorriso->patch_isolinux_image= 1;
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
@ -13852,6 +14107,16 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
xorriso->patch_isolinux_image= 0;
|
||||
xorriso->boot_image_bin_path[0]= 0;
|
||||
xorriso->patch_system_area= 0;
|
||||
if(xorriso->boot_count > 0) {
|
||||
ret= Xorriso_attach_boot_image(xorriso, 2); /* dispose boot images */
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
} else if(strcmp(treatpt, "next") == 0) {
|
||||
ret= Xorriso_attach_boot_image(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
|
||||
} else if(strcmp(treatpt, "show_status")==0) {
|
||||
sprintf(xorriso->result_line, "------------------------------------\n");
|
||||
@ -13871,6 +14136,14 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
sprintf(xorriso->result_line, "------------------------------------\n");
|
||||
Xorriso_result(xorriso, 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);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
|
||||
} else if(strncmp(treatpt, "dir=", 4) == 0) {
|
||||
if(strcmp(formpt, "isolinux")==0) {
|
||||
/* ISOLINUX */
|
||||
@ -13916,6 +14189,7 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
|
||||
} else if(strcmp(treatpt, "bin_path=") == 0) {
|
||||
xorriso->boot_image_bin_path[0] = 0;
|
||||
xorriso->boot_efi_default= 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);
|
||||
@ -13929,15 +14203,31 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
strcpy(xorriso->boot_image_bin_form, formpt);
|
||||
} else
|
||||
strcpy(xorriso->boot_image_bin_form, "any");
|
||||
xorriso->boot_efi_default= 0;
|
||||
|
||||
#ifdef Xorriso_multi_booT
|
||||
|
||||
} else if(strcmp(treatpt, "efi_path=") == 0) {
|
||||
xorriso->boot_image_bin_path[0] = 0;
|
||||
xorriso->boot_efi_default= 0;
|
||||
} else if(strncmp(treatpt, "efi_path=", 9) == 0) {
|
||||
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
|
||||
xorriso->boot_image_bin_path, 2);
|
||||
|
||||
#else
|
||||
|
||||
} 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);
|
||||
|
||||
#endif /* ! Xorriso_multi_booT */
|
||||
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
xorriso->keep_boot_image= 0;
|
||||
xorriso->boot_efi_default= 1;
|
||||
|
||||
} else if(strncmp(treatpt, "boot_info_table=", 16)==0) {
|
||||
if(strcmp(treatpt + 16, "off") == 0)
|
||||
@ -13947,14 +14237,6 @@ 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);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
|
||||
} else if(strncmp(treatpt, "load_size=", 10) == 0) {
|
||||
num= Scanf_io_size(treatpt + 10, 0);
|
||||
if(num < 512 && isolinux_grub) {
|
||||
@ -13966,6 +14248,27 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
}
|
||||
xorriso->boot_image_load_size= num;
|
||||
|
||||
} else if(strncmp(treatpt, "id_string=", 10) == 0) {
|
||||
memset(xorriso->boot_id_string, 0, 29);
|
||||
if(strlen(treatpt + 10) == 56) {
|
||||
ret= Hex_to_bin(treatpt + 10, 28, &count, xorriso->boot_id_string, 0);
|
||||
} else
|
||||
ret= 0;
|
||||
if(ret <= 0)
|
||||
strncpy((char *) xorriso->boot_id_string, treatpt + 10, 28);
|
||||
|
||||
} else if(strncmp(treatpt, "sel_crit=", 9) == 0) {
|
||||
memset(xorriso->boot_selection_crit, 0, 21);
|
||||
count= 0;
|
||||
ret= Hex_to_bin(treatpt + 9, 20, &count, xorriso->boot_selection_crit, 0);
|
||||
if(ret <= 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-boot_image %s sel_crit= : Wrong form. Need even number of hex digits.",
|
||||
formpt);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
} else if(strncmp(treatpt, "system_area=", 12) == 0) {
|
||||
ret= Xorriso_set_system_area_path(xorriso, treatpt + 12, 0);
|
||||
if(ret <= 0)
|
||||
@ -14043,11 +14346,6 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
|
||||
} else
|
||||
was_ok= 0;
|
||||
|
||||
/* >>> BOOT : check whether directories and/or files exist:
|
||||
bin_path , dirname(cat_path),
|
||||
isolinux.cfg in / , /isolinux , or /boot/isolinux
|
||||
*/
|
||||
|
||||
if(!was_ok) {
|
||||
sprintf(xorriso->info_text, "Unrecognized options with -boot_image: %s %s",
|
||||
form, treatment);
|
||||
|
Reference in New Issue
Block a user