Merge the last linux kernel configuration from Microsoft for Windows Subsystem for Linux 2 with the upstream torvalds linux sources
Steps for compile Kernel Linux 6.1.y.
Can use the script build.sh
to automate the download, configuration, and compilation of the kernel source code for WSL2
uname -a
Linux DESKTOP-ID 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux
mkdir -p linux
cd linux
sudo apt install git bc build-essential flex bison libssl-dev libelf-dev dwarves
wget https://github.com/torvalds/linux/archive/refs/tags/v5.15.tar.gz -O v5.15.tar.gz
tar -xf v5.15.tar.gz
wget https://github.com/microsoft/WSL2-Linux-Kernel/raw/linux-msft-wsl-5.10.y/Microsoft/config-wsl
cp config-wsl linux-5.15/arch/x86/configs/wsl_defconfig
cd linux-5.15
make KCONFIG_CONFIG=arch/x86/configs/wsl_defconfig -j4
powershell.exe /C 'Copy-Item .\arch\x86\boot\bzImage $env:USERPROFILE'
powershell.exe /C 'Write-Output [wsl2]`nkernel=$env:USERPROFILE\bzImage | % {$_.replace("\","\\")} | Out-File $env:USERPROFILE\.wslconfig -encoding ASCII'
[wsl2]
kernel=C:\\Users\\<YOUR_USER>\\bzImage
wsl --shutdown
wsl -l -v
wsl -d Debian
uname -a
Linux HP450-2 5.15.0-oleksis-microsoft-standard-WSL2 #1 SMP Mon Nov 29 01:14:26 EST 2021 x86_64 x86_64 x86_64 GNU/Linux