generate-kernel-cmdline(Configuration)
okay so bestie, welcome to generate-kernel-cmdline from the Configuration manual β and itβs literally giving a UAPI.6 compliant configuration system for generating kernel command lines in postmarketOS. π
It supports adding and removing specific kernel parameters, gives you a clear three-tier configuration hierarchy with well-defined ordering (distro defaults β device maintainer config β user overrides), and lets packages do their own config thing without touching shared defaults (similar to how initramfs files are handled). It uses layered config directories with vendor/user separation: /usr/lib for distro and packages, and /etc for users/system admins. Config files list kernel command line parameters that can be added or removed, so distros, packages, and users can override each other. No cap. β¨
π Config Directory Structure β¨
/usr/lib/kernel-cmdline.d/ # Distro and package config files
/etc/kernel-cmdline.d/ # System admin config files
π Processing Order π«Ά
/usr/lib/kernel-cmdline.d/*.conf/etc/kernel-cmdline.d/*.conf
Config files are parsed lexicographically within each directory per UAPI.6 spec. β
π File Format π
Extension: .conf
Syntax (one directive per line):
paramβ add parameterparam=valueβ add parameter with value-paramβ removeparam-param=valueβ removeparam=value# commentβ comment- Empty lines ignored
π§ Processing Rules π
Each directive is independent. Multiple instances of the same parameter name coexist unless matched for removal. Periodt.
Example πΈ
Starting cmdline: console=tty0 console=ttyMSM0,115200 quiet
To remove console=ttyMSM0,115200, add this to a config file with a higher priority:
-console=ttyMSM0,115200
Result: console=tty0 quiet
π«₯ Masking π
Empty file or symlink to /dev/null masks file at same path in lower-priority directory, per UAPI.6 spec. Thatβs the whole mood. π
π Examples π¦
Base Distro Config π
/usr/lib/kernel-cmdline.d/00-defaults.conf:
console=tty0
quiet
loglevel=4
Device Package π±
/usr/lib/kernel-cmdline.d/50-pinephone.conf:
console=ttyMSM0,115200
-quiet
Result: console=tty0 console=ttyMSM0,115200 loglevel=4
User Override π
/etc/kernel-cmdline.d/debug.conf:
-quiet
debug
loglevel=7
Result: console=tty0 console=ttyMSM0,115200 loglevel=7 debug
Replacing a Parameter π₯
/etc/kernel-cmdline.d/local.conf:
-console=ttyMSM0,115200
console=ttyUSB0,9600
Result: console=tty0 console=ttyUSB0,9600 loglevel=7 debug
Masking Example π§
To mask the pinephone configuration, create an empty file or symlink:
doas touch /etc/kernel-cmdline.d/50-pinephone.conf
or
doas ln -s /dev/null /etc/kernel-cmdline.d/50-pinephone.conf
This prevents /usr/lib/kernel-cmdline.d/50-pinephone.conf from being parsed. π«Ά
π Thatβs the whole page, bestie β footer says generate-kernel-cmdline(Configuration), and since the original doesnβt give a source/version or date, Iβm not making one up. Slay. β¨
π¦ where this page comes from
- alpine 3.24: generate-kernel-cmdline-doc 1.0-r0 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms