Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aramg/baf69ce8047cf6fd82b4df12ebec5f79 to your computer and use it in GitHub Desktop.
Save aramg/baf69ce8047cf6fd82b4df12ebec5f79 to your computer and use it in GitHub Desktop.
custom wsl2 kernel
sudo apt-get install -y autoconf bison build-essential flex libelf-dev libncurses-dev libssl-dev libtool libudev-dev
sudo dnf install git bc diffutils make gcc flex bison openssl-devel elfutils-libelf-devel ncurses-devel kmod unzip
#get kernel version
uname -r
5.10.16.3-microsoft-standard-WSL2
# get matching version, this is mine
wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-5.10.16.3.tar.gz
#extract it (change to your kernel version)
tar -xf linux-msft-wsl-5.10.16.3.tar.gz
cd WSL2-Linux-Kernel-linux-msft-wsl-5.10.16.3/
zcat /proc/config.gz > .config
make prepare modules_prepare
make menuconfig # Enable Extra Features or Modules
make -j4
sudo make modules_install
# see "modules.builtin" for the static included modules
# copy to windows drive
cp vmlinux /mnt/c/Users/user/
cat > /mnt/c/Users/user/.wslconfig
[wsl2]
kernel=C:\\Users\\user\\vmlinux
exit
# exit wsl and back to windows
# reboot the linux subsystem
wsl --shutdown
wsl -d distro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment