KDE Linux/Kernel Development
This page is a work in progress.
KDE Linux provides a complete, preconfigured kernel development environment out of the box. No additional packages, containers, virtual machines, or chroots are required. Kernel development follows standard upstream Linux workflows, with a small number of KDE Linux specific integration steps explained below.
Upstream documentation
Kernel development on KDE Linux follows upstream Linux practices. Before proceeding, it is strongly recommended to become familiar with the official Linux kernel documentation:
- https://docs.kernel.org/
- https://docs.kernel.org/process/
- https://docs.kernel.org/kbuild/
- https://docs.kernel.org/rust/
These documents describe the development process, coding style, build system, and (optionally) Rust support used by the kernel.
Prerequisites
KDE Linux uses a read-only /usr. filesystem. Any custom kernel, kernel modules, or related artifacts must be installed via a writable overlay.
Before continuing, you must set up a systemd system extension (sysext) to allow overriding content in /usr.
Follow the instructions on this page:
This step is mandatory. All kernel images and modules built in this guide are installed into the sysext and then merged into the live system.
Cloning the Linux kernel
Clone the upstream Linux kernel repository using Git:
git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
You may also clone a specific stable or development branch if required.
Kernel configuration
You can start from the default configuration for your architecture:
make defconfig
To customize the configuration, use one of the standard kernel configuration interfaces:
make menuconfig
make nconfig
make xconfig
All configuration steps are identical to upstream Linux kernel development.
Building the kernel
Build the kernel using the standard build system:
make -j$(nproc)
This produces the kernel image and modules in the build tree.
Installing into the sysext
Install the kernel modules into the sysext overlay:
make INSTALL_MOD_PATH="$HOME/kde/usr" modules_install
Determine the kernel version and install the kernel image:
version=$(make -s kernelrelease)
install -Dm644 "$(make -s image_name)" \
"$HOME/kde/usr/lib/modules/$version/vmlinuz"
Refresh the systemd system extension so the system sees the new kernel and modules:
run0 systemd-sysext refresh
Rebuilding EFI images
After installing the kernel into the sysext, rebuild the EFI artifacts based on the updated /usr contents:
run0 /usr/lib/rebuild-efi
This step generates a new Unified Kernel Image (UKI).
Installing the Unified Kernel Image
Install the generated UKI into the EFI System Partition:
run0 cp kde-linux.efi /boot/EFI/Linux/
The new kernel will appear as an unversioned entry in systemd-boot and can be selected at the next boot.