Skip to content

MichaelSchaecher/wsl-kernel-patch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

WSL2 Kernel Patch

A patch to compile Linux Kernel for WSL2. This patch includes a default config file for WSL2 and a script to compile the kernel.

Apply the patch

  1. Download the kernel source code from kernel.org.
  2. Extract the source code.
  3. Copy the patch file to the source code directory.
  4. Run patch -p1 < wsl2_kernel.patch to apply the patch.
  5. Run yes "" | make oldconfig to use the default config file.
  6. Run make -j$(nproc) to compile the kernel.

Install the kernel

Run sudo make modules_install to install the modules.

To use the kernel in WSL2, you need to copy the kernel image bzImage located in arch/x86/boot/ to a directory in your Windows user profile. If you don't have a .wslconfig file in your Windows user profile, create one. Add the following lines to the file:

[wsl2]
kernel=C:\\Users\\<username>\\bzImage

About

A patch to compile Linux Kernel for WSL2.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published