|
|
8631a2 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
8631a2 |
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
8631a2 |
Date: Tue, 26 Feb 2019 20:11:27 +0100
|
|
|
8631a2 |
Subject: [PATCH] blscfg: fallback to default_kernelopts if BLS option field
|
|
|
8631a2 |
isn't set
|
|
|
8631a2 |
|
|
|
8631a2 |
If the $kernelopts variable isn't found, then the entry will fail to boot
|
|
|
8631a2 |
since there won't be a kernel command line params set. This makes the BLS
|
|
|
8631a2 |
configuration more fragile than a non-BLS one, since in that case it will
|
|
|
8631a2 |
boot even without a correct grubenv file.
|
|
|
8631a2 |
|
|
|
8631a2 |
So set a $default_kernelopts in the GRUB config file that will be used as
|
|
|
8631a2 |
a fallback if the value in the BLS options field can't be resolved.
|
|
|
8631a2 |
|
|
|
8631a2 |
Related: rhbz#1625124
|
|
|
8631a2 |
|
|
|
8631a2 |
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
|
8631a2 |
---
|
|
|
8631a2 |
grub-core/commands/blscfg.c | 7 +++++++
|
|
|
8631a2 |
util/grub.d/10_linux.in | 2 ++
|
|
|
8631a2 |
2 files changed, 9 insertions(+)
|
|
|
8631a2 |
|
|
|
8631a2 |
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
|
030dc3 |
index c432c6ba27a..11cc82b6f31 100644
|
|
|
8631a2 |
--- a/grub-core/commands/blscfg.c
|
|
|
8631a2 |
+++ b/grub-core/commands/blscfg.c
|
|
|
8631a2 |
@@ -628,6 +628,9 @@ static char *expand_val(char *value)
|
|
|
8631a2 |
char *end = value;
|
|
|
8631a2 |
bool is_var = false;
|
|
|
8631a2 |
|
|
|
8631a2 |
+ if (!value)
|
|
|
8631a2 |
+ return NULL;
|
|
|
8631a2 |
+
|
|
|
8631a2 |
while (*value) {
|
|
|
8631a2 |
if (*value == '$') {
|
|
|
8631a2 |
if (start != end) {
|
|
|
8631a2 |
@@ -701,6 +704,10 @@ static void create_entry (struct bls_entry *entry)
|
|
|
8631a2 |
|
|
|
8631a2 |
title = bls_get_val (entry, "title", NULL);
|
|
|
8631a2 |
options = expand_val (bls_get_val (entry, "options", NULL));
|
|
|
8631a2 |
+
|
|
|
8631a2 |
+ if (!options)
|
|
|
8631a2 |
+ options = expand_val (grub_env_get("default_kernelopts"));
|
|
|
8631a2 |
+
|
|
|
8631a2 |
initrds = bls_make_list (entry, "initrd", NULL);
|
|
|
8631a2 |
|
|
|
8631a2 |
hotkey = bls_get_val (entry, "grub_hotkey", NULL);
|
|
|
8631a2 |
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
|
030dc3 |
index da2992ac9f1..04fd8953f40 100644
|
|
|
8631a2 |
--- a/util/grub.d/10_linux.in
|
|
|
8631a2 |
+++ b/util/grub.d/10_linux.in
|
|
|
8631a2 |
@@ -158,6 +158,8 @@ linux_entry ()
|
|
|
8631a2 |
populate_header_warn
|
|
|
8631a2 |
|
|
|
8631a2 |
cat << EOF
|
|
|
8631a2 |
+set default_kernelopts="root=${linux_root_device_thisversion} ro ${args}"
|
|
|
8631a2 |
+
|
|
|
8631a2 |
insmod blscfg
|
|
|
8631a2 |
blscfg
|
|
|
8631a2 |
if [ -s \$prefix/grubenv ]; then
|