From ff9a7018d50a7255e817a019454378a3908f3e48 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 28 Sep 2008 11:33:47 +0000 Subject: [PATCH] Made -boot_image isolinux activation obey -overwrite setting --- .../trunk/xorriso/convert_man_to_html.sh | 1 + libisoburn/trunk/xorriso/xorriso.1 | 61 ++++++++++++++----- libisoburn/trunk/xorriso/xorriso.c | 14 +++-- libisoburn/trunk/xorriso/xorriso_eng.html | 7 +++ libisoburn/trunk/xorriso/xorriso_timestamp.h | 2 +- libisoburn/trunk/xorriso/xorrisoburn.c | 43 +++++++++++++ 6 files changed, 108 insertions(+), 20 deletions(-) diff --git a/libisoburn/trunk/xorriso/convert_man_to_html.sh b/libisoburn/trunk/xorriso/convert_man_to_html.sh index 0bdaaf10..a87749f9 100755 --- a/libisoburn/trunk/xorriso/convert_man_to_html.sh +++ b/libisoburn/trunk/xorriso/convert_man_to_html.sh @@ -66,6 +66,7 @@ then -e 's/^706k = 706kB/\ \ 706k = 706kB/' \ -e 's/^5540k = 5540kB/\ \ 5540k = 5540kB/' \ -e 's/Exception processing:<\/b>/\ 
Exception processing:<\/b>

/' \ + -e 's/El Torito bootable ISO images:<\/b>/\ 
El Torito bootable ISO images:<\/b>

/' \ -e 's/Dialog mode control:<\/b>/\ 
Dialog mode control:<\/b>

/' \ -e 's/Drive and media related inquiry actions:<\/b>/\ 
Drive and media related inquiry actions:<\/b>

/' \ -e 's/Navigation in ISO image/\ 
Navigation in ISO image/' \ diff --git a/libisoburn/trunk/xorriso/xorriso.1 b/libisoburn/trunk/xorriso/xorriso.1 index aad263e3..eb7fb968 100644 --- a/libisoburn/trunk/xorriso/xorriso.1 +++ b/libisoburn/trunk/xorriso/xorriso.1 @@ -53,6 +53,8 @@ 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. +.br Can perform multi-session tasks as emulation of mkisofs and cdrecord. .br Can restore files from ISO image to disk filesystem (see osirrox). @@ -1352,39 +1354,55 @@ xorriso adds the traditional 300k of padding by default to all images. .br For images which will never get to a CD it is safe to use -padding 0 . .TP +.B El Torito bootable ISO images: +.PP +An El Torito file object connects a boot image, which is a set of binaries +and other files 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 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. Emulation -as mkisofs supports the example options out of the +ISOLINUX wiki. +.br +The support for other boot image types is sparse. +.TP \fB\-boot_image\fR "any"|"isolinux" "discard"|"keep"|"patch"|bootspec -Defines the handling of an eventual boot image (El-Torito) which has +Defines the handling of an eventual El Torito object which has been read from an existing ISO image or defines how to make a prepared ISOLINUX file set bootable. .br -All types ("any") of El-Torito boot images can be discarded or kept unaltered. + +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. .br -An existing boot image of type "isolinux" can be -kept unaltered (not advisable), or be discarded, or it can be patched -to match its relocation. In the latter case the resulting ISO image is -bootable if the boot image was really produced by ISOLINUX. +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. .br 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 -bootimage which is present on the input media. +boot image which is present on the input media. .br Most safe is the default: "any" "discard". .br -Regardless whether an El-Torito boot image was detected or not, it is possible + +Regardless whether an El Torito boot image was detected or not, it is possible to activate a set of ISOLINUX files for booting. An existing boot image gets discarded, then. -The files have to be added to the ISO image by normal means (-map, -add, ...) -and should reside either in ISO image directory /isolinux or /boot/isolinux . +The 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 +/boot/isolinux . In that case it suffices to use as bootspec the text "dir=/isolinux" or "dir=/boot/isolinux". E.g.: .br -boot_image isolinux dir=/boot/isolinux .br -It is possible to make several individual settings. E.g. +It is possible to do this by several individual settings. E.g. .br -boot_image isolinux bin_path=/boot/isolinux/isolinux.bin .br @@ -1394,9 +1412,10 @@ It is possible to make several individual settings. E.g. .br But that should hardly be necessary. .br -CAUTION: xorriso only connects some ISOLINUX files to the El-Torito mechanism. -If the ISOLINUX setup was incorrect or if the given files are not by ISOLINUX -at all, then anything may happen when booting is attempted. +The El Torito object gets inserted into the ISO image at -commit time. +Its location is the effective cat_path= . +It is subject to normal -overwrite and -reassure processing if there is already +a file with the same name. .TP .B Exception processing: .PP @@ -1995,6 +2014,7 @@ Personality "\fBmkisofs\fR" accepts the options listed with: .br Among them: -R (always on), -J, -o, -M, -C, -path-list, -m, -exclude-list, -f, -print-size, -pad, -no-pad, -V, -v, -version, -graft-points, +-no-emul-boot, -b, -c, -boot-info-table, -boot-load-size, pathspecs as with xorriso -add. A lot of options are not supported and lead to failure of the mkisofs emulation. Some are ignored, but better do not rely on this tolerance. @@ -2232,6 +2252,8 @@ Manipulating an existing ISO image on the same media .br Copy modified ISO image from one media to another .br +Bring a prepared ISOLINUX tree onto media and make it bootable +.br Operate on storage facilities other than optical drives .br Perform multi-session runs as of cdrtools traditions @@ -2384,6 +2406,17 @@ first and only session to the output drive. .br -commit -eject all .SS +.B Bring a prepared ISOLINUX tree onto media and make it bootable +The user has already created a suitable file tree on disk and copied the +ISOLINUX files into subdirectory ./boot/isolinux of that tree. +Now xorriso can burn an El Torito bootable media: +.br +\fB$\fR xorriso -outdev /dev/sr0 -blank as_needed \\ +.br + -map /home/me/ISOLINUX_prepared_tree / \\ +.br + -boot_image isolinux dir=/boot/isolinux +.SS .B Operate on storage facilities other than optical drives Full read-write operation is possible with regular files and block devices: .br diff --git a/libisoburn/trunk/xorriso/xorriso.c b/libisoburn/trunk/xorriso/xorriso.c index c59310bb..da35d744 100644 --- a/libisoburn/trunk/xorriso/xorriso.c +++ b/libisoburn/trunk/xorriso/xorriso.c @@ -8949,6 +8949,8 @@ not_enough_args:; } else if(strcmp(argv[i], "-iso-level")==0) { i++; /* was already handled in first argument scan */; + } else if(strcmp(argv[i], "-no-emul-boot")==0) { + /* was already handled in first argument scan */; } else if(strcmp(argv[i], "-b") == 0) { i++; /* was already handled in first argument scan */; @@ -9673,7 +9675,7 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, if(ret<=0 || xorriso->request_to_abort) goto problem_handler; sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", - (ret>1 ? "directory" : "file"), target, source); + (ret>1 ? "directory" : "file"), (target[0] ? target : "/"), source); if(!(flag&1)) Xorriso_info(xorriso, 0); @@ -10664,7 +10666,8 @@ int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv, if(ret<=0 || xorriso->request_to_abort) goto problem_handler; sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", - (ret>1 ? "directory" : "file"), eff_dest, eff_origin); + (ret>1 ? "directory" : "file"), (eff_dest[0] ? eff_dest : "/"), + eff_origin); if(!(flag&1)) Xorriso_info(xorriso, 0); continue; /* regular bottom of loop */ @@ -11663,9 +11666,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " -boot_image \"any\"|\"isolinux\" \"discard\"|\"keep\"|\"patch\"|\"dir=\"", " \"bin_path=\"|\"cat_path=\"|\"load_size=\"", " Whether to discard or keep an exiting El-Torito boot image.", -" isolinux can be made bootable by dir=/ or dir=/isolinux", +" 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", +" The ISOLINUX files need to be added to the ISO image by", " help of the usual commands like -map or -add.", "", " -uid uid User id to be used for the whole multi-session ISO image.", @@ -12443,7 +12446,8 @@ int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path, if(!(flag&1)) { sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n", - (ret>1 ? "directory" : "file"), eff_dest, eff_origin); + (ret>1 ? "directory" : "file"), (eff_dest[0] ? eff_dest : "/"), + eff_origin); Xorriso_info(xorriso,0); } return(1); diff --git a/libisoburn/trunk/xorriso/xorriso_eng.html b/libisoburn/trunk/xorriso/xorriso_eng.html index 57c59939..7761ed7d 100644 --- a/libisoburn/trunk/xorriso/xorriso_eng.html +++ b/libisoburn/trunk/xorriso/xorriso_eng.html @@ -107,6 +107,13 @@ Updates ISO subtrees incrementally to match given disk subtrees. Writes result as completely new image or as add-on session to optical media or filesystem objects. + + +
  • Can perform multi-session tasks as emulation of mkisofs and cdrecord.
  • diff --git a/libisoburn/trunk/xorriso/xorriso_timestamp.h b/libisoburn/trunk/xorriso/xorriso_timestamp.h index 6d2c8bf5..6a1482a1 100644 --- a/libisoburn/trunk/xorriso/xorriso_timestamp.h +++ b/libisoburn/trunk/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.09.28.112850" +#define Xorriso_timestamP "2008.09.28.113256" diff --git a/libisoburn/trunk/xorriso/xorrisoburn.c b/libisoburn/trunk/xorriso/xorrisoburn.c index 183f3c27..2ac3f91f 100644 --- a/libisoburn/trunk/xorriso/xorrisoburn.c +++ b/libisoburn/trunk/xorriso/xorrisoburn.c @@ -81,6 +81,8 @@ int Xorriso_read_file_data(struct XorrisO *xorriso, IsoNode *node, off_t img_offset, off_t disk_offset, off_t bytes, int flag); +int Xorriso_node_from_path(struct XorrisO *xorriso, IsoImage *volume, + char *path, IsoNode **node, int flag); #define LIBISO_ISDIR(node) (iso_node_get_type(node) == LIBISO_DIR) #define LIBISO_ISREG(node) (iso_node_get_type(node) == LIBISO_FILE) @@ -437,6 +439,8 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) struct isoburn_read_opts *ropts= NULL; char adr_data[SfileadrL], *libburn_adr, *boot_fate, *sev; + static int no_rr_or_joliet= 0; + if((flag&3)==0) { sprintf(xorriso->info_text, "XORRISOBURN program error : Xorriso_aquire_drive bit0+bit1 not set"); @@ -593,6 +597,13 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); } } + + /* <<< */ + if(no_rr_or_joliet) { + isoburn_ropt_set_extensions(ropts, + isoburn_ropt_noiso1999 | isoburn_ropt_norock | isoburn_ropt_nojoliet); + } + ret= isoburn_read_image(drive, ropts, &volset); /* <<< Resetting to normal thresholds */ @@ -852,6 +863,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) struct burn_track **tracks; enum burn_disc_status s; IsoImage *image= NULL; + IsoNode *node; ElToritoBootImage *bootimg; enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL; @@ -938,6 +950,37 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) cpt++; strcpy(cpt, "boot.cat"); } + + ret= Xorriso_node_from_path(xorriso, image, xorriso->boot_image_bin_path, + &node, 1); + if(ret <= 0) { + sprintf(xorriso->info_text, + "Cannot find in ISO image: -boot_image ... bin_path=%s", + Text_shellsafe(xorriso->boot_image_bin_path, sfe, 0)); + 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, xorriso->boot_image_bin_path, emul_type, xorriso->boot_image_cat_path, &bootimg);