Kernel arguments as array
EDIT: "${__defaults[@]@Q}" should be used, to allow arguments like acpi_osi='Windows 2009';
then if you check the generated configuration, you'll see every argument has been single-quoted:
linux /boot/vmlinuz... root=... rw 'quiet' 'loglevel=3' 'acpi_osi=Windows 2009' ...
If you use a bootloader like GRUB which has a configuration file in bash syntax, you can put your kernel command line arguments as an array (obviously you must then join them as a single string).
In this way you can easily comment-out, change order (if important) and add explanation comments to your arguments.
I just tried this and it works flawlessly:
#!/bin/bash
GRUB_SAVEDEFAULT=true
#GRUB_DEFAULT=saved
GRUB_DEFAULT=0
GRUB_TIMEOUT=0
#GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DISABLE_OS_PROBER=true
GRUB_RECORDFAIL_TIMEOUT=0
GRUB_TERMINAL_INPUT='console usb_keyboard'
#GRUB_GFXMODE=800x600x24
#GRUB_GFXMODE=1024x768x24
#GRUB_GFXMODE=vga
GRUB_GFXMODE=auto
#GRUB_GFXPAYLOAD_LINUX=text
#GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_RECOVERY=true
GRUB_DISABLE_SUBMENU=y
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
GRUB_DISTRIBUTOR="Arch"
__defaults=(
# Silent boot
quiet
loglevel=3
#vga=current # disables kms
rd.systemd.show_status=false
rd.udev.log-priority=3
vt.global_cursor_default=0 # no cursor
splash # eye candy
resume=UUID=e13fee37-b833-4ccd-82a7-30143dee4392
nowatchdog # faster shutdown
sysrq_always_enabled=1 # debug
ahci.mobile_lpm_policy=1 # powersaving w/o drawbacks
# Performance?
i915.enable_dc=0
intel_idle.max_cstate=1
intel_iommu=on
i915.disable_power_well=0
# Good backlight
i915.enable_dpcd_backlight=1
acpi_backlight=vendor
# https://make-linux-fast-again.com/
noibrs
noibpb
nopti
nospectre_v2
nospectre_v1
l1tf=off
nospec_store_bypass_disable
no_stf_barrier
mds=off
tsx=on
tsx_async_abort=off
mitigations=off
)
GRUB_CMDLINE_LINUX_DEFAULT="${__defaults[@]@Q}"
GRUB_CMDLINE_LINUX=""
#GRUB_COLOR_HIGHLIGHT="green/black"
#GRUB_COLOR_NORMAL="light-gray/black"
#GRUB_THEME=""
#GRUB_FONT=""
Edited 24 Apr 2021. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 18 · 96% up
- Kind
- Text
- ID
- msoomo
7 comments
Is there a rundown of exactly what the make-linux-fast-again options actually do? Some are obviously self-explanatory (the spectre stuff) but what are the others doing and are there any potential risks to using them?
I think this explains most of it.
Thanks!
It looks like a nice way of keeping track of which argument does what, for sure.
Does this work with GRUB Customizer?
Mmh I don't think so, it probably reads the file line-by-line expecting to find
GRUB_CMDLINE_LINUX_DEFAULTas a single un-cutted string.That's just my thought btw, you should check the source code.
Deleted before we saved it.