Optional use of gdb in grub-mkrescue-sed.sh

This commit is contained in:
Thomas Schmitt 2016-04-08 06:14:05 +00:00
parent 4e5eabb9aa
commit 276d1be403

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (C) 2015
# Copyright (C) 2015 - 2016
# Thomas Schmitt <scdbackup@gmx.net>, libburnia-project.org
# Provided under BSD license: Use, modify, and distribute as you like.
@ -20,16 +20,17 @@ echo >&2
# xorriso program. Default is the neighboring ../../xorriso/xorriso program or,
# if that neighbor cannot be found, the system-wide installed xorriso.
#
# The mode "mjg" implements an experiment which should be accompanied by a
# GNU xorriso built by
# export CPPFLAGS="-DLibisofs_mjg_boot_for_grub2"
# ./configure && make clean && make
# The mode "mjg" implements a layout which resembles Fedora LiveCD and Debian
# ISOs which are bootable by ISOLINUX for BIOS and GRUB2 for EFI.
# Its GPT is considered to be surplus, according to UEFI specs.
#
# 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.
# If you add xorrisofs option -part_like_isohybrid then no gap fillig APM
# partition will emerge.
#
# These modes avoid duplicate storing of the EFI system partition "efi.img"
# by xorrisofs option -e "--interval:appended_partition_${partno}:all::"
@ -175,7 +176,7 @@ then
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/" \
-e "s/--protective-msdos-label/$protective -part_like_isohybrid/" \
)
elif test x"$mode" = xmjg_copy
@ -184,7 +185,7 @@ then
x=$(echo " $*" | sed \
-e "s/-efi-boot-part --efi-boot-image/-no-pad -append_partition $partno 0xef \/tmp\/$(basename "$dir")\/efi.img/" \
-e "s/--efi-boot efi\.img/-eltorito-alt-boot -e efi.img -no-emul-boot -isohybrid-gpt-basdat/" \
-e "s/--protective-msdos-label/$protective/" \
-e "s/--protective-msdos-label/$protective -part_like_isohybrid/" \
)
elif test x"$mode" = xmbr_only
@ -247,8 +248,18 @@ then
fi
# Run xorriso binary with the converted arguments
use_gdb=no
if test "$use_gdb" = yes
then
gdb_file=/tmp/grub-mkrescue-sed-gdb
echo b assess_appended_gpt >$gdb_file
echo run $MKRESCUE_SED_XORRISO_ARGS $x >>$gdb_file
gdb -x $gdb_file "$xorriso"
ret=0
else
"$xorriso" $MKRESCUE_SED_XORRISO_ARGS $x
ret=$?
fi
# Move back the ESP if it was separated
if test -n "$efi_tmp_name" -a -e /tmp/$efi_tmp_name