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",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
|
"write_cmdline": {
|
||||||
|
"description": "Include the kernel command line in `grubenv`",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
|
},
|
||||||
"ignition": {
|
"ignition": {
|
||||||
"description": "Include ignition support in the grub.cfg",
|
"description": "Include ignition support in the grub.cfg",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
@ -468,13 +473,14 @@ class GrubConfig:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
#pylint: disable=too-many-statements
|
#pylint: disable=too-many-statements,too-many-branches
|
||||||
def main(tree, options):
|
def main(tree, options):
|
||||||
root_fs = options.get("rootfs")
|
root_fs = options.get("rootfs")
|
||||||
boot_fs = options.get("bootfs")
|
boot_fs = options.get("bootfs")
|
||||||
kernel_opts = options.get("kernel_opts", "")
|
kernel_opts = options.get("kernel_opts", "")
|
||||||
legacy = options.get("legacy", None)
|
legacy = options.get("legacy", None)
|
||||||
uefi = options.get("uefi", None)
|
uefi = options.get("uefi", None)
|
||||||
|
write_cmdline = options.get("write_cmdline", True)
|
||||||
write_defaults = options.get("write_defaults", True)
|
write_defaults = options.get("write_defaults", True)
|
||||||
ignition = options.get("ignition", False)
|
ignition = options.get("ignition", False)
|
||||||
saved_entry = options.get("saved_entry")
|
saved_entry = options.get("saved_entry")
|
||||||
|
|
@ -528,10 +534,10 @@ def main(tree, options):
|
||||||
|
|
||||||
with open(grubenv, "w") as env:
|
with open(grubenv, "w") as env:
|
||||||
fs_type, fs_id = fs_spec_decode(root_fs)
|
fs_type, fs_id = fs_spec_decode(root_fs)
|
||||||
data = (
|
data = "# GRUB Environment Block\n"
|
||||||
"# GRUB Environment Block\n"
|
|
||||||
f"kernelopts=root={fs_type}={fs_id} {kernel_opts}\n"
|
if write_cmdline:
|
||||||
)
|
data += f"kernelopts=root={fs_type}={fs_id} {kernel_opts}\n"
|
||||||
|
|
||||||
if saved_entry:
|
if saved_entry:
|
||||||
data += f"saved_entry={saved_entry}\n"
|
data += f"saved_entry={saved_entry}\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue