The [WSL2-Linux-Kernel][wsl2-kernel] repo contains the kernel source code and configuration files for the [WSL2][about-wsl2] kernel.
Instructions for building an x86_64 AGNi WSL2 kernel with an Ubuntu distribution are as follows:
- Install the build dependencies:
$ sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev
- Build the kernel using the WSL2 kernel configuration:
$ mkdir OUT
$ make O=OUT KCONFIG_CONFIG=Microsoft/config-wsl_psndna88
Compiled kernel will be found in OUT/x86/boot/bzImage - Editing config:
$ make menuconfig O=OUT KCONFIG_CONFIG=Microsoft/config-wsl_psndna88
- Saving edited config:
$ cp -f OUT/Microsoft/config-wsl_psndna88 Microsoft/config-wsl_psndna88
Create file named ".wslconfig" in "C:\Users<user>" (replace with your windows username folder) add following lines to enable custom kernel boot in WSL:
[wsl2] memory=8GB # Limits VM memory in WSL 2 processors=6 # Limits WSL 6 logical processors kernel=C:\Users\\bzImage
NOTE: users can edit memory & processors as per their requirements & edit user as mentioned above