3

I have a question about the Linux kernel but not sure where would be the right place to ask it.

I am also afraid that my question may be seen as much too general or generic and I will be banned even more strictly, however (just in case) I will post it here.

My Question

I have read around about the Linux kernel but not found the answer of the following question:

Do the different kernel versions have different numbers of parameters or the number of kernel-parameters in all kernel versions is one and the same?

I suppose that the number of kernel-parameters in the different kernel versions is different, at least because a support for new devices is added and because new patches are being added too, but not sure.

And: is it true that a non-kernel-developer user can define and add his own parameter/s to the kernel?

2
  • 1
    For the purpose of your question here on the Meta site (as opposed to the main U&L site), you want comments on the appropriateness of your question?
    – Kusalananda Mod
    Jan 15, 2020 at 10:57
  • Yes, ask it on the main U&L. Search before, there may already be duplicates. FWIW, Linux will pass all the boot parameters which are not of the key=var form as command line args to the init process, which isn't necessarily systemd (it may be an /init script in the initrd image, or something else). You can also retrieve them whenever you want from /proc/cmdline.
    – user313992
    Jan 15, 2020 at 21:21

1 Answer 1

2

The big question here is what you mean by "kernel parameters." Linux is unusual among operating systems in general, and Unix in particular, in that it can accept a vector (list) of parameters which are passed to it by its bootloader (LILO, Syslinux, GRUB, etc).

The kernel parses these and uses their values to over-ride certain compile time defaults. But it also preserves and exposes that parameter list through the /proc/cmdline node. You can read it with the cat command as if it were a regular file; but, as with the rest of the contents of /proc, it's a pseudo-file with contents dynamically returned by the kernel.

Here's a typical Linux kernel command line: BOOT_IMAGE=/vmlinuz-4.4.0-96-generic root=/dev/mapper/ubuntu--vg-root ro console=tty0 console=ttyS1,115200n8 quiet

As you can see it's mostly a suite of KEY=VALUE pairs, similar to your shell environment. Ultimately some of these parameters are only used by the initrd/initramfs init, or the system init process, or by scripts and programs started by init (systemd on most common Linux systems today).

For example ro indicates that the root filesystem should be initially mounted in "read-only" mode. The actual mounting of the root filesystem (as specified by the root= parameter) is performed by the kernel. But the common case there is for an initial RAM filesystem (ramdisk) to be created, mounted on root, and populated (initramfs images are a compressed cpio compatible file). An executable named init in the root directory of that RAM disk image can then load modules, activate LVM volume groups, attach network storage systems such as from a SAN (storage area network), or do other things before mounting the (real) root filesystem and performing a pivot_root.

After pivot_root the kernel will search for the init executable (normally a component of systemd under most modern Linux distributions) and execute it with KEY=VALUE parameters in the init environment an any remaining kernel parameters (such as an old SysV runlevel number or indicated like "S" for single user mode) or the "quiet" seen in my example, passed as command line arguments.

In other words the Linux boot process, and its handling of dynamically (bootloader) provided parameters is complicated.

You can read more canonical documentation on this here: https://www.kernel.org/doc/html/v4.12/admin-guide/kernel-parameters.html

Of particular note is that the dynamic loading of Linux kernel modules (using the modprobe, but which is often triggered by events in the udev ... user-space device management ... subsystem ... this loading mechanism scans the kernel command line and relays those parameters to modules as they are loaded. Thus any parameters for modules can be established at boot time (but possibly over-ridden at load time, and, in some cases, they can be modified by operations on their own nodes under the */sys*** filesystem (which is a kernel interface abstraction similar /proc).

I hope that helps.

As for the meta question; I think it should be fine in the Unix & Linux StackExchange. Feel free to relay my answer over there or wherever is deemed to be appropriate for the question and its answers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .