diff --git a/xorriso/xorriso.1 b/xorriso/xorriso.1 index 90926c1c..5547962c 100644 --- a/xorriso/xorriso.1 +++ b/xorriso/xorriso.1 @@ -9,7 +9,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH XORRISO 1 "Mar 18, 2010" +.TH XORRISO 1 "Apr 06, 2010" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -62,7 +62,7 @@ Updates ISO subtrees incrementally to match given disk subtrees. Writes result either as completely new image or as add-on session to optical media or filesystem objects. .br -Can activate ISOLINUX boot images via El Torito. +Can activate ISOLINUX and GRUB boot images via El Torito. .br Can perform multi-session tasks as emulation of mkisofs and cdrecord. .br @@ -373,10 +373,15 @@ other files stored in the ISO image, with the bootstrapping facility of contemporary computers. The content of the boot image files is not in the scope of El Torito. .br -Most bootable GNU/Linux CDs are equipped with ISOLINUX boot images. xorriso is -able to create or maintain an El Torito object which makes such an image -bootable. For details see option -boot_image. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images. +xorriso is able to create or maintain an El Torito object which makes such +an image bootable. For details see option -boot_image. +.br +It is possible to make ISO images bootable from USB stick or other +hard-disk-like media by -boot_image argument system_area= . +.br Emulation -as mkisofs supports the example options out of the ISOLINUX wiki. +It also supports the options used in GRUB script grub-mkrescue. .br The support for other boot image types is sparse. .br @@ -596,7 +601,7 @@ by aquiring an input drive. In rare cases it is desirable to activate them only after image loading. .TP \fB\-load\fR entity id -Load a particular (possibly outdated) ISO image from -dev or -indev. +Load a particular (possibly outdated) ISO session from -dev or -indev. Usually all available sessions are shown with option -toc. .br entity depicts the kind of addressing. id depicts the particular @@ -2094,30 +2099,39 @@ whole bootable system has to reside already in the first session and that the last session still has to bear all files which the booted system expects after eventually mounting the ISO image. .br -If ISOLINUX is known to be present on media then it is advised to patch it +If a boot image from ISOLINUX or GRUB is known to be present on media then +it is advised to patch it when a follow-up session gets written. But one should not rely on the capability to influence the bootability of the existing sessions, unless one can assume overwriteable media. .TP -\fB\-boot_image\fR "any"|"isolinux" +\fB\-boot_image\fR "any"|"isolinux"|"grub" .br "discard"|"keep"|"patch"|"show_status"|bootspec .br -Define the handling of an eventual El Torito object which has +Define the handling of an eventual El Torito boot image object which has been read from an existing ISO image or define how to make a prepared -ISOLINUX file set bootable. +boot image file set bootable. Such file sets get produced by ISOLINUX or GRUB. +.br +Each -boot_image command has two arguments: type and setting. More than one +-boot_image command may be used to define the handling. Sequence matters. +.br +Types "isolinux" and "grub" care for known peculiarities. Type "any" makes +no assumptions about the origin of the boot image. .br -All types ("any") of El Torito boot images can be discarded or kept unaltered. -The latter makes only sense if the format of the boot image is +El Torito boot images of any type can be newly inserted, or discarded, +or patched, or kept unaltered. +The latter is only safe if the format of the boot image is relocatable without content changes. .br -With any type, "show_status" will print what is known about the loaded image -and its designated fate. +Some boot images contain a boot info table, which needs to be patched when +the boot image gets newly introduced into the ISO image or if an existing +image gets relocated. This is automatically done if type "isolinux" or "grub" +is given, but not with "any". .br -An existing boot image of type "isolinux" can be discarded or it can be -patched to match its relocation. In the latter case the resulting ISO image -stays bootable if the boot image was really produced by ISOLINUX. +"show_status" will print what is known about the loaded image +and its designated fate. .br CAUTION: This is an expert option. @@ -2129,16 +2143,17 @@ Most safe is the default: -boot_image "any" "discard". .br A bootspec is a word of the form name=value and is used to describe the -activation of a ISOLINUX boot image by an El Torito record. -The names "dir" and "bin_path" lead to boot image activation. +activation of a boot image by an El Torito record and eventually a MBR. +The names "dir" and "bin_path" lead to El Torito boot image activation. +Name "system_area" activates the given file as MBR. .br On all media types this is possible within the first session. In further sessions an existing boot image can get replaced by a new one, but depending on the media type this may have few effect at boot time. See above. .br -The ISOLINUX files have to be added to the ISO image by normal means -(image loading, -map, -add, ...) and should reside either in ISO image -directory /isolinux or in /boot/isolinux . +The boot image and its supporting files have to be added to the ISO image by +normal means (image loading, -map, -add, ...). In case of ISOLINUX the files +should reside either in ISO image directory /isolinux or in /boot/isolinux . In that case it suffices to use as bootspec the text "dir=/isolinux" or "dir=/boot/isolinux". E.g.: .br @@ -2152,14 +2167,41 @@ which bundles these individual settings: .br -boot_image isolinux load_size=2048 .br -bin_path depicts the binary program which is to be started by the BIOS at -boot time. It is among the files produced by ISOLINUX. + -boot_image any boot_info_table=on +.br +"bin_path=" depicts the binary program which is to be started by the BIOS at +boot time. .br An El Torito boot catalog file gets inserted into the ISO image with address -cat_path at -commit time. +"cat_path=" at -commit time. It is subject to normal -overwrite and -reassure processing if there is already a file with the same name. .br +"load_size=" is a value which depends on the boot image. Default 2048 should +be overridden only if a better value is known. +.br +"boot_info_table=on" may be used to apply patching to a boot image which +is given by "any" "bin_path=". "boot_info_table=off" disables patching. +.br +"discard" gives up an existing boot image. +.br +"keep" keeps or copies an existing boot image unaltered. +.br +"patch" applies boot info table patching if an existing boot image gets copied +to a new location. +.br +"system_area="disk_path copies at most 32768 bytes from the given disk file to +the very start of the ISO image. +This System Area is reserved for system dependent boot software, e.g. an MBR +which can be used to boot from USB stick or hard disk. +.br +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. +.br +"partition_table=on" causes a simple partition table to be written into bytes +446 to 511 of the System Area. It shows a single partiton which starts at +byte 512 and ends where the ISO image ends. +.br .TP .B Character sets: .PP diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 5739113f..3cf2eed9 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -4834,6 +4834,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->keep_boot_image= 0; 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 */ @@ -4844,6 +4845,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->boot_image_isohybrid= 0; #endif + m->system_area_disk_path[0]= 0; + m->system_area_options= 0; m->loaded_boot_bin_lba= 0; m->loaded_boot_cat_path[0]= 0; m->allow_graft_points= 0; @@ -6681,7 +6684,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; + int show_indev= 1, show_outdev= 1, show_dev= 0, patch_is_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; @@ -6872,45 +6875,83 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) form= "any"; treatment= "discard"; if(xorriso->boot_image_bin_path[0]) { - form= "isolinux"; - 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 { + 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; } - treatment= sfe; - } else if(xorriso->patch_isolinux_image) { - form= "isolinux"; - treatment= "patch"; - } 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->boot_image_bin_path[0] && bin_path_in_use) { + if(!patch_is_implicit) { + form= "any"; + if(xorriso->patch_isolinux_image) { + if(xorriso->boot_image_bin_path[0]) { + form= xorriso->boot_image_bin_form; + treatment= "boot_info_table=on"; + } else + treatment= "patch"; + } else if(xorriso->boot_image_bin_path[0] == 0 && xorriso->keep_boot_image){ + treatment= "keep"; + } else + treatment= ""; + sprintf(line,"-boot_image %s %s\n", form, treatment); + if(treatment[0] && !(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + } + if(xorriso->boot_image_cat_path[0] && bin_path_in_use) { is_default= 0; - sprintf(line,"-boot_image isolinux cat_path=%s\n", + sprintf(line,"-boot_image %s cat_path=%s\n", + xorriso->boot_image_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 isolinux load_size=%.f\n", + sprintf(line,"-boot_image %s load_size=%.f\n", + xorriso->boot_image_bin_form, (double) xorriso->boot_image_load_size); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); } + is_default= (xorriso->system_area_disk_path[0] == 0); + sprintf(line,"-boot_image any system_area=%s\n", + Text_shellsafe(xorriso->system_area_disk_path, sfe, 0)); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); + is_default= ((xorriso->system_area_options & 1) == 0); + sprintf(line,"-boot_image grub partition_table=%s\n", + xorriso->system_area_options & 1 ? "on" : "off"); + if(!(is_default && no_defaults)) + Xorriso_status_result(xorriso,filter,fp,flag&2); #ifdef Xorriso_with_isohybriD if(strcmp(form, "isolinux") == 0) { @@ -11021,6 +11062,8 @@ int Xorriso_genisofs_help(struct XorrisO *xorriso, int flag) " -boot-load-size # Set numbers of load sectors", " -no-emul-boot Boot image is 'no emulation' image", " -boot-info-table Patch boot image with info table", +" -G FILE, -generic-boot FILE Set generic boot image name", +" --protective-msdos-label Patch System Area by partition table", #ifdef Xorriso_with_isohybriD " isolinux_mbr=on|auto|off Control eventual isohybrid MBR generation", #endif @@ -11144,7 +11187,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, goto ex; option_b= 1; xorriso->keep_boot_image= 0; - xorriso->patch_isolinux_image= 0; + xorriso->patch_isolinux_image= 1; } else if(strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "-eltorito-catalog") == 0) { if(i+1>=argc) @@ -11168,6 +11211,17 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0); if(ret <= 0) goto problem_handler_1; + } else if(strcmp(argv[i], "--embedded-boot")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Sfile_str(xorriso->system_area_disk_path, argv[i], 0); + if(ret <= 0) + {ret= -1; goto ex;} + + } else if(strcmp(argv[i], "--protective-msdos-label")==0) { + xorriso->system_area_options|= 1; + } else if(strcmp(argv[i], "-input-charset")==0) { if(i+1>=argc) goto not_enough_args; @@ -11432,6 +11486,11 @@ not_enough_args:; /* 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) { + i++; + /* was already handled in first argument scan */; + } else if(strcmp(argv[i], "--protective-msdos-label")==0) { + /* was already handled in first argument scan */; } else if(strcmp(argv[i], "-boot-load-size") == 0) { i++; /* was already handled in first argument scan */; @@ -13531,6 +13590,207 @@ 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; + char *formpt, *treatpt; + double num; + + formpt= form; + if(formpt[0]=='-') + formpt++; + treatpt= treatment; + if(treatpt[0]=='-') + treatpt++; + + if(strcmp(formpt, "isolinux")==0 || strcmp(formpt, "grub") == 0) + isolinux_grub= 1; + if(strcmp(treatpt, "keep")==0) { + xorriso->keep_boot_image= 1; + xorriso->patch_isolinux_image= !!isolinux_grub; + xorriso->boot_image_bin_path[0]= 0; + + } else if(strcmp(treatpt, "patch")==0) { + xorriso->keep_boot_image= 0; + 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) { + 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 if(strncmp(treatpt, "dir=", 4) == 0) { + if(strcmp(formpt, "isolinux")==0) { + /* 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; + strcpy(xorriso->boot_image_bin_form, formpt); + return(1); + + } else if(strcmp(formpt, "grub") == 0) { + + /* >>> GRUB */ + was_ok= 0; + + strcpy(xorriso->boot_image_bin_form, formpt); + + } else + was_ok= 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); + if(ret <= 0) + return(ret); + xorriso->keep_boot_image= 0; + if(isolinux_grub) { + xorriso->patch_isolinux_image= 1; + if(xorriso->boot_image_bin_path[0]) + xorriso->boot_image_load_size= 4 * 512; + strcpy(xorriso->boot_image_bin_form, formpt); + } else + strcpy(xorriso->boot_image_bin_form, "any"); + + } else if(strncmp(treatpt, "boot_info_table=", 16)==0) { + if(strcmp(treatpt + 16, "off") == 0) + xorriso->patch_isolinux_image= 0; + else if(strcmp(treatpt + 16, "on") == 0) + xorriso->patch_isolinux_image= 1; + else + was_ok= 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) { + 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, "system_area=", 12) == 0) { + ret= Sfile_str(xorriso->system_area_disk_path, treatpt + 12, 0); + if(ret <= 0) + return(-1); + + } else if(strncmp(treatpt, "partition_table=", 16)==0) { + if(strcmp(treatpt + 16, "off") == 0) + xorriso->system_area_options&= ~1; + else if(strcmp(treatpt + 16, "on") == 0) + xorriso->system_area_options|= 1; + else + was_ok= 0; + + } else if(strncmp(treatpt, "isohybrid=", 10) == 0 && + strcmp(formpt, "isolinux")==0) { + +#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; + + /* >>> 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); +} + +#else /* ! NIX */ /* Option -boot_image */ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form, @@ -13575,9 +13835,9 @@ show_status:; Xorriso_result(xorriso, 0); } else was_ok= 0; - } else if(strcmp(formpt, "isolinux")==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 */ + 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; @@ -13588,6 +13848,10 @@ show_status:; } 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, "/"); @@ -13614,14 +13878,14 @@ show_status:; strcat(xorriso->boot_image_cat_path, "boot.cat"); xorriso->boot_image_load_size= 4 * 512; xorriso->keep_boot_image= 0; - xorriso->patch_isolinux_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= 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) { @@ -13633,14 +13897,16 @@ show_status:; num= Scanf_io_size(treatpt + 10, 0); if(num < 512) { sprintf(xorriso->info_text, - "-boot_image isolinux : load_size too small (%s < 512)", - treatpt + 10); + "-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) @@ -13694,6 +13960,8 @@ show_status:; return(1); } +#endif /* NIX */ + /* Option -calm_drive */ int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag) @@ -16062,13 +16330,17 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -compliance rule[:rule...]", " Allow more or less harmless deviations from strict standards", " compliance.", -" -boot_image \"any\"|\"isolinux\" \"discard\"|\"keep\"|\"patch\"|\"dir=\"", -" \"bin_path=\"|\"cat_path=\"|\"load_size=\"", +" -boot_image \"any\"|\"isolinux\"|\"grub\"", +" \"discard\"|\"keep\"|\"patch\"|\"dir=\"|\"bin_path=\"|\"cat_path=\"", +" |\"load_size=\"|\"system_area=\"|\"partition_table=on|off\"", " Whether to discard or keep an exiting El Torito boot image.", " ISOLINUX can be made bootable by dir=/ or dir=/isolinux", -" or dir=/boot/isolinux or by bin_path=... and cat_path=...", -" The ISOLINUX files need to be added to the ISO image by", -" help of the usual commands like -map or -add.", +" or dir=/boot/isolinux. Others, like GRUB, by bin_path=...", +" and cat_path=...", +" The boot image and its helper files need to be added to the", +" ISO image by the usual commands like -map or -add.", +" system_area= and partition_table= are for MBR based booting", +" from USB stick. The system_area= file needs not to be added.", "", " -uid uid User id to be used for the whole multi-session ISO image.", " -gid gid Group id for the same purpose.", diff --git a/xorriso/xorriso.info b/xorriso/xorriso.info index f6c8cf9c..02fccd38 100644 --- a/xorriso/xorriso.info +++ b/xorriso/xorriso.info @@ -1,5 +1,5 @@ -This is xorriso.info, produced by makeinfo version 4.8 from -./xorriso.texi. +This is xorriso/xorriso.info, produced by makeinfo version 4.8 from +./xorriso/xorriso.texi. INFO-DIR-SECTION Archiving START-INFO-DIR-ENTRY @@ -68,7 +68,7 @@ Changes file properties in the ISO image. Updates ISO subtrees incrementally to match given disk subtrees. Writes result either as completely new image or as add-on session to optical media or filesystem objects. -Can activate ISOLINUX boot images via El Torito. +Can activate ISOLINUX and GRUB boot images via El Torito. Can perform multi-session tasks as emulation of mkisofs and cdrecord. Can record and restore hard links and ACL. Content may get zisofs compressed or filtered by external processes. @@ -333,10 +333,13 @@ and paths of up to 1024 characters. Rock Ridge fulfills this demand. program plus some other files stored in the ISO image, with the bootstrapping facility of contemporary computers. The content of the boot image files is not in the scope of El Torito. -Most bootable GNU/Linux CDs are equipped with ISOLINUX boot images. -xorriso is able to create or maintain an El Torito object which makes -such an image bootable. For details see option -boot_image. Emulation --as mkisofs supports the example options out of the ISOLINUX wiki. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot +images. xorriso is able to create or maintain an El Torito object +which makes such an image bootable. For details see option -boot_image. +It is possible to make ISO images bootable from USB stick or other +hard-disk-like media by -boot_image argument system_area= . +Emulation -as mkisofs supports the example options out of the ISOLINUX +wiki. It also supports the options used in GRUB script grub-mkrescue. The support for other boot image types is sparse. *ACL* are an advanced way of controlling access permissions to file @@ -569,7 +572,7 @@ image by aquiring an input drive. In rare cases it is desirable to activate them only after image loading. -load entity id - Load a particular (possibly outdated) ISO image from -dev or + Load a particular (possibly outdated) ISO session from -dev or -indev. Usually all available sessions are shown with option -toc. entity depicts the kind of addressing. id depicts the particular address. The following entities are defined: @@ -1889,26 +1892,35 @@ But with multi-session media CD-R[W], DVD-R[W], DVD+R, it implies that the whole bootable system has to reside already in the first session and that the last session still has to bear all files which the booted system expects after eventually mounting the ISO image. -If ISOLINUX is known to be present on media then it is advised to patch -it when a follow-up session gets written. But one should not rely on the -capability to influence the bootability of the existing sessions, -unless one can assume overwriteable media. +If a boot image from ISOLINUX or GRUB is known to be present on media +then it is advised to patch it when a follow-up session gets written. +But one should not rely on the capability to influence the bootability +of the existing sessions, unless one can assume overwriteable media. --boot_image "any"|"isolinux" +-boot_image "any"|"isolinux"|"grub" "discard"|"keep"|"patch"|"show_status"|bootspec - Define the handling of an eventual El Torito object which has been - read from an existing ISO image or define how to make a prepared - ISOLINUX file set bootable. - All types ("any") of El Torito boot images can be discarded or - kept unaltered. The latter makes only sense if the format of the - boot image is relocatable without content changes. - With any type, "show_status" will print what is known about the - loaded image and its designated fate. - An existing boot image of type "isolinux" can be discarded or it - can be patched to match its relocation. In the latter case the - resulting ISO image stays bootable if the boot image was really - produced by ISOLINUX. + Define the handling of an eventual El Torito boot image object + which has been read from an existing ISO image or define how to + make a prepared boot image file set bootable. Such file sets get + produced by ISOLINUX or GRUB. + Each -boot_image command has two arguments: type and setting. More + than one -boot_image command may be used to define the handling. + Sequence matters. + Types "isolinux" and "grub" care for known peculiarities. Type + "any" makes no assumptions about the origin of the boot image. + + El Torito boot images of any type can be newly inserted, or + discarded, or patched, or kept unaltered. The latter is only safe + if the format of the boot image is relocatable without content + changes. + Some boot images contain a boot info table, which needs to be + patched when the boot image gets newly introduced into the ISO + image or if an existing image gets relocated. This is + automatically done if type "isolinux" or "grub" is given, but not + with "any". + "show_status" will print what is known about the loaded image and + its designated fate. CAUTION: This is an expert option. xorriso cannot recognize the inner form of boot images. So the user has already to know about the particular needs of the boot image which is present on the @@ -1916,29 +1928,51 @@ unless one can assume overwriteable media. Most safe is the default: -boot_image "any" "discard". A bootspec is a word of the form name=value and is used to - describe the activation of a ISOLINUX boot image by an El Torito - record. The names "dir" and "bin_path" lead to boot image - activation. + describe the activation of a boot image by an El Torito record and + eventually a MBR. The names "dir" and "bin_path" lead to El + Torito boot image activation. Name "system_area" activates the + given file as MBR. On all media types this is possible within the first session. In further sessions an existing boot image can get replaced by a new one, but depending on the media type this may have few effect at boot time. See above. - The ISOLINUX files have to be added to the ISO image by normal - means (image loading, -map, -add, ...) and should reside either in - ISO image directory /isolinux or in /boot/isolinux . In that case - it suffices to use as bootspec the text "dir=/isolinux" or + The boot image and its supporting files have to be added to the + ISO image by normal means (image loading, -map, -add, ...). In + case of ISOLINUX the files should reside either in ISO image + directory /isolinux or in /boot/isolinux . In that case it + suffices to use as bootspec the text "dir=/isolinux" or "dir=/boot/isolinux". E.g.: -boot_image isolinux dir=/boot/isolinux which bundles these individual settings: -boot_image isolinux bin_path=/boot/isolinux/isolinux.bin -boot_image isolinux cat_path=/boot/isolinux/boot.cat -boot_image isolinux load_size=2048 - bin_path depicts the binary program which is to be started by the - BIOS at boot time. It is among the files produced by ISOLINUX. + -boot_image any boot_info_table=on + "bin_path=" depicts the binary program which is to be started by + the BIOS at boot time. An El Torito boot catalog file gets inserted into the ISO image - with address cat_path at -commit time. It is subject to normal + with address "cat_path=" at -commit time. It is subject to normal -overwrite and -reassure processing if there is already a file with the same name. + "load_size=" is a value which depends on the boot image. Default + 2048 should be overridden only if a better value is known. + "boot_info_table=on" may be used to apply patching to a boot image + which is given by "any" "bin_path=". "boot_info_table=off" + disables patching. + "discard" gives up an existing boot image. + "keep" keeps or copies an existing boot image unaltered. + "patch" applies boot info table patching if an existing boot image + gets copied to a new location. + "system_area="disk_path copies at most 32768 bytes from the given + disk file to the very start of the ISO image. This System Area is + reserved for system dependent boot software, e.g. an MBR which can + be used to boot from USB stick or hard disk. + Other than a El Torito boot image, the file disk_path needs not to + be added to the ISO image. + "partition_table=on" causes a simple partition table to be written + into bytes 446 to 511 of the System Area. It shows a single + partiton which starts at byte 512 and ends where the ISO image + ends.  File: xorriso.info, Node: Charset, Next: Exception, Prev: Bootable, Up: Options @@ -3683,7 +3717,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top [index] * Menu: -* ACL, _definiton: Extras. (line 29) +* ACL, _definiton: Extras. (line 32) * ACL, control handling, -acl: Loading. (line 128) * ACL, set in ISO image, -setfacl: Manip. (line 73) * ACL, set in ISO image, -setfacl_list: Manip. (line 100) @@ -3892,7 +3926,7 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top * Write, predict image size, -print_size: Inquiry. (line 69) * Write, set speed, -speed: SetWrite. (line 121) * Write, simulation, -dummy: SetWrite. (line 161) -* xattr, _definiton: Extras. (line 43) +* xattr, _definiton: Extras. (line 46) * xattr, control handling, -xattr: Loading. (line 136) * xattr, set in ISO image, -setfattr: Manip. (line 110) * xattr, set in ISO image, -setfattr_list: Manip. (line 126) @@ -3903,57 +3937,57 @@ File: xorriso.info, Node: ConceptIdx, Prev: CommandIdx, Up: Top  Tag Table: -Node: Top420 -Node: Overview1324 -Node: Model3192 -Node: Media6072 -Node: Methods8502 -Node: Drives11049 -Node: Extras14315 -Node: Processing17246 -Node: Dialog20742 -Node: Options22399 -Node: AqDrive23967 -Node: Loading26873 -Node: Insert39306 -Node: SetInsert47663 -Node: Manip56230 -Node: CmdFind64106 -Node: Filter72664 -Node: Writing77013 -Node: SetWrite83302 -Node: Bootable92179 -Node: Charset95615 -Node: Exception98369 -Node: DialogCtl102884 -Node: Inquiry105229 -Node: Navigate109369 -Node: Verify116723 -Node: Restore125143 -Node: Emulation131799 -Node: Scripting137825 -Node: Frontend143387 -Node: Examples144588 -Node: ExDevices145757 -Node: ExCreate146239 -Node: ExDialog147513 -Node: ExGrowing148775 -Node: ExModifying149577 -Node: ExBootable150078 -Node: ExCharset150625 -Node: ExPseudo151453 -Node: ExCdrecord152347 -Node: ExMkisofs152662 -Node: ExGrowisofs153665 -Node: ExException154789 -Node: ExTime155243 -Node: ExIncBackup155702 -Node: ExRestore159174 -Node: ExRecovery160143 -Node: Files160708 -Node: Seealso161295 -Node: Legal161819 -Node: CommandIdx162741 -Node: ConceptIdx175969 +Node: Top436 +Node: Overview1340 +Node: Model3217 +Node: Media6097 +Node: Methods8527 +Node: Drives11074 +Node: Extras14340 +Node: Processing17471 +Node: Dialog20967 +Node: Options22624 +Node: AqDrive24192 +Node: Loading27098 +Node: Insert39533 +Node: SetInsert47890 +Node: Manip56457 +Node: CmdFind64333 +Node: Filter72891 +Node: Writing77240 +Node: SetWrite83529 +Node: Bootable92406 +Node: Charset97533 +Node: Exception100287 +Node: DialogCtl104802 +Node: Inquiry107147 +Node: Navigate111287 +Node: Verify118641 +Node: Restore127061 +Node: Emulation133717 +Node: Scripting139743 +Node: Frontend145305 +Node: Examples146506 +Node: ExDevices147675 +Node: ExCreate148157 +Node: ExDialog149431 +Node: ExGrowing150693 +Node: ExModifying151495 +Node: ExBootable151996 +Node: ExCharset152543 +Node: ExPseudo153371 +Node: ExCdrecord154265 +Node: ExMkisofs154580 +Node: ExGrowisofs155583 +Node: ExException156707 +Node: ExTime157161 +Node: ExIncBackup157620 +Node: ExRestore161092 +Node: ExRecovery162061 +Node: Files162626 +Node: Seealso163213 +Node: Legal163737 +Node: CommandIdx164659 +Node: ConceptIdx177887  End Tag Table diff --git a/xorriso/xorriso.texi b/xorriso/xorriso.texi index cc868d28..03242580 100644 --- a/xorriso/xorriso.texi +++ b/xorriso/xorriso.texi @@ -26,7 +26,7 @@ @c "@item -word words" becomes "\fB\-word\fR words". @c "@item word words" becomes "\fBword\fR words". @c @strong{-...} gets mapped to \fB\-...\fR . -@c @strong{... } gets mapped to \fB...\fR . +@c @strong{...} gets mapped to \fB...\fR . @c @minus{} will become "-". @c @@ , @{, @} will get stripped of their first @. @c Other lines which begin by "@" will be discarded. @@ -44,7 +44,7 @@ @c man .\" First parameter, NAME, should be all caps @c man .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection @c man .\" other parameters are allowed: see man(7), man(1) -@c man .TH XORRISO 1 "Mar 18, 2010" +@c man .TH XORRISO 1 "Apr 06, 2010" @c man .\" Please adjust this date whenever revising the manpage. @c man .\" @c man .\" Some roff macros, for reference: @@ -144,7 +144,7 @@ Updates ISO subtrees incrementally to match given disk subtrees. Writes result either as completely new image or as add-on session to optical media or filesystem objects. @* -Can activate ISOLINUX boot images via El Torito. +Can activate ISOLINUX and GRUB boot images via El Torito. @* Can perform multi-session tasks as emulation of mkisofs and cdrecord. @* @@ -501,10 +501,15 @@ other files stored in the ISO image, with the bootstrapping facility of contemporary computers. The content of the boot image files is not in the scope of El Torito. @* -Most bootable GNU/Linux CDs are equipped with ISOLINUX boot images. xorriso is -able to create or maintain an El Torito object which makes such an image -bootable. For details see option -boot_image. +Most bootable GNU/Linux CDs are equipped with ISOLINUX or GRUB boot images. +xorriso is able to create or maintain an El Torito object which makes such +an image bootable. For details see option -boot_image. +@* +It is possible to make ISO images bootable from USB stick or other +hard-disk-like media by -boot_image argument system_area= . +@* Emulation -as mkisofs supports the example options out of the ISOLINUX wiki. +It also supports the options used in GRUB script grub-mkrescue. @* The support for other boot image types is sparse. @* @@ -801,7 +806,7 @@ them only after image loading. @item -load entity id @kindex -load addresses a particular session as input @cindex Session, select as input, -load -Load a particular (possibly outdated) ISO image from -dev or -indev. +Load a particular (possibly outdated) ISO session from -dev or -indev. Usually all available sessions are shown with option -toc. @* entity depicts the kind of addressing. id depicts the particular @@ -2544,36 +2549,46 @@ whole bootable system has to reside already in the first session and that the last session still has to bear all files which the booted system expects after eventually mounting the ISO image. @* -If ISOLINUX is known to be present on media then it is advised to patch it +If a boot image from ISOLINUX or GRUB is known to be present on media then +it is advised to patch it when a follow-up session gets written. But one should not rely on the capability to influence the bootability of the existing sessions, unless one can assume overwriteable media. @table @asis @sp 1 @c man .TP -@item -boot_image "any"|"isolinux" +@item -boot_image "any"|"isolinux"|"grub" @kindex -boot_image controls bootability @cindex Write, bootability, -boot_image @cindex Bootability, control, -boot_image @* "discard"|"keep"|"patch"|"show_status"|bootspec @* -Define the handling of an eventual El Torito object which has +@sp 1 +Define the handling of an eventual El Torito boot image object which has been read from an existing ISO image or define how to make a prepared -ISOLINUX file set bootable. +boot image file set bootable. Such file sets get produced by ISOLINUX or GRUB. +@* +Each -boot_image command has two arguments: type and setting. More than one +-boot_image command may be used to define the handling. Sequence matters. +@* +Types "isolinux" and "grub" care for known peculiarities. Type "any" makes +no assumptions about the origin of the boot image. @* @sp 1 -All types ("any") of El Torito boot images can be discarded or kept unaltered. -The latter makes only sense if the format of the boot image is +El Torito boot images of any type can be newly inserted, or discarded, +or patched, or kept unaltered. +The latter is only safe if the format of the boot image is relocatable without content changes. @* -With any type, "show_status" will print what is known about the loaded image -and its designated fate. +Some boot images contain a boot info table, which needs to be patched when +the boot image gets newly introduced into the ISO image or if an existing +image gets relocated. This is automatically done if type "isolinux" or "grub" +is given, but not with "any". @* -An existing boot image of type "isolinux" can be discarded or it can be -patched to match its relocation. In the latter case the resulting ISO image -stays bootable if the boot image was really produced by ISOLINUX. +"show_status" will print what is known about the loaded image +and its designated fate. @* CAUTION: This is an expert option. @@ -2586,17 +2601,17 @@ Most safe is the default: -boot_image "any" "discard". @sp 1 A bootspec is a word of the form name=value and is used to describe the -activation of a ISOLINUX boot image by an El Torito record. -@c and eventually a MBR. -The names "dir" and "bin_path" lead to boot image activation. +activation of a boot image by an El Torito record and eventually a MBR. +The names "dir" and "bin_path" lead to El Torito boot image activation. +Name "system_area" activates the given file as MBR. @* On all media types this is possible within the first session. In further sessions an existing boot image can get replaced by a new one, but depending on the media type this may have few effect at boot time. See above. @* -The ISOLINUX files have to be added to the ISO image by normal means -(image loading, -map, -add, ...) and should reside either in ISO image -directory /isolinux or in /boot/isolinux . +The boot image and its supporting files have to be added to the ISO image by +normal means (image loading, -map, -add, ...). In case of ISOLINUX the files +should reside either in ISO image directory /isolinux or in /boot/isolinux . In that case it suffices to use as bootspec the text "dir=/isolinux" or "dir=/boot/isolinux". E.g.: @* @@ -2610,14 +2625,41 @@ which bundles these individual settings: @* -boot_image isolinux load_size=2048 @* -bin_path depicts the binary program which is to be started by the BIOS at -boot time. It is among the files produced by ISOLINUX. + -boot_image any boot_info_table=on +@* +"bin_path=" depicts the binary program which is to be started by the BIOS at +boot time. @* An El Torito boot catalog file gets inserted into the ISO image with address -cat_path at -commit time. +"cat_path=" at -commit time. It is subject to normal -overwrite and -reassure processing if there is already a file with the same name. @* +"load_size=" is a value which depends on the boot image. Default 2048 should +be overridden only if a better value is known. +@* +"boot_info_table=on" may be used to apply patching to a boot image which +is given by "any" "bin_path=". "boot_info_table=off" disables patching. +@* +"discard" gives up an existing boot image. +@* +"keep" keeps or copies an existing boot image unaltered. +@* +"patch" applies boot info table patching if an existing boot image gets copied +to a new location. +@* +"system_area="disk_path copies at most 32768 bytes from the given disk file to +the very start of the ISO image. +This System Area is reserved for system dependent boot software, e.g. an MBR +which can be used to boot from USB stick or hard disk. +@* +Other than a El Torito boot image, the file disk_path needs not to be added +to the ISO image. +@* +"partition_table=on" causes a simple partition table to be written into bytes +446 to 511 of the System Area. It shows a single partiton which starts at +byte 512 and ends where the ISO image ends. +@* @c @c Bootspec "isohybrid=off" disables MBR generation, "isohybrid=on" @c prevents the write session if not the isohybrid signature is found diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 846d3c67..20d41299 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -261,6 +261,7 @@ struct XorrisO { /* the global context of xorriso */ int keep_boot_image; int patch_isolinux_image; char boot_image_bin_path[SfileadrL]; + char boot_image_bin_form[16]; int boot_image_emul; /* 0=no emulation (1=emulation as hard disk) (2=emulation as floppy) @@ -268,6 +269,10 @@ 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 system_area_disk_path[SfileadrL]; + int system_area_options; /* bit0= "GRUB protective msdos label" + (a simple partition table) + */ /* LBA of boot image after image loading */ int loaded_boot_bin_lba; @@ -711,6 +716,9 @@ int Xorriso_append_scdbackup_record(struct XorrisO *xorriso, int flag); int Xorriso_may_burn(struct XorrisO *xorriso, int flag); +int Xorriso_afile_fopen(struct XorrisO *xorriso, + char *filename, char *mode, FILE **ret_fp, int flag); + int Sfile_str(char target[SfileadrL], char *source, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 74043242..3c360ec9 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.04.06.125013" +#define Xorriso_timestamP "2010.04.06.151750" diff --git a/xorriso/xorrisoburn.c b/xorriso/xorrisoburn.c index 5fd310e3..2de6a3e2 100644 --- a/xorriso/xorrisoburn.c +++ b/xorriso/xorrisoburn.c @@ -1307,9 +1307,9 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) isoburn_ropt_get_size_what(ropts, &size, &has_what); if(has_what & isoburn_ropt_has_el_torito) { if(xorriso->boot_image_bin_path[0]) - boot_fate= "replaced by an isolinux image"; + boot_fate= "replaced by new boot image"; else if(xorriso->patch_isolinux_image) - boot_fate= "patched as isolinux image"; + boot_fate= "patched at boot info table"; else if(xorriso->keep_boot_image) boot_fate= "kept unchanged"; else @@ -1609,7 +1609,7 @@ int Xorriso_is_isohybrid(struct XorrisO *xorriso, IsoFile *bootimg_node, int Xorriso_set_isolinux_options(struct XorrisO *xorriso, IsoImage *image, int flag) { - int make_isohybrid_mbr= 0, ret; + int make_isohybrid_mbr= 0, ret, patch_table= 0; ElToritoBootImage *bootimg; IsoFile *bootimg_node; @@ -1619,9 +1619,9 @@ int Xorriso_set_isolinux_options(struct XorrisO *xorriso, Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); return(-1); } - + patch_table = (xorriso->patch_isolinux_image == 1); if(xorriso->boot_image_isohybrid == 0) { - ret= el_torito_set_isolinux_options(bootimg, 1, 0); + ret= el_torito_set_isolinux_options(bootimg, patch_table, 0); return(ret == 1); } if(xorriso->boot_image_isohybrid == 3) { @@ -1646,7 +1646,8 @@ int Xorriso_set_isolinux_options(struct XorrisO *xorriso, xorriso->alignment= 512; } - ret= el_torito_set_isolinux_options(bootimg, 1 | (make_isohybrid_mbr << 1),0); + ret= el_torito_set_isolinux_options(bootimg, + patch_table | (make_isohybrid_mbr << 1),0); return(ret == 1); } @@ -1689,7 +1690,46 @@ int Xorriso_auto_format(struct XorrisO *xorriso, int flag) } -#define Xorriso_with_make_isohybrid_mbR 1 +int Xorriso_set_system_area(struct XorrisO *xorriso, + struct isoburn_imgen_opts *sopts, int flag) +{ + int ret; + FILE *fp= NULL; + char buf[32768]; + + if(xorriso->system_area_disk_path[0] == 0) + return(1); + + ret= Xorriso_afile_fopen(xorriso, xorriso->system_area_disk_path, + "rb", &fp, 0); + if(ret <= 0) + {ret= 0; goto ex;} + memset(buf, 0, 32768); + ret= fread(buf, 1, 32768, fp); + if(ret < 32768) { + if(ferror(fp)) { + sprintf(xorriso->info_text, + "Error when reading -boot_image system_area="); + Text_shellsafe(xorriso->system_area_disk_path, xorriso->info_text, 1); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE", 0); + {ret= 0; goto ex;} + } + } + ret= isoburn_igopt_set_system_area(sopts, buf, xorriso->system_area_options); + if(ret != ISO_SUCCESS) { + Xorriso_process_msg_queues(xorriso,0); + Xorriso_report_iso_error(xorriso, "", ret, + "Error when attaching System Area data to ISO 9660 image", + 0, "FAILURE", 1); + {ret= 0; goto ex;} + } + ret= 1; +ex:; + if(fp != NULL && fp != stdin) + fclose(fp); + return(ret); +} + /* @param flag bit0= do not write but only prepare and return size in sectors @@ -1794,7 +1834,8 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) /* >>> ??? 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]) { /* discard old boot image, set new one */ if(ret == 1) @@ -1812,7 +1853,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) cpt++; strcpy(cpt, "boot.cat"); } - sprintf(xorriso->info_text, "Activating alleged isolinux boot image %s", + sprintf(xorriso->info_text, "Activating boot image %s", Text_shellsafe(xorriso->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", @@ -1863,21 +1904,13 @@ 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"); + sprintf(xorriso->info_text, "Patching boot info table"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); ret= Xorriso_path_from_lba(xorriso, NULL, xorriso->loaded_boot_bin_lba, @@ -1896,20 +1929,12 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0); goto ex; } - -#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"); + "Could not find any boot image for -boot_image patching"); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0); } } else if(xorriso->keep_boot_image && ret==1) { @@ -1922,7 +1947,10 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); } } - + ret= Xorriso_set_system_area(xorriso, sopts, 0); + if(ret <= 0) + goto ex; + if((xorriso->do_aaip & 16) || !(xorriso->ino_behavior & 2)) { /* Overwrite isofs.st of root node by xorriso->isofs_st_out */ char *name= "isofs.st"; @@ -5212,11 +5240,11 @@ int Xorriso_show_boot_info(struct XorrisO *xorriso, int flag) IsoFile *bootimg_node; IsoBoot *bootcat_node; - ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, - "on attempt to print boot info", 0); - if(ret<=0) - return(0); respt= xorriso->result_line; + ret= Xorriso_get_drive_handles(xorriso, &dinfo, &drive, + "on attempt to print boot info", 16); + if(ret<=0) + goto no_boot; image= isoburn_get_attached_image(drive); if(image == NULL) { ret= 0;