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

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