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 0703bcd7e6
commit 58644f0971
4 changed files with 106 additions and 20 deletions

View File

@ -25,10 +25,19 @@ echo >&2
# export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2"
# ./configure && make clean && make
#
# The mode "mbr_only" implements an alternative fully UEFI compliant layout
# which does not produce GTP, HFS+, and APM.
# It is supposed to work with any unmodified xorriso >= 1.3.2
# The mode "mbr_only" implements an alternative layout according to UEFI 2.4,
# section 2.5.1 and table 16. No GTP, HFS+, or APM.
#
# 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
@ -37,9 +46,11 @@ echo >&2
# default settings:
# Manipulation mode:
# "mjg" = ESP in MBR+GPT+APM, with HFS+
# "mbr_only" = ESP in MBR, without HFS+
# "original" = pass arguments unchanged
# "mjg" = ESP in MBR+GPT+APM, with HFS+
# "mbr_only" = ESP in MBR, without HFS+
# "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"
if test -n "$MKRESCUE_SED_MODE"
then
@ -101,6 +112,13 @@ fi
# 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 >&2
@ -118,7 +136,7 @@ then
fi
# 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
dir="."
for i in "$@"
@ -129,7 +147,16 @@ do
elif test $next_is_dir = 1
then
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
done
@ -139,7 +166,19 @@ then
find "$dir"
fi
efi_tmp_name=
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
# Exchange arguments for the experimental GRUB2 mjg layout
x=$(echo " $*" | sed \
@ -149,6 +188,18 @@ then
)
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
# Exchange arguments for no-HFS MBR-only layout
x=$(echo " $*" | sed \
@ -157,6 +208,25 @@ then
-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
then
# Pass arguments unchanged
@ -178,4 +248,13 @@ fi
# Run xorriso binary with the converted arguments
"$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;
}
boot_path[0]= 0;
if(argv[i][0] != '/')
if(argv[i][0] != '/' && strncmp(argv[i], "--interval:", 11) != 0)
strcat(boot_path, "/");
ret= Sfile_str(boot_path + strlen(boot_path), argv[i], 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 *source_drive;
IsoImage *image= NULL;
IsoNode *node;
IsoNode *node= NULL;
ElToritoBootImage *bootimg;
enum eltorito_boot_media_type emul_type= ELTORITO_NO_EMUL;
char *bin_path;
int emul, platform_id;
off_t load_size;
struct stat stbuf;
int hflag= 0;
int hflag= 0, is_interval= 0;
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;
platform_id= xorriso->boot_platform_id;
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) {
emul= 0;
platform_id= 0xef;
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);
if(ret != 0)
{ret= 0; goto ex;}
@ -671,13 +676,15 @@ int Xorriso_attach_boot_image(struct XorrisO *xorriso, int flag)
else if(emul == 2)
emul_type= ELTORITO_FLOPPY_EMUL;
ret= Xorriso_node_from_path(xorriso, image, bin_path, &node, 1);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot find in ISO image: -boot_image ... bin_path=");
Text_shellsafe(bin_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
if (!is_interval) {
ret= Xorriso_node_from_path(xorriso, image, bin_path, &node, 1);
if(ret <= 0) {
sprintf(xorriso->info_text,
"Cannot find in ISO image: -boot_image ... bin_path=");
Text_shellsafe(bin_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
{ret= 0; goto ex;}
}
}
if(xorriso->boot_count == 0) {

View File

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