diff --git a/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch b/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch new file mode 100644 index 00000000..483efc4c --- /dev/null +++ b/0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Wed, 29 Apr 2020 20:08:27 +0200 +Subject: [PATCH] blscfg: Lookup default_kernelopts variable as fallback for + options + +The 10_linux script sets a variable that contains the kernel command line +parameters. This is done so the entries will still have a kernel cmdline +defined even if the grubenv can't be read. + +But older versions of the script used to set a default_kernelopts variable +while newer versions just sets the kernelopts, which is what's defined in +the BLS snippets. + +The blscfg module needs to keep looking for the default_kernelops since it +may be that a user doesn't have a grubenv file and has an older grub.cfg +that sets this variable instead of kernelopts. + +Related: rhbz#1765297 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 9263a5c1a02..4ec6504d9a4 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -759,6 +759,10 @@ static void create_entry (struct bls_entry *entry) + + title = bls_get_val (entry, "title", NULL); + options = expand_val (bls_get_val (entry, "options", NULL)); ++ ++ if (!options) ++ options = expand_val (grub_env_get("default_kernelopts")); ++ + initrds = bls_make_list (entry, "initrd", NULL); + + devicetree = expand_val (bls_get_val (entry, "devicetree", NULL)); diff --git a/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch b/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch new file mode 100644 index 00000000..75eb75ad --- /dev/null +++ b/0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Thu, 30 Apr 2020 15:45:31 +0200 +Subject: [PATCH] 10_linux.in: fix early exit due error when reading petitboot + version + +The script uses bash's read built-in command to get the petitboot version +version, but this command has a non-zero exit status if the EOF is found. + +Since the /sys/firmware/devicetree/base/ibm,firmware-versions/petitboot +string ends with a NUL character, use the empty string as read delimiter +to prevent the command to read to the end-of-file and exit with an error. + +Resolves: rhbz#1827397 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 847646bd8a8..09adfce80fd 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -194,7 +194,7 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then + petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" + + if test -e ${petitboot_path}; then +- read -a petitboot_version < ${petitboot_path} ++ read -r -d '' petitboot_version < ${petitboot_path} + petitboot_version="$(echo ${petitboot_version//v})" + major_version="$(echo ${petitboot_version} | cut -d . -f1)" + minor_version="$(echo ${petitboot_version} | cut -d . -f2)" diff --git a/99-grub-mkconfig.install b/99-grub-mkconfig.install index f943da1e..d9686b51 100755 --- a/99-grub-mkconfig.install +++ b/99-grub-mkconfig.install @@ -20,7 +20,7 @@ if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot" if test -e ${petitboot_path}; then - read -a petitboot_version < ${petitboot_path} + read -r -d '' petitboot_version < ${petitboot_path} petitboot_version="$(echo ${petitboot_version//v})" major_version="$(echo ${petitboot_version} | cut -d . -f1)" minor_version="$(echo ${petitboot_version} | cut -d . -f2)" diff --git a/grub.patches b/grub.patches index e325f5ca..2b922ddb 100644 --- a/grub.patches +++ b/grub.patches @@ -208,3 +208,5 @@ Patch0207: 0207-10_linux.in-Merge-logic-from-10_linux_bls-and-drop-t.patch Patch0208: 0208-grub-switch-to-blscfg-Use-install-to-copy-GRUB-binar.patch Patch0209: 0209-10_linux.in-Enable-BLS-configuration-if-new-kernel-p.patch Patch0210: 0210-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +Patch0211: 0211-blscfg-Lookup-default_kernelopts-variable-as-fallbac.patch +Patch0212: 0212-10_linux.in-fix-early-exit-due-error-when-reading-pe.patch diff --git a/grub2.spec b/grub2.spec index 13e54f4c..fe9f2f4b 100644 --- a/grub2.spec +++ b/grub2.spec @@ -9,7 +9,7 @@ Name: grub2 Epoch: 1 Version: 2.04 -Release: 14%{?dist} +Release: 15%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -504,6 +504,12 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Thu Apr 30 2020 Javier Martinez Canillas - 2.04-15 +- blscfg: Lookup default_kernelopts variable as fallback for options + Related: rhbz#1765297 +- 10_linux.in: fix early exit due error when reading petitboot version + Resolves: rhbz#1827397 + * Thu Apr 23 2020 Javier Martinez Canillas - 2.04-14 - efi: Set image base address before jumping to the PE/COFF entry point Resolves: rhbz#1825411