Created
May 2, 2024 04:04
-
-
Save itsdotscience/6431647a15c9ff626e780066845bb6fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export WSLKERNEL=`uname -a | cut -d " " -f3 | cut -d "-" -f1` | |
export CHECKOUT_DIR=`linux-msft-wsl-$WSLKERNEL` | |
git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b $CHECKOUT_DIR | |
cd $WSLKERNEL | |
sudo make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl CONFIG_USB_STORAGE=m CONFIG_USB_UAS=m | |
sudo make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl CONFIG_USB_STORAGE=m CONFIG_USB_UAS=m modules | |
sudo make -j$(nproc) KCONFIG_CONFIG=Microsoft/config-wsl CONFIG_USB_STORAGE=m CONFIG_USB_UAS=m modules_install | |
cp arch/x86/boot/bzImage wsl-$WSLKERNEL | |
echo "Copy the above to the root of your USERPROFILE on the Windows sdie then Add in the [wsl] section of your .wslconfig the following, doubling all | |
kernel=c:\\users\\username\\wsl-$WSLKERNEL | |
Then run wsl --shutdown from Windows, wait a minut or so and star wsl again. Once you have your usb device passed you should see the storage device if not, try on the wsl side: modprobe usb-storage; modprobe uas" |
Install build-essential flex bison libssl-dev libelf-dev libncurses5-dev git bc pahole
to get the dependencies.
This worked for me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Komorebi-E what's strange: to make the USB mass storage actually work with USBIPD and that custom kernel, I have to execute
modprobe vhci_hcd
in WSL2, which succeeds.(and docker is failing)