Linux kernel for Microsoft Windows Subsystem for Linux 2 (WSL2). Modified for usage with Ceph, NFS 4.1.
Open WSL2 and install dependencies:
sudo apt install flex bison libelf-dev libssl-dev crudini
Prepare scripts:
make prepare scripts
Configure the kernel:
make menuconfig
Build the kernel:
make
Install kernel modules:
sudo make modules_install
Copy kernel image:
mkdir -p /mnt/c/Sdk/Wsl
cp arch/x86/boot/bzImage /mnt/c/Sdk/Wsl/kernel
Configure Windows to use the custom kernel:
crudini --set "$(wslpath "$(wslvar USERPROFILE)")/.wslconfig" wsl2 kernel "$(wslpath -w "/mnt/c/Sdk/Wsl/kernel" | sed 's/\\/\\\\/g')"
Now exit the WSL2 shell and open Powershell as an administrator.
Restart WSL2:
wsl --shutdown
Restart-Service LxssManager
You can now run wsl
with the custom kernel.
The kernel runs all Linux dstributions, so you only have to change the kernel once.
Inspired by https://wsl.dev/wsl2-kernel-zfs/.