|
|
d3ceae4 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
d3ceae4 |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d3ceae4 |
Date: Mon, 14 Oct 2019 17:37:26 +0200
|
|
|
d3ceae4 |
Subject: [PATCH] blscfg: Don't hardcode an env var as fallback for the BLS
|
|
|
d3ceae4 |
options field
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
If the BLS fragments don't have an options field or if this was set to an
|
|
|
d3ceae4 |
environment variable that was not defined in the grubenv file, the blscfg
|
|
|
d3ceae4 |
module searches for an default_kernelopts variable that is defined in the
|
|
|
d3ceae4 |
grub.cfg file.
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
But the blscfg module shouldn't hardcode fallbacks variables and instead
|
|
|
d3ceae4 |
this logic should be handled in the GRUB config file itself.
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
Also, add a comment explaining where the kernelopts variable is supposed
|
|
|
d3ceae4 |
to be defined and what is the process for the user to change its value.
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
Resolves: rhbz#1710483
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
d3ceae4 |
---
|
|
|
d3ceae4 |
grub-core/commands/blscfg.c | 4 ----
|
|
|
d3ceae4 |
util/grub.d/10_linux.in | 12 +++++++++++-
|
|
|
d3ceae4 |
2 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
|
d3ceae4 |
index 1ec89870483..471975fd2e5 100644
|
|
|
d3ceae4 |
--- a/grub-core/commands/blscfg.c
|
|
|
d3ceae4 |
+++ b/grub-core/commands/blscfg.c
|
|
|
d3ceae4 |
@@ -733,10 +733,6 @@ static void create_entry (struct bls_entry *entry)
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
title = bls_get_val (entry, "title", NULL);
|
|
|
d3ceae4 |
options = expand_val (bls_get_val (entry, "options", NULL));
|
|
|
d3ceae4 |
-
|
|
|
d3ceae4 |
- if (!options)
|
|
|
d3ceae4 |
- options = expand_val (grub_env_get("default_kernelopts"));
|
|
|
d3ceae4 |
-
|
|
|
d3ceae4 |
initrds = bls_make_list (entry, "initrd", NULL);
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
devicetree = expand_val (bls_get_val (entry, "devicetree", NULL));
|
|
|
d3ceae4 |
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
|
d3ceae4 |
index 0471464e68e..21a6915dca3 100644
|
|
|
d3ceae4 |
--- a/util/grub.d/10_linux.in
|
|
|
d3ceae4 |
+++ b/util/grub.d/10_linux.in
|
|
|
d3ceae4 |
@@ -118,7 +118,17 @@ if [ "x${GRUB_ENABLE_BLSCFG}" = "xtrue" ]; then
|
|
|
d3ceae4 |
populate_header_warn
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
cat << EOF
|
|
|
d3ceae4 |
-set default_kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
|
d3ceae4 |
+# The kernelopts variable should be defined in the grubenv file. But to ensure that menu
|
|
|
d3ceae4 |
+# entries populated from BootLoaderSpec files that use this variable work correctly even
|
|
|
d3ceae4 |
+# without a grubenv file, define a fallback kernelopts variable if this has not been set.
|
|
|
d3ceae4 |
+#
|
|
|
d3ceae4 |
+# The kernelopts variable in the grubenv file can be modified using the grubby tool or by
|
|
|
d3ceae4 |
+# executing the grub2-mkconfig tool. For the latter, the values of the GRUB_CMDLINE_LINUX
|
|
|
d3ceae4 |
+# and GRUB_CMDLINE_LINUX_DEFAULT options from /etc/default/grub file are used to set both
|
|
|
d3ceae4 |
+# the kernelopts variable in the grubenv file and the fallback kernelopts variable.
|
|
|
d3ceae4 |
+if [ -z "\${kernelopts}" ]; then
|
|
|
d3ceae4 |
+ set kernelopts="root=${LINUX_ROOT_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
|
d3ceae4 |
+fi
|
|
|
d3ceae4 |
|
|
|
d3ceae4 |
insmod blscfg
|
|
|
d3ceae4 |
blscfg
|