From ed50db379d0fa86eec0a15ceb337bf99add37623 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Wed, 11 Apr 2018 13:48:47 +0200 Subject: [PATCH] Make 20-grub.install to generate debug BLS when MAKEDEBUG is set If MAKEDEBUG=yes in /etc/sysconfig/kernel, then a debug menu entry should be created. So for BLS, a debug configuration file has to be created that contains debug kernel command line parameters. Signed-off-by: Javier Martinez Canillas --- 20-grub.install | 18 +++++++++++++++++- grub2.spec | 5 ++++- 2 files changed, 21 insertions(+), 2 deletions(-) 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 c7d25c1..d22ea79 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.