WSL2编译内核并更改替换内核版本
参考https://blog.csdn.net/weixin_43408232/article/details/129960452
sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev flex bison bc -y
wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-5.15.57.1.tar.gz
tar -xzf linux-msft-wsl-5.15.57.1.tar.gz
cd WSL2-Linux-Kernel-linux-msft-wsl-5.15.57.1/
sudo make KCONFIG_CONFIG=Microsoft/config-wsl -j$(nproc) #$(nproc) cpu核心数
ls arch/x86/boot/bzImage
cp arch/x86/boot/bzImage /mnt/d
#进入power shell
wsl --shutdown
#通常情况下的kernel位于C:\Windows\System32\lxss\tools
#将bzImage重命名为kernel并进行替换
#进入wsl
wsl
报错:
BTFIDS vmlinux
FAILED: load BTF from vmlinux: Invalid argument
make: *** [Makefile:1208: vmlinux] Error 255
make: *** Deleting file ‘vmlinux’
解决:
https://blog.csdn.net/woay2008/article/details/132748659