< Alle Themen
Drucken

WSL2+ Kernel V6.6 Howto for Windows 11

# WSL2+ Kernel V6.6 Howto for Windows 11  Version 6.6.36.3 09/15/2024 https://rbconnect.eu/kb/wsl2-kernel-v6-howto-for-windows-11/
# Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution (Howto uses Ubuntu 24.04 LTS) are as follows:

For testing you can Download the precompiled Kernel Image from here: https://download.rbconnect.eu/dl/Public/wsl2-linux-kernel-6-windows/

# Ubuntu 24.04 LTS Requirements

Open a WSL terminal window and launch the Distro of your choice. Install the required packages to build the kernel:

sudo apt update && sudo apt install build-essential flex bison cpio sudo dwarves libssl-dev libelf-dev bc python3 pahole python3


# Get the Microsoft Linux Kernel Source from from GitHub:

wget https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-6.6.36.3.tar.gz

File: WSL2-Linux-Kernel-linux-msft-wsl-6.6.36.3.tar.gz
SHA-256: b8c0fd3a392139315f92d17e33682366e25755178dd9567326d518779e9ef83a

# Unzip it and Change directory to the kernel source code:

cd WSL2-Linux-Kernel-linux-msft-wsl-6.6.36.6

# Build the Kernel (takes some time) !! You will be asked for the following !!:

Mitigations for CPU vulnerabilities (CPU_MITIGATIONS) [Y/n/?] (NEW) Y <- (choose „n“ for better Performance, but less Security Infos: https://docs.kernel.org/admin-guide/hw-vuln/mds.html#:~:text=SMT%20state%20unknown-,Mitigation%20mechanism,a%20kernel%20command%20line%20option. )

Analog Devices Generic AXI ADC IP core driver (ADI_AXI_ADC) [N/m/?] N <- (https://cateee.net/lkddb/web-lkddb/ADI_AXI_ADC.html)
make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl
# Install the kernel modules and headers:

sudo make modules_install headers_install

# Installing the Kernel:

# Copy the kernel image to the Windows file system:

sudo cp arch/x86/boot/bzImage /mnt/c/kernel/bzimage_6.6.36.6

# Open Windows Explorer copy the kernel from the “c:\kernel” folder to the root of C:\
(Windows security confirmation could be required).

Exit the WSL terminal window.

# Using the Kernel

# You can configure WSL to use it instead of the stock kernel as follows.
Create or edit the file `%USERPROFILE%\.wslconfig` with the following content:

[wsl2]

Kernel=C:\\kernel\\bzImage_6.6.36.6

# Open a PowerShell terminal window as Administrator and Stop the WSL instance:

wsl --shutdown

# Now you can now launch your WSL2 Distro and check the kernel version as follows:

Open a WSL terminal window and launch the Distro of your choice. Check the kernel version:

uname -r

# You should see the following output:

Linux [YourPCname] 6.6.36.6-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Sun Sep 15 12:51:35 CEST 2024 x86_64 x86_64 x86_64 GNU/Linux

# Documentation

wsl2-kernel: https://github.com/microsoft/WSL2-Linux-Kernel

about-wsl2: https://docs.microsoft.com/en-us/windows/wsl/about#what-is-wsl-2

wsl-issue: https://github.com/microsoft/WSL/issues/new/choose

normal-bug: https://www.kernel.org/doc/html/latest/admin-guide/bug-hunting.html#reporting-the-bug

security-bug: https://www.kernel.org/doc/html/latest/admin-guide/security-bugs.html

submit-patch: https://www.kernel.org/doc/html/latest/process/submitting-patches.html

.wslconfig-inst: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig