stages/grub2: set GRUB_CMDLINE_LINUX default

Set the "GRUB_CMDLINE_LINUX" variable in /etc/default/grub to the
kernel command line options. This is used by `grub2-mkconfig` to
assemble the full kernel command line when generating the menu
entires. NB: `GRUB_CMDLINE_LINUX` does NOT include the root fs
bits (`root=...`), since that is generated by grub2-mkconfig
itself.
This commit is contained in:
Christian Kellner 2021-03-03 17:12:56 +00:00 committed by Tom Gundersen
parent 846b3274e3
commit 850ee4466f

View file

@ -388,7 +388,10 @@ def main(tree, options):
if write_defaults:
os.makedirs(f"{tree}/etc/default", exist_ok=True)
with open(f"{tree}/etc/default/grub", "w") as default:
default.write("GRUB_TIMEOUT=0\n"
# NB: The "GRUB_CMDLINE_LINUX" variable contains the kernel command
# line but without the `root=` part, thus we just use `kernel_opts`.
default.write(f'GRUB_CMDLINE_LINUX="{kernel_opts}"\n'
"GRUB_TIMEOUT=0\n"
"GRUB_ENABLE_BLSCFG=true\n")
os.makedirs(f"{tree}/boot/grub2", exist_ok=True)