This tree holds the kernel source and configuration used by WSL2. You can build and package the kernel, modules, headers, and perf tooling for use with a custom WSL setup.
Overview
WSL2-Linux-Kernel provides the Linux kernel codebase and Microsoft-specific configuration files that power the Windows Subsystem for Linux 2 environment. It is the kernel layer that guest Linux distributions run on inside WSL2 rather than a standalone desktop distribution.
The published sources include the full kernel tree plus WSL-oriented config under the Microsoft config path. Optional steps let you adjust kernel options with menuconfig against that config before building. Standard kernel build output can be paired with module installation into a local modules directory, UAPI headers install, and a perf tools build trimmed of optional dependencies.
Documentation describes producing a VHDX artifact that bundles modules, headers, and perf via a provided script or manual staging into an ext4 image converted to VHDX. WSL expects those artifacts under predictable mount paths for modules, linux-headers, and perf when you supply a custom kernel.
Using a self-built kernel is documented through the WSL .wslconfig settings. Bug reports and feature requests for WSL behavior are directed to the main WSL project rather than this kernel-only repository; upstream Linux is the path for bugs that are not WSL-specific.
Key features
- WSL2-specific kernel configuration
- Full upstream-style kernel source tree
- Optional menuconfig for kernel options
- Modules and headers build workflow
- Perf tooling build instructions
- VHDX artifact packaging script
- Custom kernel via .wslconfig
- Ubuntu-oriented build dependency list
Use cases
- Building a custom WSL2 Linux kernel
- Testing kernel config changes for WSL
- Packaging modules and headers for WSL
- Including perf tools with a custom kernel
- Contributing kernel fixes upstream