Blame SOURCES/0234-grub-switch-to-blscfg-copy-blscfg-module-for-legacy-.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Javier Martinez Canillas <javierm@redhat.com>
8631a2
Date: Fri, 28 Sep 2018 10:35:38 +0200
8631a2
Subject: [PATCH] grub-switch-to-blscfg: copy blscfg module for legacy BIOS and
8631a2
 ppc ieee1275
8631a2
8631a2
On platforms that load the blscfg module the latest version should be used,
8631a2
so copy the module to the boot directory to make sure that the grub2 kernel
8631a2
will load the latest version of the BLS parsing code.
8631a2
8631a2
Related: rhbz#1633646
8631a2
8631a2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8631a2
---
8631a2
 util/grub-switch-to-blscfg.in | 13 ++++++++++++-
8631a2
 1 file changed, 12 insertions(+), 1 deletion(-)
8631a2
8631a2
diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in
030dc3
index 9cf64f8e725..1c6bd1882a7 100644
8631a2
--- a/util/grub-switch-to-blscfg.in
8631a2
+++ b/util/grub-switch-to-blscfg.in
8631a2
@@ -53,6 +53,8 @@ blsdir=`echo "/@bootdirname@/loader/entries" | sed 's,//*,/,g'`
8631a2
 
8631a2
 backupsuffix=.bak
8631a2
 
8631a2
+arch="$(uname -m)"
8631a2
+
8631a2
 export TEXTDOMAIN=@PACKAGE@
8631a2
 export TEXTDOMAINDIR="@localedir@"
8631a2
 
8631a2
@@ -248,7 +250,6 @@ for kernelver in $(cd /lib/modules/ ; ls -1) "" ; do
8631a2
     fi
8631a2
 
8631a2
     if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
8631a2
-        arch="$(uname -m)"
8631a2
         bls_debug="$(echo ${bls_target} | sed -e "s/\.${arch}/-debug.${arch}/")"
8631a2
         cp -aT  "${bls_target}" "${bls_debug}"
8631a2
         title="$(grep '^title[ \t]' "${bls_debug}" | sed -e 's/^title[ \t]*//')"
8631a2
@@ -282,6 +283,16 @@ elif ! grep -q '^GRUB_ENABLE_BLSCFG=.*' "${etcdefaultgrub}" ; then
8631a2
 fi
8631a2
 
8631a2
 if [ "${GENERATE}" -eq 1 ] ; then
8631a2
+    if [ $arch = "x86_64" ] && [ ! -d /sys/firmware/efi ]; then
8631a2
+	if ! cp ${prefix}/lib/grub//i386-pc/blscfg.mod ${grubdir}/i386-pc/ ; then
8631a2
+	    exit 1
8631a2
+	fi
8631a2
+    elif [ $arch = "ppc64" -o $arch = "ppc64le" ] && [ ! -d /sys/firmware/opal ]; then
8631a2
+	if ! cp ${prefix}/lib/grub/powerpc-ieee1275/blscfg.mod ${grubdir}/powerpc-ieee1275/ ; then
8631a2
+	    exit 1
8631a2
+	fi
8631a2
+    fi
8631a2
+
8631a2
     cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}"
8631a2
     if ! grub2-mkconfig -o "${GRUB_CONFIG_FILE}" ; then
8631a2
         cp -af "${GRUB_CONFIG_FILE}${backupsuffix}" "${GRUB_CONFIG_FILE}"