diff --git a/20-grub.install b/20-grub.install index f7b94b8..ad507f5 100755 --- a/20-grub.install +++ b/20-grub.install @@ -83,6 +83,19 @@ case "$COMMAND" in "$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${KERNEL_DIR}")")" \ >"${BLS_TARGET}" fi + + eval "$(grub2-get-kernel-settings)" || true + if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then + ARCH="$(uname -m)" + BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/\.${ARCH}/-debug.${ARCH}/")" + cp -aT "${BLS_TARGET}" "${BLS_DEBUG}" + TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" + BLSID="$(grep '^id[ \t]' "${BLS_DEBUG}" | sed -e "s/\.${ARCH}/-debug.${ARCH}/")" + sed -i -e "s/^title.*/title ${TITLE}${GRUB_LINUX_DEBUG_TITLE_POSTFIX}/" "${BLS_DEBUG}" + sed -i -e "s/^id.*/${BLSID}/" "${BLS_DEBUG}" + sed -i -e "s/^options.*/options \$kernelopts ${GRUB_CMDLINE_LINUX_DEBUG}/" "${BLS_DEBUG}" + fi + exit 0 fi @@ -95,7 +108,10 @@ case "$COMMAND" in remove) if [[ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]] || [[ ! -f /sbin/new-kernel-pkg ]]; then - rm -f "${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" + ARCH="$(uname -m)" + BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" + BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/\.${ARCH}/-debug.${ARCH}/")" + rm -f "${BLS_TARGET}" "${BLS_DEBUG}" for i in vmlinuz System.map config zImage.stub dtb; do rm -rf "/boot/${i}-${KERNEL_VERSION}" diff --git a/grub2.spec b/grub2.spec index 6a6b15d..afb42db 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 31%{?dist} +Release: 32%{?dist} Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base License: GPLv3+ @@ -452,6 +452,9 @@ fi %endif %changelog +* Wed Apr 11 2018 Javier Martinez Canillas - 2.02-32 +- Make 20-grub.install to generate debug BLS when MAKEDEBUG is set. + * Fri Apr 06 2018 Peter Jones - 2.02-31 - Pull in some TPM fixes I missed.