diff --git a/0284-blscfg-fallback-to-default_kernelopts-if-BLS-option-.patch b/0284-blscfg-fallback-to-default_kernelopts-if-BLS-option-.patch new file mode 100644 index 0000000..d4b3889 --- /dev/null +++ b/0284-blscfg-fallback-to-default_kernelopts-if-BLS-option-.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 26 Feb 2019 20:11:27 +0100 +Subject: [PATCH] blscfg: fallback to default_kernelopts if BLS option field + isn't set + +If the $kernelopts variable isn't found, then the entry will fail to boot +since there won't be a kernel command line params set. This makes the BLS +configuration more fragile than a non-BLS one, since in that case it will +boot even without a correct grubenv file. + +So set a $default_kernelopts in the GRUB config file that will be used as +a fallback if the value in the BLS options field can't be resolved. + +Related: rhbz#1625124 + +Signed-off-by: Javier Martinez Canillas +--- + grub-core/commands/blscfg.c | 7 +++++++ + util/grub.d/10_linux.in | 2 ++ + 2 files changed, 9 insertions(+) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 1ef2ae06cff..5635066e3eb 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -629,6 +629,9 @@ static char *expand_val(char *value) + char *end = value; + bool is_var = false; + ++ if (!value) ++ return NULL; ++ + while (*value) { + if (*value == '$') { + if (start != end) { +@@ -732,6 +735,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); + + hotkey = bls_get_val (entry, "grub_hotkey", NULL); +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 22a85c69ea0..2547dd52115 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -158,6 +158,8 @@ linux_entry () + populate_header_warn + + cat << EOF ++set default_kernelopts="root=${linux_root_device_thisversion} ro ${args}" ++ + insmod blscfg + blscfg + if [ -s \$prefix/grubenv ]; then diff --git a/0285-grub-switch-to-blscfg-copy-increment.mod-for-legacy-.patch b/0285-grub-switch-to-blscfg-copy-increment.mod-for-legacy-.patch new file mode 100644 index 0000000..d7ac8ff --- /dev/null +++ b/0285-grub-switch-to-blscfg-copy-increment.mod-for-legacy-.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Tue, 26 Feb 2019 21:25:39 +0100 +Subject: [PATCH] grub-switch-to-blscfg: copy increment.mod for legacy BIOS and + ppc64 + +This module is also used in newer GRUB config and weren't present in old +GRUB installations, so it has to be copied before attempting to generate +a BLS configuration. + +Resolves: rhbz#1652806 + +Signed-off-by: Javier Martinez Canillas +--- + util/grub-switch-to-blscfg.in | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/util/grub-switch-to-blscfg.in b/util/grub-switch-to-blscfg.in +index eeea1307706..49b3985fadb 100644 +--- a/util/grub-switch-to-blscfg.in ++++ b/util/grub-switch-to-blscfg.in +@@ -288,13 +288,15 @@ if [ "${GENERATE}" -eq 1 ] ; then + copy_bls + + if [ $arch = "x86_64" ] && [ ! -d /sys/firmware/efi ]; then +- if ! cp ${prefix}/lib/grub//i386-pc/blscfg.mod ${grubdir}/i386-pc/ ; then +- exit 1 +- fi ++ mod_dir="i386-pc" + elif [ $arch = "ppc64" -o $arch = "ppc64le" ] && [ ! -d /sys/firmware/opal ]; then +- if ! cp ${prefix}/lib/grub/powerpc-ieee1275/blscfg.mod ${grubdir}/powerpc-ieee1275/ ; then +- exit 1 +- fi ++ mod_dir="powerpc-ieee1275" ++ fi ++ ++ if [ -n "${mod_dir}" ]; then ++ for mod in blscfg increment; do ++ cp ${prefix}/lib/grub/${mod_dir}/${mod}.mod ${grubdir}/$mod_dir/ || exit 1 ++ done + fi + + cp -af "${GRUB_CONFIG_FILE}" "${GRUB_CONFIG_FILE}${backupsuffix}" diff --git a/grub.patches b/grub.patches index 2c85d8d..e990e81 100644 --- a/grub.patches +++ b/grub.patches @@ -281,3 +281,5 @@ Patch0280: 0280-Try-to-set-fPIE-and-friends-on-libgnu.a.patch Patch0281: 0281-Don-t-make-grub_strtoull-print-an-error-if-no-conver.patch Patch0282: 0282-Set-blsdir-if-the-BLS-directory-path-isn-t-one-of-th.patch Patch0283: 0283-Check-if-blsdir-exists-before-attempting-to-get-it-s.patch +Patch0284: 0284-blscfg-fallback-to-default_kernelopts-if-BLS-option-.patch +Patch0285: 0285-grub-switch-to-blscfg-copy-increment.mod-for-legacy-.patch diff --git a/grub2.spec b/grub2.spec index d0186f9..0b3992e 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 70%{?dist} +Release: 71%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -473,6 +473,16 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Wed Feb 27 2019 Javier Martinez Canillas - 2.02-71 +- 20-grub-install: Replace, rather than overwrite, the existing kernel (pjones) + Resolves: rhbz#1642402 +- 99-grub-mkconfig: Don't update grubenv generating entries on ppc64le + Related: rhbz#1637875 +- blscfg: fallback to default_kernelopts if BLS option field isn't set + Related: rhbz#1625124 +- grub-switch-to-blscfg: copy increment.mod for legacy BIOS and ppc64 + Resolves: rhbz#1652806 + * Fri Feb 15 2019 Javier Martinez Canillas - 2.02-70 - Check if blsdir exists before attempting to get it's real path Resolves: rhbz#1677415