2

I'm new to Linux so bear with me here, I'm happy to clarify any terminology I inevitably misuse.

I am running Windows 11 and WSL/Ubuntu. I am trying to flash an embedded linux image to an SD card using a script (part of an SDK). The script compiles the image and then puts it onto the SD card, it takes the <device> as an argument with the example /dev/sdc.

sudo ./mksdcard.sh /dev/sdc

I have set up USBIPD and successfully mounted the SD card to my "linux" system. When I run
$usbipd wsl attach --busid 3-1 in PowerShell I can see the SD card (drive D) disappear from my windows filesystem, and I can see it's contents at /mnt/d through Ubuntu. The problem is when I look at the devices in /dev it doesn't show up there, only /sda, /sdb, and /sdc. When I run lsusb, I can see the SD card:

$lsusb
Bus 002 Device 003: ID 045e:090c Microsoft Corp. SD Card
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and when I run lsusb -t:

$lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 5000M
    |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=vhci_hcd/8p, 480M

I have tried to run the script using /mnt/d instead of the suggested /dev/sdc but I get an error that this is a directory, not a device.

Based on the results from $lsusb -t it looks to me like the driver is missing for the SD card. Is that maybe the problem here? Is there a way to get that driver?

I'm trying my best to use WSL for development instead of booting my computer into Linux, but this is my biggest roadblock so far.

Here is some additional info if it helps:

$lsblk
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda    8:0    0   256G  0 disk
sdb    8:16   0 339.7M  1 disk
sdc    8:32   0   256G  0 disk /

$uname -a Linux SUN-022078282057 5.10.102.1-microsoft-standard-WSL2+ #1 SMP Tue Jun 7 15:51:43 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux

Thanks!!

Locks
  • 31

1 Answers1

3

You seem to have a reasonable grasp on the basics, at the very least (and possibly much more), so I'm going to try to give you a "partial answer" that might get you in the right direction. Normally I'd try to test things out more fully on my end before posting, but that could take several days.

I have a feeling that you are running into similar issues as we're seeing with camera support in WSL2. While the WSL2 kernel has USB/IP support, it doesn't contain drivers for most USB devices themselves. For instance, looking at the WSL2 kernel config, you'll see that MMC (SD card) support is not included.

I can't guarantee that it will work, but you will at least have to compile your own kernel with MMC support, and likely the actual driver for your SD card reader itself as well.

On a typical Ubuntu (or other distribution) kernel, all of the common hardware devices would be available as kernel modules, but WSL's kernel is more streamlined.

Another, easier alternative, since you are on Windows 11, might be to mount the actual drive from Windows to WSL using wsl --mount --bare. In theory, this would make the device itself available to WSL without actually mounting it. You might then be able to access it as you are hoping.

NotTheDr01ds
  • 22,082