The default WSL2 Linux kernel comes without Bluetooth support. The aim of this fork is to provide a kernel image with Bluetooth support.
To build a custom kernel image:
- Open WSL, run
uname -r
and note down the kernel version - Within the WSL kernel git repository, check out the branch that matches the version. The branches start with
linux-msft-wsl-
- Cherry-pick and push the commit that adds a CI pipeline YAML file and enables Bluetooth options
- Once the CI pipeline is complete, download the job artifact, which contains the kernel image,
bzImage
- Copy
bzImage
toC:\bzImage
- Create a file,
C:\Users\<USER>\.wslconfig
and write the following to it:
[wsl2]
kernel=C:\\bzImage
- In Windows, disable Bluetooth to allow the adapter to be attached to WSL
- In WSL, install the dependencies to use Bluetooth:
sudo apt install dbus rfkill bluez
- From PowerShell, run
wsl --shutdown
to force loading new kernel - Run
usbipd list
to find the Bluetooth adapter - Run
usbipd attach -b <BUS_ID> --wsl -a
on the Bluetooth adapter to attach it to WSL
The WSL2-Linux-Kernel repo contains the kernel source code and configuration files for the WSL2 kernel.
If you discover an issue relating to WSL or the WSL2 kernel, please report it on the WSL GitHub project. It is not possible to report issues on the WSL2-Linux-Kernel project.
If you're able to determine that the bug is present in the upstream Linux kernel, you may want to work directly with the upstream developers. Please note that there are separate processes for reporting a normal bug and a security bug.
Is there a missing feature that you'd like to see? Please request it on the WSL GitHub project.
If you're able and interested in contributing kernel code for your feature request, we encourage you to submit the change upstream.
Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution are as follows:
- Install the build dependencies:
$ sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev
- Build the kernel using the WSL2 kernel configuration:
$ make KCONFIG_CONFIG=Microsoft/config-wsl
Please see the documentation on the .wslconfig configuration file for information on using a custom built kernel.