</>EmbeddedInterview

What are kernel command line (bootargs) parameters?

EasyEmbedded Linux & Boot

Short answer: The kernel command line is a string of parameters passed by the bootloader (or stored in the device tree's /chosen/bootargs, or built into the kernel) that configures the kernel at boot: which console to use, where the root filesystem is, log level, and settings for built-in drivers. The running values are in /proc/cmdline.

console=ttymxc0,115200 earlycon root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ro quiet loglevel=4 panic=5

Common parameters

Parameter Meaning
console=ttyS0,115200 kernel console device and baud rate (can be given more than once)
earlycon very early console from the DT stdout-path, before the UART driver probes
root=/dev/mmcblk0p2 root filesystem device (also PARTUUID=..., /dev/nfs, ubi0:rootfs)
rootfstype=ext4 skip filesystem probing
rootwait wait until the root device appears (needed for slow eMMC/SD/USB)
ro / rw mount root read-only or read-write
init=/bin/sh run a different first program (recovery trick)
quiet, loglevel=N reduce console output (printing to a slow UART can add seconds to boot)
panic=5 reboot 5 s after a kernel panic
mem=512M limit usable memory
module.param=value parameter for a built-in driver, e.g. usbcore.autosuspend=-1
nfsroot=, ip=dhcp network root filesystem for development

Where it comes from (priority depends on kernel config): U-Boot's bootargs variable, which U-Boot writes into the DTB's /chosen node; the DTB itself; or CONFIG_CMDLINE built into the kernel (can be set to append, extend or force).

How the kernel parses it: parameters registered with __setup() or early_param(), and module_param() for built-in modules. Anything the kernel does not recognise is passed to init as arguments or environment variables.

Security note: if users can change bootargs (open U-Boot console), they can add init=/bin/sh and get a root shell. Locking the environment is part of hardening.