本文主要记录内核参数相关笔记。

1. Introduction

There are three ways to pass options to the kernel and thus control its behavior:

  1. When building the kernel—in the kernel’s config file.
  2. When starting the kernel—using command line parameters (usually through a boot loader).
  3. At runtime—through the files in /proc/sys/ and /sys/.

This page only explains the second method (kernel command line parameters).

2. Set kernel command line parameters in GRUB

Kernel parameters can be set either temporarily by editing the boot entry in the boot loader’s boot selection menu, or permanently by modifying the boot loader’s configuration file.

The following examples add the quiet and splash parameters to GRUB.

  • Press e when the menu shows up and add them on the linux line:

    1
    linux /boot/vmlinuz-linux root=UUID=0a3407de-014b-458b-b5c1-848e92a327a3 rw quiet splash

    Press Ctrl+x to boot with these parameters.

  • To make the change persistent after reboot, the best practice is to:

    Edit /etc/default/grub and append your kernel options between the quotes in the GRUB_CMDLINE_LINUX_DEFAULT line:

    1
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

    And then automatically re-generate the grub.cfg file with update-grub.

3. Verification

You can check the parameters your system was booted up with by running cat /proc/cmdline and see if it includes your changes.

4. Parameter list

“The kernel’s command-line parameters” documentation

List of kernel parameters with further explanation and grouped by similar options


参考资料:

  1. Kernel parameters
  2. What do the nomodeset, quiet and splash kernel parameters mean?