b914a7e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b914a7e
From: Javier Martinez Canillas <javierm@redhat.com>
b914a7e
Date: Wed, 29 Apr 2020 20:08:27 +0200
b914a7e
Subject: [PATCH] blscfg: Lookup default_kernelopts variable as fallback for
b914a7e
 options
b914a7e
b914a7e
The 10_linux script sets a variable that contains the kernel command line
b914a7e
parameters. This is done so the entries will still have a kernel cmdline
b914a7e
defined even if the grubenv can't be read.
b914a7e
b914a7e
But older versions of the script used to set a default_kernelopts variable
b914a7e
while newer versions just sets the kernelopts, which is what's defined in
b914a7e
the BLS snippets.
b914a7e
b914a7e
The blscfg module needs to keep looking for the default_kernelops since it
b914a7e
may be that a user doesn't have a grubenv file and has an older grub.cfg
b914a7e
that sets this variable instead of kernelopts.
b914a7e
b914a7e
Related: rhbz#1765297
b914a7e
b914a7e
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
b914a7e
---
b914a7e
 grub-core/commands/blscfg.c | 4 ++++
b914a7e
 1 file changed, 4 insertions(+)
b914a7e
b914a7e
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
b914a7e
index 9263a5c1a02..4ec6504d9a4 100644
b914a7e
--- a/grub-core/commands/blscfg.c
b914a7e
+++ b/grub-core/commands/blscfg.c
b914a7e
@@ -759,6 +759,10 @@ static void create_entry (struct bls_entry *entry)
b914a7e
 
b914a7e
   title = bls_get_val (entry, "title", NULL);
b914a7e
   options = expand_val (bls_get_val (entry, "options", NULL));
b914a7e
+
b914a7e
+  if (!options)
b914a7e
+    options = expand_val (grub_env_get("default_kernelopts"));
b914a7e
+
b914a7e
   initrds = bls_make_list (entry, "initrd", NULL);
b914a7e
 
b914a7e
   devicetree = expand_val (bls_get_val (entry, "devicetree", NULL));