diff --git a/0299-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch b/0299-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch new file mode 100644 index 0000000..25685e8 --- /dev/null +++ b/0299-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Mon, 13 Jan 2020 15:44:42 +0100 +Subject: [PATCH] 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set + kernelopts + +The GRUB documentation mentions that there are two variables to set the +linux kernel cmdline: GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT. + +The former is added to all the menuentry commands and the latter is not +added to the recovery mode menu entries. But the blscfg module doesn't +populate recovery entries from the BLS snippets, so the values set in the +GRUB_CMDLINE_LINUX_DEFAULT variable should also be included in kernelopts. + +This is needed because the GRUB_CMDLINE_LINUX_DEFAULT option is mentioned +in the GRUB documentation so users assume that the kernel cmdline options +can be changed by setting this option and running the grub2-mkconfig tool. + +Signed-off-by: Javier Martinez Canillas +--- + util/grub.d/10_linux.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 350903fa5ab..79b028b6155 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -158,7 +158,7 @@ linux_entry () + populate_header_warn + + cat << EOF +-set default_kernelopts="root=${linux_root_device_thisversion} ro ${args}" ++set default_kernelopts="root=${linux_root_device_thisversion} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + + insmod blscfg + blscfg +@@ -174,7 +174,7 @@ EOF + fi + fi + +- ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}" ++ ${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" + fi diff --git a/0300-Fix-savedefault-with-blscfg.patch b/0300-Fix-savedefault-with-blscfg.patch new file mode 100644 index 0000000..0e62576 --- /dev/null +++ b/0300-Fix-savedefault-with-blscfg.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Fritz Elfert +Date: Mon, 13 Jan 2020 15:48:59 +0100 +Subject: [PATCH] Fix savedefault with blscfg + +The GRUB_SAVEDEFAULT option was ignored on a BLS configuration. Fix it by +making the menu entries populated from the BLS files to call savedefault +if a save_default environment variable has been set to "true". + +This variable is set by grub2-mkconfig to the value in GRUB_SAVEDEFAULT. +--- + grub-core/commands/blscfg.c | 5 ++++- + util/grub.d/10_linux.in | 4 ++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c +index 8c6dd91be10..f2c1fd0733d 100644 +--- a/grub-core/commands/blscfg.c ++++ b/grub-core/commands/blscfg.c +@@ -821,11 +821,14 @@ static void create_entry (struct bls_entry *entry) + tmp = grub_stpcpy (tmp, "\n"); + } + +- src = grub_xasprintf ("load_video\n" ++ const char *sdval = grub_env_get("save_default"); ++ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0)); ++ src = grub_xasprintf ("%sload_video\n" + "set gfxpayload=keep\n" + "insmod gzio\n" + "linux %s%s%s%s\n" + "%s", ++ savedefault ? "savedefault\n" : "", + GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "", + initrd ? initrd : ""); + +diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in +index 79b028b6155..12a3a034e65 100644 +--- a/util/grub.d/10_linux.in ++++ b/util/grub.d/10_linux.in +@@ -178,6 +178,10 @@ EOF + if [ -n "${GRUB_EARLY_INITRD_LINUX_CUSTOM}" ]; then + ${grub_editenv} - set early_initrd="${GRUB_EARLY_INITRD_LINUX_CUSTOM}" + fi ++ ++ if [ -n "${GRUB_SAVEDEFAULT}" ]; then ++ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}" ++ fi + fi + + exit 0 diff --git a/grub.patches b/grub.patches index 46dbafc..eaabcae 100644 --- a/grub.patches +++ b/grub.patches @@ -296,3 +296,5 @@ Patch0295: 0295-blscfg-Fix-typo-for-gfxpayload-variable-name.patch Patch0296: 0296-grub-set-bootflag-Update-comment-about-running-as-ro.patch Patch0297: 0297-grub-set-bootflag-Write-new-env-to-tmpfile-and-then-.patch Patch0298: 0298-grub.d-Fix-boot_indeterminate-getting-set-on-boot_su.patch +Patch0299: 0299-10_linux.in-Also-use-GRUB_CMDLINE_LINUX_DEFAULT-to-s.patch +Patch0300: 0300-Fix-savedefault-with-blscfg.patch diff --git a/grub2.spec b/grub2.spec index 66f8c7d..4626414 100644 --- a/grub2.spec +++ b/grub2.spec @@ -7,7 +7,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 87%{?dist} +Release: 88%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -476,6 +476,11 @@ rm -r /boot/grub2.tmp/ || : %endif %changelog +* Mon Jan 13 2020 Javier Martinez Canillas - 2.02-88 +- 10_linux.in: Also use GRUB_CMDLINE_LINUX_DEFAULT to set kernelopts +- Make the blscfg module honour the GRUB_SAVEDEFAULT option + Resolves: rhbz#1704926 + * Thu Dec 05 2019 Javier Martinez Canillas - 2.02-87 - Drop patch fixing a corner case in BLS variable expansion Related: rhbz#1779611