Thanks to the WSL System Distro, we no longer need distro-specific instructions to build a WSL custom kernel. A standard, ephemeral build environment

How to build a custom kernel for WSL in 2025

submited by
Style Pass
2024-11-23 16:00:05

Thanks to the WSL System Distro, we no longer need distro-specific instructions to build a WSL custom kernel. A standard, ephemeral build environment is right there, on every WSL installation.

Thanks to the introduction of the WSL System Distro, a lightweight Linux distro that runs on top of WSL managing various tasks, it is no longer necessary to write distro-specific guides to building a custom WSL kernel.

Because the WSL System Distro is standardized across all WSL installs, we can build a custom kernel for WSL the same way on any WSL install, regardless of your day-to-day WSL distro, whether it's AlmaLinux, Pengwin, Ubuntu, openSUSE, or Arch.

The WSL System Distro is powered by Azure Linux, also known as CBL-Mariner. The System Distro image ships with WSL, though it is mostly invisible. Unlike your day-to-day WSL distro though, the System Distro image is immutable. That means, even if you make changes in the System Distro, like installing packages or creating files, the minute you exit the System Distro, they are lost, and it reverts to the original version that the WSL team ships.

On the other hand, the WSL System Distro is the same across all WSL installations. Azure Linux is an rpm-based distribution that utilizes tdnf, a simplified version of dnf, the rpm-based package manager, it can connect to the Azure Linux Microsoft package repository and download any dependencies you need, including git and all the Linux build dependencies. We just need to build the kernel and export it to our Windows file system before it closes and it lost.

Leave a Comment