Created
May 2, 2024 04:04
-
-
Save itsdotscience/6431647a15c9ff626e780066845bb6fe to your computer and use it in GitHub Desktop.
This file contains 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" |
Also, I had to increase the WSL memory from 4GiB to 6GiB because pandoc
kept getting OOM killed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This made it so easy to add USB mass storage support, thank you!!.
Side note, I had to make a few changes:
line 4
export CHECKOUT_DIR="linux-msft-wsl-$WSLKERNEL"
line 6
git clone https://github.com/microsoft/WSL2-Linux-Kernel.git --depth=1 -b $CHECKOUT_DIR $WSLKERNEL