Fix bugs in the blscfg module and in the 10_linux script for ppc64le
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 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
b28e5aa886
commit
b914a7e168
@ -0,0 +1,40 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
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 <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
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));
|
@ -0,0 +1,33 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||||
|
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 <javierm@redhat.com>
|
||||||
|
---
|
||||||
|
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)"
|
@ -20,7 +20,7 @@ if [[ $ARCH = "ppc64le" ]] && [ -d /sys/firmware/opal ]; then
|
|||||||
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
|
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
|
||||||
|
|
||||||
if test -e ${petitboot_path}; then
|
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})"
|
petitboot_version="$(echo ${petitboot_version//v})"
|
||||||
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
|
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
|
||||||
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
|
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
|
||||||
|
@ -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
|
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
|
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
|
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
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
Name: grub2
|
Name: grub2
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 2.04
|
Version: 2.04
|
||||||
Release: 14%{?dist}
|
Release: 15%{?dist}
|
||||||
Summary: Bootloader with support for Linux, Multiboot and more
|
Summary: Bootloader with support for Linux, Multiboot and more
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
URL: http://www.gnu.org/software/grub/
|
URL: http://www.gnu.org/software/grub/
|
||||||
@ -504,6 +504,12 @@ rm -r /boot/grub2.tmp/ || :
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Apr 30 2020 Javier Martinez Canillas <javierm@redhat.com> - 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 <javierm@redhat.com> - 2.04-14
|
* Thu Apr 23 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-14
|
||||||
- efi: Set image base address before jumping to the PE/COFF entry point
|
- efi: Set image base address before jumping to the PE/COFF entry point
|
||||||
Resolves: rhbz#1825411
|
Resolves: rhbz#1825411
|
||||||
|
Loading…
Reference in New Issue
Block a user