stages/grub2: ability to not write kernel cmdline
Currently we always write the kernel command line to the `grubenv`
file, if only to include the root device. Starting with Fedora 33
and thus RHEL 9, the kernel command line included statically in
the BLS snippets and the grubenv `kernelopts` variable not used.
Instead one of the {/usr/lib,/etc}/kernel/cmdline files is read
and the parameters in them used during the creation of the BLS
snippets.
Therefore we add a new `write_cmdline` option that, if set to
FALSE, will prevent us from writing the kernel command line.
This commit is contained in:
parent
d4f275e024
commit
ee96b11faf
1 changed files with 11 additions and 5 deletions
|
|
@ -171,6 +171,11 @@ SCHEMA = """
|
|||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"write_cmdline": {
|
||||
"description": "Include the kernel command line in `grubenv`",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"ignition": {
|
||||
"description": "Include ignition support in the grub.cfg",
|
||||
"type": "boolean",
|
||||
|
|
@ -468,13 +473,14 @@ class GrubConfig:
|
|||
return data
|
||||
|
||||
|
||||
#pylint: disable=too-many-statements
|
||||
#pylint: disable=too-many-statements,too-many-branches
|
||||
def main(tree, options):
|
||||
root_fs = options.get("rootfs")
|
||||
boot_fs = options.get("bootfs")
|
||||
kernel_opts = options.get("kernel_opts", "")
|
||||
legacy = options.get("legacy", None)
|
||||
uefi = options.get("uefi", None)
|
||||
write_cmdline = options.get("write_cmdline", True)
|
||||
write_defaults = options.get("write_defaults", True)
|
||||
ignition = options.get("ignition", False)
|
||||
saved_entry = options.get("saved_entry")
|
||||
|
|
@ -528,10 +534,10 @@ def main(tree, options):
|
|||
|
||||
with open(grubenv, "w") as env:
|
||||
fs_type, fs_id = fs_spec_decode(root_fs)
|
||||
data = (
|
||||
"# GRUB Environment Block\n"
|
||||
f"kernelopts=root={fs_type}={fs_id} {kernel_opts}\n"
|
||||
)
|
||||
data = "# GRUB Environment Block\n"
|
||||
|
||||
if write_cmdline:
|
||||
data += f"kernelopts=root={fs_type}={fs_id} {kernel_opts}\n"
|
||||
|
||||
if saved_entry:
|
||||
data += f"saved_entry={saved_entry}\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue