New -boot_image any platform_id=

This commit is contained in:
Thomas Schmitt 2010-04-20 09:18:35 +00:00
parent 3896605a58
commit 117b4b2048
4 changed files with 75 additions and 184 deletions

View File

@ -4885,6 +4885,7 @@ 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->patch_isolinux_image= 0;
m->boot_image_bin_path[0]= 0;
@ -6746,7 +6747,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
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;
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment, *bin_form;
char *in_pt, *out_pt, *nl_charset, *local_charset, *mode_pt;
char *dev_filter= NULL;
static char channel_prefixes[4][4]= {".","R","I","M"};
@ -6933,10 +6934,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
is_default= (xorriso->keep_boot_image == 0
&& xorriso->patch_isolinux_image == 0
&& xorriso->boot_image_bin_path[0] == 0);
form= "any";
bin_form= form= "any";
treatment= "discard";
if(xorriso->boot_image_bin_path[0]) {
form= xorriso->boot_image_bin_form;
if(xorriso->boot_image_bin_form[0])
bin_form= form= xorriso->boot_image_bin_form;
if(strcmp(form, "isolinux") == 0) {
patch_is_implicit= 1;
if(strcmp(xorriso->boot_image_bin_path, "/isolinux.bin") == 0 &&
@ -6990,16 +6992,14 @@ bin_path:;
if(xorriso->boot_image_cat_path[0] && bin_path_in_use) {
is_default= 0;
sprintf(line,"-boot_image %s cat_path=%s\n",
xorriso->boot_image_bin_form,
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
bin_form, Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
if(bin_path_in_use) {
is_default= xorriso->boot_image_load_size == 4 * 512;
sprintf(line,"-boot_image %s load_size=%.f\n",
xorriso->boot_image_bin_form,
(double) xorriso->boot_image_load_size);
bin_form, (double) xorriso->boot_image_load_size);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
@ -7018,6 +7018,11 @@ bin_path:;
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= (xorriso->boot_platform_id == 0x00);
sprintf(line,"-boot_image any platform_id=0x%-2.2x\n",
(unsigned int) xorriso->boot_platform_id);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
#ifdef Xorriso_with_isohybriD
if(strcmp(form, "isolinux") == 0) {
@ -11196,6 +11201,7 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag)
" -sysid ID Set System ID",
" -b FILE, -eltorito-boot FILE",
" Set El Torito boot image name",
" --efi-boot FILE Set El Torito EFI boot image name and type",
" -c FILE, -eltorito-catalog FILE",
" Set El Torito boot catalog name",
" -boot-load-size # Set numbers of load sectors",
@ -11242,6 +11248,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;
static char *lower_r_args[3]= {"/", "-exec", "mkisofs_r"};
static char *sort_weight_args[4]= {"", "-exec", "sort_weight", ""};
@ -11326,7 +11333,8 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
} 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], "-eltorito-boot") == 0 ||
strcmp(argv[i], "--efi-boot") == 0) {
if(i+1>=argc)
goto not_enough_args;
i++;
@ -11339,6 +11347,25 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
goto ex;
option_b= 1;
xorriso->keep_boot_image= 0;
/* >>> provisory: ts B00419
Only one boot image with parameters determined now.
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.
*/
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
xorriso->boot_platform_id= 0x00;
} else if(strcmp(argv[i], "-c") == 0 ||
strcmp(argv[i], "-eltorito-catalog") == 0) {
if(i+1>=argc)
@ -11619,9 +11646,25 @@ not_enough_args:;
} else if(strcmp(argv[i], "-no-emul-boot")==0) {
/* was already handled in first argument scan */;
} else if(strcmp(argv[i], "-b") == 0 ||
strcmp(argv[i], "-eltorito-boot") == 0) {
strcmp(argv[i], "-eltorito-boot") == 0 ||
strcmp(argv[i], "--efi-boot") == 0) {
i++;
/* was already handled in first argument scan */;
if(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;
}
} else if(strcmp(argv[i], "-c") == 0 ||
strcmp(argv[i], "-eltorito-catalog") == 0) {
i++;
@ -13775,13 +13818,13 @@ unusable_size:;
return(1);
}
#ifndef NIX
/* Option -boot_image */
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
char *treatment, int flag)
{
int was_ok= 1, ret, isolinux_grub= 0;
unsigned int u;
char *formpt, *treatpt;
double num;
@ -13938,6 +13981,20 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
} else
was_ok= 0;
} else if(strncmp(treatpt, "platform_id=", 12)==0) {
if(strncmp(treatpt + 12, "0x", 2) == 0)
sscanf(treatpt + 14, "%x", &u);
else
sscanf(treatpt + 12, "%u", &u);
if(u > 0xff) {
sprintf(xorriso->info_text,
"-boot_image %s : platform_id too large (%s > 0xff)",
formpt, treatpt + 12);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
xorriso->boot_platform_id= u;
} else if(strncmp(treatpt, "isohybrid=", 10) == 0 &&
strcmp(formpt, "isolinux")==0) {
@ -13970,6 +14027,9 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
sprintf(xorriso->info_text,
"isohybrid MBR generation has been disabled on request of its inventor H. Peter Anvin on 31 Mar 2010");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text,
"It has been replaced by -boot_image isolinux system_area=External-File");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
}
#endif /* ! Xorriso_with_isohybriD */
@ -13991,178 +14051,6 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
return(1);
}
#else /* ! NIX */
/* Option -boot_image */
int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
char *treatment, int flag)
{
int was_ok= 1, ret;
char *formpt, *treatpt;
double num;
formpt= form;
if(formpt[0]=='-')
formpt++;
treatpt= treatment;
if(treatpt[0]=='-')
treatpt++;
if(strcmp(formpt, "any")==0) {
if(strcmp(treatpt, "keep")==0) {
xorriso->keep_boot_image= 1;
xorriso->patch_isolinux_image= 0;
xorriso->boot_image_bin_path[0]= 0;
} else if(strcmp(treatpt, "discard")==0) {
xorriso->keep_boot_image= 0;
xorriso->patch_isolinux_image= 0;
xorriso->boot_image_bin_path[0]= 0;
} else if(strcmp(treatpt, "show_status")==0) {
show_status:;
sprintf(xorriso->result_line, "------------------------------------\n");
Xorriso_result(xorriso, 0);
sprintf(xorriso->result_line, "Status of loaded boot image :\n");
Xorriso_result(xorriso, 0);
sprintf(xorriso->result_line, "------------------------------------\n");
Xorriso_result(xorriso, 0);
Xorriso_show_boot_info(xorriso, 0);
sprintf(xorriso->result_line, "------------------------------------\n");
Xorriso_result(xorriso, 0);
sprintf(xorriso->result_line, "Boot image settings for next commit:\n");
Xorriso_result(xorriso, 0);
sprintf(xorriso->result_line, "------------------------------------\n");
Xorriso_result(xorriso, 0);
Xorriso_status(xorriso, "-boot_image", NULL, 0);
sprintf(xorriso->result_line, "------------------------------------\n");
Xorriso_result(xorriso, 0);
} else
was_ok= 0;
} else if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0) {
if(strcmp(treatpt, "patch")==0 ||
strcmp(treatpt, "keep")==0) { /* no real "keep" with ISOLINUX / GRUB */
xorriso->keep_boot_image= 1;
xorriso->patch_isolinux_image= 1;
xorriso->boot_image_bin_path[0]= 0;
} else if(strcmp(treatpt, "discard")==0) {
xorriso->keep_boot_image= 0;
xorriso->patch_isolinux_image= 0;
xorriso->boot_image_bin_path[0]= 0;
} else if(strcmp(treatpt, "show_status")==0) {
goto show_status;
} else if(strncmp(treatpt, "dir=", 4) == 0) {
/* >>> GRUB */
/* ISOLINUX */
/* The three locations mentioned in http://syslinux.zytor.com/iso.php */
if(strcmp(treatpt + 4, "/") == 0)
strcpy(xorriso->boot_image_bin_path, "/");
else if(strcmp(treatpt + 4, "isolinux") == 0
|| strcmp(treatpt + 4, "/isolinux") == 0)
strcpy(xorriso->boot_image_bin_path, "/isolinux/");
else if(strcmp(treatpt + 4, "boot/isolinux") == 0
|| strcmp(treatpt + 4, "/boot/isolinux") == 0
|| strcmp(treatpt + 4, "boot") == 0
|| strcmp(treatpt + 4, "/boot") == 0)
strcpy(xorriso->boot_image_bin_path, "/boot/isolinux/");
else {
sprintf(xorriso->info_text,
"Unrecognized keyword with -boot_image %s %s",
form, treatment);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text,
"Allowed with dir= are / , /isolinux . /boot/isolinux");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
}
strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path);
strcat(xorriso->boot_image_bin_path, "isolinux.bin");
strcat(xorriso->boot_image_cat_path, "boot.cat");
xorriso->boot_image_load_size= 4 * 512;
xorriso->keep_boot_image= 0;
xorriso->patch_isolinux_image= 1;
} else if(strncmp(treatpt, "bin_path=", 9) == 0) {
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
xorriso->boot_image_bin_path, 2);
if(ret <= 0)
return(ret);
xorriso->keep_boot_image= 0;
xorriso->patch_isolinux_image= 1;
if(xorriso->boot_image_bin_path[0])
xorriso->boot_image_load_size= 4 * 512;
} 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) {
sprintf(xorriso->info_text,
"-boot_image %s : load_size too small (%s < 512)",
formpt, treatpt + 10);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
xorriso->boot_image_load_size= num;
} else if(strncmp(treatpt, "isohybrid=", 10) == 0) {
/* >>> ISOLINUX ONLY */
#ifdef Xorriso_with_isohybriD
if(strcmp(treatpt + 10, "off") == 0)
xorriso->boot_image_isohybrid= 0;
else if(strcmp(treatpt + 10, "auto") == 0)
xorriso->boot_image_isohybrid= 1;
else if(strcmp(treatpt + 10, "on") == 0)
xorriso->boot_image_isohybrid= 2;
else if(strcmp(treatpt + 10, "force") == 0)
xorriso->boot_image_isohybrid= 3;
else {
sprintf(xorriso->info_text,
"Unrecognized keyword with -boot_image %s %s",
form, treatment);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
sprintf(xorriso->info_text,
"Allowed with isohybrid= are: off , auto , on , force");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
}
#else
if(strcmp(treatpt + 10, "off") == 0) {
xorriso->boot_image_isohybrid= 0;
} else {
sprintf(xorriso->info_text,
"isohybrid MBR generation has been disabled on request of its inventor H. Peter Anvin on 31 Mar 2010");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
#endif /* ! Xorriso_with_isohybriD */
} else
was_ok= 0;
} 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);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
return(1);
}
#endif /* NIX */
/* Option -calm_drive */
int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)

View File

@ -258,6 +258,7 @@ struct XorrisO { /* the global context of xorriso */
int dvd_obs; /* DVD write chunk size: 0, 32k or 64k */
int stdio_sync; /* stdio fsync interval: -1, 0, >=32 */
int boot_platform_id;
int keep_boot_image;
int patch_isolinux_image;
char boot_image_bin_path[SfileadrL];

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.04.19.095104"
#define Xorriso_timestamP "2010.04.20.091732"

View File

@ -1982,6 +1982,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
iso_image_set_boot_platform_id(image,
(uint8_t) xorriso->boot_platform_id);
el_torito_set_load_size(bootimg, xorriso->boot_image_load_size / 512);
ret= Xorriso_set_isolinux_options(xorriso, image, 0);
if(ret <= 0)