Removed development macro Xorriso_multi_booT by making it unconditional

This commit is contained in:
Thomas Schmitt 2010-05-05 19:43:55 +00:00
parent 4479f2fec6
commit 9bbcc3118c
4 changed files with 1 additions and 453 deletions

View File

@ -4941,11 +4941,6 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
#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;
@ -6801,11 +6796,6 @@ 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;
@ -6982,111 +6972,8 @@ 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);
bin_form= form= "any";
treatment= "discard";
if(xorriso->boot_image_bin_path[0]) {
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 &&
strcmp(xorriso->boot_image_cat_path, "/boot.cat") == 0)
strcpy(sfe, "dir=/");
else if(strcmp(xorriso->boot_image_bin_path, "/isolinux/isolinux.bin") == 0
&& strcmp(xorriso->boot_image_cat_path, "/isolinux/boot.cat") == 0)
strcpy(sfe, "dir=/isolinux");
else if(strcmp(xorriso->boot_image_bin_path,
"/boot/isolinux/isolinux.bin") == 0
&& strcmp(xorriso->boot_image_cat_path,
"/boot/isolinux/boot.cat") == 0)
strcpy(sfe, "dir=/boot/isolinux");
else
goto bin_path;
treatment= sfe;
} else if(strcmp(form, "grub") == 0) {
patch_is_implicit= 1;
/* >>> GRUB */
goto bin_path;
} else {
bin_path:;
strcpy(sfe, "bin_path=");
Text_shellsafe(xorriso->boot_image_bin_path, sfe + strlen(sfe), 0);
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 & 1) {
treatment= "patch";
if(xorriso->patch_system_area & 1)
form= "grub";
else if(xorriso->patch_system_area & 2)
form= "isolinux";
if(xorriso->patch_system_area)
part_table_implicit= 1;
} else if(xorriso->keep_boot_image) {
treatment= "keep";
}
sprintf(line,"-boot_image %s %s\n", form, treatment);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
if((xorriso->patch_isolinux_image & 1) && xorriso->boot_image_bin_path[0] &&
!patch_is_implicit) {
sprintf(line,"-boot_image any boot_info_table=on\n");
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",
bin_form, (double) xorriso->boot_image_load_size);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
if(bin_path_in_use) {
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);
}
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);
strcat(line, "\n");
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",
bin_form, Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
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)
@ -11438,67 +11325,6 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
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) {
xorriso->patch_isolinux_image= 1;
} else if(strcmp(argv[i], "-b") == 0 ||
strcmp(argv[i], "-eltorito-boot") == 0 ||
strcmp(argv[i], "--efi-boot") == 0) {
if(i+1>=argc)
goto not_enough_args;
i++;
/* >>> 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(strcmp(argv[i - 1], "--efi-boot") == 0) {
boot_path= xorriso->boot_image_efi_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;
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_1;
#endif /* ! Xorriso_multi_booT */
} else if(strcmp(argv[i], "-input-charset")==0) {
if(i+1>=argc)
goto not_enough_args;
@ -11581,19 +11407,6 @@ problem_handler_1:;
goto ex;
}
#ifndef Xorriso_multi_booT
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);
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)
@ -11759,9 +11572,6 @@ 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 ||
@ -11783,43 +11593,6 @@ not_enough_args:;
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 ||
strcmp(argv[i], "-eltorito-boot") == 0 ||
strcmp(argv[i], "--efi-boot") == 0) {
i++;
} else if(strcmp(argv[i], "-c") == 0 ||
strcmp(argv[i], "-eltorito-catalog") == 0) {
i++;
/* was already handled in first argument scan */;
} else if(strncmp(argv[i], "isolinux_mbr=", 13)==0) {
/* was already handled in first argument scan */;
} 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 ex;
if(strcmp(argv[i - 1], "-isohybrid-mbr")==0)
xorriso->system_area_options= (xorriso->system_area_options & ~3) | 2;
} 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)
@ -11926,8 +11699,6 @@ problem_handler_2:;
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];
@ -12026,8 +11797,6 @@ problem_handler_boot:;
goto ex;
}
#endif /* Xorriso_multi_booT */
ret= !was_failure;
ex:;
if(was_path && !do_print_size)
@ -14211,25 +13980,12 @@ treatment_patch:;
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;

View File

@ -19,10 +19,6 @@
#define Xorriso_private_includeD yes
/* >>> transition to new boot image management */
#define Xorriso_multi_booT 1
/** The source code release timestamp */
#include "xorriso_timestamp.h"
#ifndef Xorriso_timestamP
@ -284,12 +280,6 @@ struct XorrisO { /* the global context of xorriso */
int boot_efi_default; /* 0= no effect ,
1= appy --efi-boot parameters when attaching to img */
#ifndef Xorriso_multi_booT
/* <<< BOOT replace by attaching previous boot image to IsoImage by
-boot_image any next */
char boot_image_efi_path[SfileadrL];
#endif /* ! Xorriso_multi_booT */
char system_area_disk_path[SfileadrL];
int system_area_options; /* bit0= "GRUB protective msdos label"
(a simple partition table)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.05.04.120115"
#define Xorriso_timestamP "2010.05.05.194248"

View File

@ -2283,20 +2283,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
IsoNode *root_node;
int profile_number;
char profile_name[80];
#ifdef Xorriso_multi_booT
IsoBoot *bootcat_node;
#else
char *cpt;
IsoNode *node;
ElToritoBootImage *bootimg;
ElToritoBootImage *efi_bootimg;
enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL;
int boot_image_emul, boot_platform_id;
off_t boot_image_load_size;
struct stat stbuf;
char *boot_image_bin_path;
#endif /* ! Xorriso_multi_booT */
ret= Xorriso_finish_hl_update(xorriso, 0);
if(ret <= 0)
@ -2377,9 +2364,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
goto ex;
/* Activate, adjust or discard boot image */
#ifdef Xorriso_multi_booT
if(image!=NULL && !(flag&1)) {
is_bootable= iso_image_get_boot_image(image, NULL, NULL, &bootcat_node);
if(xorriso->boot_image_bin_path[0]) {
@ -2400,188 +2384,6 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
}
}
}
#else /* Xorriso_multi_booT */
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= 0;
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)) {
is_bootable= iso_image_get_boot_image(image, &bootimg, NULL, NULL);
if(boot_image_bin_path[0]) {
/* discard old boot image, set new one */
if(is_bootable == 1)
iso_image_remove_boot_image(image);
if(boot_image_emul == 1)
emul_type= ELTORITO_HARD_DISC_EMUL;
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, boot_image_bin_path);
cpt= strrchr(xorriso->boot_image_cat_path, '/');
if(cpt == NULL)
cpt= xorriso->boot_image_cat_path;
else
cpt++;
strcpy(cpt, "boot.cat");
}
sprintf(xorriso->info_text, "Activating boot image %s",
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, 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(boot_image_bin_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_cat_path,
&node, 1);
if(ret > 0) {
if(!xorriso->do_overwrite) {
sprintf(xorriso->info_text,
"May not overwite existing -boot_image ... cat_path=%s",
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
ret= Xorriso_rmi(xorriso, NULL, (off_t) 0, xorriso->boot_image_cat_path,
8 | (xorriso->do_overwrite == 1));
if(ret != 1) {
sprintf(xorriso->info_text,
"Could not remove existing -boot_image cat_path=%s",
Text_shellsafe(xorriso->boot_image_cat_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
}
ret= iso_image_set_boot_image(image, boot_image_bin_path,
emul_type, xorriso->boot_image_cat_path,
&bootimg);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, "", ret,
"Error when attaching El-Torito boot image to ISO 9660 image",
0, "FAILURE", 1);
sprintf(xorriso->info_text,
"Could not attach El-Torito boot image to ISO 9660 image");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
#ifdef Xorriso_boot_dummY
/* <<< for testing only */
if(xorriso->boot_image_bin_path[0] == 0)
el_torito_set_id_string(bootimg,
(unsigned char *) "xorriso EFI 3456789012345678");
else
el_torito_set_id_string(bootimg,
(unsigned char *) "xorriso 80x86 BIOS 012345678");
#endif /* Xorriso_boot_dummY */
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, 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;
}
#ifdef Xorriso_boot_dummY
/* <<< for testing only */
el_torito_set_id_string(efi_bootimg,
(unsigned char *) "xorriso EFI 3456789012345678");
el_torito_set_selection_crit(efi_bootimg,
(unsigned char *) "@selection criteria@");
#endif /* Xorriso_boot_dummY */
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);
#ifdef Xorriso_boot_dummY
/* <<< for testing only */
ret= iso_image_add_boot_image(image, "/xxx",
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 2", 0, "FAILURE", 1);
goto ex;
}
el_torito_set_id_string(efi_bootimg,
(unsigned char *) "xorriso EFI 3456789012345678");
el_torito_set_selection_crit(efi_bootimg,
(unsigned char *) "@selection crit 2 @");
el_torito_set_boot_platform_id(efi_bootimg, (uint8_t) 0xef);
el_torito_set_load_size(efi_bootimg, boot_image_load_size);
ret= iso_image_add_boot_image(image, "/xxxx",
ELTORITO_NO_EMUL, 0, &efi_bootimg);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, "", ret,
"Error when adding BIOS boot image 2", 0, "FAILURE", 1);
goto ex;
}
el_torito_set_id_string(efi_bootimg,
(unsigned char *) "xorriso BIOS2 abcdefghijklmn");
el_torito_set_selection_crit(efi_bootimg,
(unsigned char *) "@selection crit 3 @");
el_torito_set_boot_platform_id(efi_bootimg, (uint8_t) 0);
el_torito_set_load_size(efi_bootimg, (uint8_t) 4);
#endif /* Xorriso_boot_dummY */
}
#endif /* ! Xorriso_multi_booT */
} else if(xorriso->patch_isolinux_image & 1) {
if(is_bootable == 1) {
relax|= isoburn_igopt_allow_full_ascii;