Provisory new -e pseudo path --interval:appened_partition_N:all::

This commit is contained in:
Thomas Schmitt 2015-12-30 18:04:16 +00:00
parent 2afe09e42a
commit 885ef25be3
4 changed files with 106 additions and 20 deletions

View File

@ -25,10 +25,19 @@ echo >&2
# export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2" # export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2"
# ./configure && make clean && make # ./configure && make clean && make
# #
# The mode "mbr_only" implements an alternative fully UEFI compliant layout # The mode "mbr_only" implements an alternative layout according to UEFI 2.4,
# which does not produce GTP, HFS+, and APM. # section 2.5.1 and table 16. No GTP, HFS+, or APM.
# It is supposed to work with any unmodified xorriso >= 1.3.2
# #
# The mode "mbr_hfs" is like "mbr_only" but with HFS+ mentioned in APM.
# It is still compliant to UEFI with no potentially deceiving GPT.
#
# These modes avoid duplicate storing of the EFI system partition "efi.img"
# by xorrisofs option -e "--interval:appended_partition_${partno}:all::"
# which is new to xorriso-1.4.3 with timestamp after 2015.12.30.175951.
# If "_copy" is appended to the mode name, then the file /efi.img will
# appear in the ISO 9660 filesystem and traditional -e "/efi.img" is used.
#
# "mbr_only_copy" is supposed to work with unmodified xorriso >= 1.3.2
# #
# Variation settings # Variation settings
@ -37,9 +46,11 @@ echo >&2
# default settings: # default settings:
# Manipulation mode: # Manipulation mode:
# "mjg" = ESP in MBR+GPT+APM, with HFS+ # "mjg" = ESP in MBR+GPT+APM, with HFS+
# "mbr_only" = ESP in MBR, without HFS+ # "mbr_only" = ESP in MBR, without HFS+
# "original" = pass arguments unchanged # "mbr_hfs" = ESP in MBR, HFS+ in APM
# $mode"_copy" = one of above modes, ESP in ISO and as appended partition
# "original" = pass arguments unchanged
mode="mjg" mode="mjg"
if test -n "$MKRESCUE_SED_MODE" if test -n "$MKRESCUE_SED_MODE"
then then
@ -101,6 +112,13 @@ fi
# Do the work # Do the work
# #
# grub-mkrescue inquires features by running these arguments
if test "$*" = "-as mkisofs -help"
then
"$xorriso" "$@"
exit $?
fi
echo "frontend/grub-mkrescue-sed.sh mode: $mode" >&2 echo "frontend/grub-mkrescue-sed.sh mode: $mode" >&2
echo >&2 echo >&2
@ -118,7 +136,7 @@ then
fi fi
# Look for the name of the /tmp directory with the GRUB2 files. # Look for the name of the /tmp directory with the GRUB2 files.
# It is the next argument after -r. # It is the next argument after -r. But as default accept any /tmp/grub.*
next_is_dir=0 next_is_dir=0
dir="." dir="."
for i in "$@" for i in "$@"
@ -129,7 +147,16 @@ do
elif test $next_is_dir = 1 elif test $next_is_dir = 1
then then
next_is_dir=0 next_is_dir=0
dir="$i" if echo "$i" | grep '^/tmp/grub.' >/dev/null 2>&1
then
test -d "$i" && dir="$i"
fi
elif test "$dir" = "."
then
if echo "$i" | grep '^/tmp/grub.' >/dev/null 2>&1
then
test -d "$i" && dir="$i"
fi
fi fi
done done
@ -139,7 +166,19 @@ then
find "$dir" find "$dir"
fi fi
efi_tmp_name=
if test x"$mode" = xmjg if test x"$mode" = xmjg
then
# Exchange arguments for the experimental GRUB2 mjg layout
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
mv "$dir"/efi.img /tmp/$efi_tmp_name
x=$(echo " $*" | sed \
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition $partno 0xef \/tmp\/$efi_tmp_name/" \
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_${partno}:all:: -no-emul-boot -isohybrid-gpt-basdat/" \
-e "s/--protective-msdos-label/$protective/" \
)
elif test x"$mode" = xmjg_copy
then then
# Exchange arguments for the experimental GRUB2 mjg layout # Exchange arguments for the experimental GRUB2 mjg layout
x=$(echo " $*" | sed \ x=$(echo " $*" | sed \
@ -149,6 +188,18 @@ then
) )
elif test x"$mode" = xmbr_only elif test x"$mode" = xmbr_only
then
# Exchange arguments for no-HFS MBR-only layout
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
mv "$dir"/efi.img /tmp/$efi_tmp_name
x=$(echo " $*" | sed \
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$efi_tmp_name/" \
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot/" \
-e "s/-hfsplus .*CoreServices\/boot.efi//" \
-e "s/--protective-msdos-label/$protective/" \
)
elif test x"$mode" = xmbr_only_copy
then then
# Exchange arguments for no-HFS MBR-only layout # Exchange arguments for no-HFS MBR-only layout
x=$(echo " $*" | sed \ x=$(echo " $*" | sed \
@ -157,6 +208,25 @@ then
-e "s/--protective-msdos-label/$protective/" \ -e "s/--protective-msdos-label/$protective/" \
) )
elif test x"$mode" = xmbr_hfs
then
# Exchange arguments for MBR and HFS+ layout
efi_tmp_name=grub-mkrescue-sed-efi-img.$$
mv "$dir"/efi.img /tmp/$efi_tmp_name
x=$(echo " $*" | sed \
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$efi_tmp_name/" \
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e --interval:appended_partition_2:all:: -no-emul-boot/" \
-e "s/--protective-msdos-label/$protective/" \
)
elif test x"$mode" = xmbr_only_copy
then
# Exchange arguments for MBR and HFS+ layout
x=$(echo " $*" | sed \
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition 2 0xef \/tmp\/$(basename "$dir")\/efi.img/" \
-e "s/--protective-msdos-label/$protective/" \
)
elif test x"$mode" = xoriginal elif test x"$mode" = xoriginal
then then
# Pass arguments unchanged # Pass arguments unchanged
@ -178,4 +248,13 @@ fi
# Run xorriso binary with the converted arguments # Run xorriso binary with the converted arguments
"$xorriso" $MKRESCUE_SED_XORRISO_ARGS $x "$xorriso" $MKRESCUE_SED_XORRISO_ARGS $x
ret=$?
# Move back the ESP if it was separated
if test -n "$efi_tmp_name" -a -e /tmp/$efi_tmp_name
then
mv /tmp/$efi_tmp_name "$dir"/efi.img
fi
exit $ret

View File

@ -2384,7 +2384,7 @@ problem_handler_2:;
xorriso->boot_image_emul= 2; xorriso->boot_image_emul= 2;
} }
boot_path[0]= 0; boot_path[0]= 0;
if(argv[i][0] != '/') if(argv[i][0] != '/' && strncmp(argv[i], "--interval:", 11) != 0)
strcat(boot_path, "/"); strcat(boot_path, "/");
ret= Sfile_str(boot_path + strlen(boot_path), argv[i], 0); ret= Sfile_str(boot_path + strlen(boot_path), argv[i], 0);
if(ret <= 0) if(ret <= 0)

View File

@ -607,14 +607,14 @@ int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
struct burn_drive_info *source_dinfo; struct burn_drive_info *source_dinfo;
struct burn_drive *source_drive; struct burn_drive *source_drive;
IsoImage *image= NULL; IsoImage *image= NULL;
IsoNode *node; IsoNode *node= NULL;
ElToritoBootImage *bootimg; ElToritoBootImage *bootimg;
enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL; enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL;
char *bin_path; char *bin_path;
int emul, platform_id; int emul, platform_id;
off_t load_size; off_t load_size;
struct stat stbuf; struct stat stbuf;
int hflag= 0; int hflag= 0, is_interval= 0;
if(xorriso->boot_image_bin_path[0] == 0 && !(flag & 2)) { if(xorriso->boot_image_bin_path[0] == 0 && !(flag & 2)) {
@ -647,13 +647,18 @@ int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
emul= xorriso->boot_image_emul; emul= xorriso->boot_image_emul;
platform_id= xorriso->boot_platform_id; platform_id= xorriso->boot_platform_id;
load_size= xorriso->boot_image_load_size; load_size= xorriso->boot_image_load_size;
if(strncmp(bin_path, "--interval:appended_partition_", 30) == 0) {
is_interval= 1;
if(load_size <= 0)
load_size= 512;
}
if(xorriso->boot_efi_default) { if(xorriso->boot_efi_default) {
emul= 0; emul= 0;
platform_id= 0xef; platform_id= 0xef;
xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 0; xorriso->patch_isolinux_image= (xorriso->patch_isolinux_image & ~3) | 0;
} }
if(platform_id == 0xef || load_size < 0) { if((platform_id == 0xef || load_size < 0) && !is_interval) {
ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4); ret= Xorriso_iso_lstat(xorriso, bin_path, &stbuf, 2 | 4);
if(ret != 0) if(ret != 0)
{ret= 0; goto ex;} {ret= 0; goto ex;}
@ -671,13 +676,15 @@ int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
else if(emul == 2) else if(emul == 2)
emul_type= ELTORITO_FLOPPY_EMUL; emul_type= ELTORITO_FLOPPY_EMUL;
ret= Xorriso_node_from_path(xorriso, image, bin_path, &node, 1); if (!is_interval) {
if(ret <= 0) { ret= Xorriso_node_from_path(xorriso, image, bin_path, &node, 1);
sprintf(xorriso->info_text, if(ret <= 0) {
"Cannot find in ISO image: -boot_image ... bin_path="); sprintf(xorriso->info_text,
Text_shellsafe(bin_path, xorriso->info_text, 1); "Cannot find in ISO image: -boot_image ... bin_path=");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Text_shellsafe(bin_path, xorriso->info_text, 1);
{ret= 0; goto ex;} Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
} }
if(xorriso->boot_count == 0) { if(xorriso->boot_count == 0) {

View File

@ -1 +1 @@
#define Xorriso_timestamP "2015.12.26.090812" #define Xorriso_timestamP "2015.12.30.175951"