Making SD card visible to PC in USB device mode

1,983 views
Skip to first unread message

dermiem

unread,
Aug 2, 2013, 6:26:10 AM8/2/13
to beagl...@googlegroups.com
Hi,
 
I am powering my BBB from an external power supply and am not using the mini USB cable.
I have an SD card installed and visible within the Linux file system.
I have added a uEnv.txt file to the SD card so that the BBB boots from eMMC and not the SD card.
 
When I connect to a PC using a regular USB cable (ie not the mini USB cable), the PC recognizes the device as a USB flash device.
The PC can only see /media/BEAGLEBONE.
I would like to be able to configure the BBB so that the PC sees /media/SDVolume instead.
Where SDVolume is the name of the volume created on the SD card.
 
How do I do this?

Gerald Coley

unread,
Aug 2, 2013, 8:37:52 AM8/2/13
to beagl...@googlegroups.com
If the PC is running windows, you can't. Windows does not recognize the format used in Linux.

Gerald



--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Juan C.

unread,
Aug 2, 2013, 8:54:46 AM8/2/13
to beagl...@googlegroups.com
You can always install VMWare (http://www.vmware.com/products/player/) on your PC and run a virtual Linux operating system.

Jason Kridner

unread,
Aug 2, 2013, 9:27:03 AM8/2/13
to beagl...@googlegroups.com
Actually, there are ways to enable Windows to see Linux partitions: http://www.howtogeek.com/112888/3-ways-to-access-your-linux-partitions-from-windows/

Neither that nor VMWare will help you see the ext4 partition using the default Angstrom image on the BeagleBone Black because only the FAT partition is shared. Sharing drives as mass-storage class devices at the same time they are mounted on another system is a recipe for disaster. The idea promoted in this current solution is that the FAT partition on the eMMC is for the exclusive use of the PC host after boot. During boot, files like the uEnv.txt are read, providing a mechanism for external systems to update the boot parameters.

What you most likely really want to do is use sshfs. A protocol like sshfs uses the BeagleBone Black's running file system code to access the disk, rather than exposing the raw file system to the host. It runs over a network connection, like the one provided by the RNDIS driver over USB and equally over Ethernet. It uses the sshd server running on the BeagleBone Black to establish a connection and to read/write files.

Here is the first one I found with a google search: https://code.google.com/p/win-sshfs/

I cannot speak to its functionality/quality.


--

Jason Kridner

unread,
Aug 2, 2013, 9:38:58 AM8/2/13
to beagl...@googlegroups.com
I need to read more carefully... for some reason, I had it in my head you wanted to access the eMMC. I read below you actually want to access the SD card. That *is* possible to share over USB as a mass-storage class device, if you have an updated kernel. More below...

On Fri, Aug 2, 2013 at 9:27 AM, Jason Kridner <jkri...@beagleboard.org> wrote:
Actually, there are ways to enable Windows to see Linux partitions: http://www.howtogeek.com/112888/3-ways-to-access-your-linux-partitions-from-windows/

Neither that nor VMWare will help you see the ext4 partition using the default Angstrom image on the BeagleBone Black because only the FAT partition is shared. Sharing drives as mass-storage class devices at the same time they are mounted on another system is a recipe for disaster. The idea promoted in this current solution is that the FAT partition on the eMMC is for the exclusive use of the PC host after boot. During boot, files like the uEnv.txt are read, providing a mechanism for external systems to update the boot parameters.

What you most likely really want to do is use sshfs. A protocol like sshfs uses the BeagleBone Black's running file system code to access the disk, rather than exposing the raw file system to the host. It runs over a network connection, like the one provided by the RNDIS driver over USB and equally over Ethernet. It uses the sshd server running on the BeagleBone Black to establish a connection and to read/write files.

Here is the first one I found with a google search: https://code.google.com/p/win-sshfs/

I cannot speak to its functionality/quality.



On Fri, Aug 2, 2013 at 8:54 AM, Juan C. <cortez...@gmail.com> wrote:
You can always install VMWare (http://www.vmware.com/products/player/) on your PC and run a virtual Linux operating system.


On Friday, August 2, 2013 5:26:10 AM UTC-5, dermiem wrote:
Hi,
 
I am powering my BBB from an external power supply and am not using the mini USB cable.
I have an SD card installed and visible within the Linux file system.

I should have read this closer first!
 
I have added a uEnv.txt file to the SD card so that the BBB boots from eMMC and not the SD card.
 
When I connect to a PC using a regular USB cable (ie not the mini USB cable), the PC recognizes the device as a USB flash device.
The PC can only see /media/BEAGLEBONE.

This is the eMMC shared using g_multi. The script that gets run to do this sharing is at /usr/bin/g-ether-load.sh. That script is called during boot using /lib/systemd/system/storage-gadget-init.service.
 
I would like to be able to configure the BBB so that the PC sees /media/SDVolume instead.
Where SDVolume is the name of the volume created on the SD card.
 
How do I do this?

You'll want to disable the g_multi driver that is there. 'systemctl disable storage-gadget-init.service' should prevent it from being loaded after the next reboot.

You'll need to make sure the SD card doesn't get mounted by the BeagleBone Black's filesystem code. That would conflict with serving it up over USB. You can't have both of them access it at once. My comments about 'sshfs' still stand in that regards.

Next, you'll want to 'modprobe g_mass_storage file=/dev/mmcblk1 cdrom=0 stall=0 removable=1 nofua=1' or something like that. There are lots of references on the internet on how to use g_mass_storage. You'll need to make sure you are pointing to the right device. Give it a shot and report what you find.

FYI, g_mass_storage.ko should exist at /lib/modules/3.8.13/kernel/drivers/usb/gadget or so.

William Hermans

unread,
Aug 3, 2013, 2:02:48 AM8/3/13
to beagl...@googlegroups.com
Is there something wrong with making the partition a FAT32 partition ? 

 And I think Jason hit on it already, that there are Linux file system tools for Windows, but last I used them, it was for ext2/ext3 at most, and where buggy as hell. The tools while attempting to, or already having mounted a Linux file system would slow to a crawl for long periods of time.

Samba works great too, but would not exactly be a mass storage type drive.

Aparna Velampudi

unread,
Jan 16, 2017, 12:01:15 PM1/16/17
to BeagleBoard
I'm using a beaglebone Black, debian. 4.1.15-ti-rt-43.

I'm trying to achieve the same thing. -- accessing my external storage SD card (in the BBB which is booting off emmc). I have log files which I save to the SD card and I want to access them by connecting my beaglebone to the computer (instead of taking out the SD card, putting it into a reader and then into my computer). 

However,  /usr/bin/g-ether-load.sh and  /lib/systemd/system/storage-gadget-init.service don't exist where it's said to in this answer, so I don't know how  to proceed.

Robert Nelson

unread,
Jan 16, 2017, 12:11:28 PM1/16/17
to Beagle Board, Aparna Velampudi
On Mon, Jan 16, 2017 at 11:01 AM, Aparna Velampudi
<aparnav...@gmail.com> wrote:
> I'm using a beaglebone Black, debian. 4.1.15-ti-rt-43.
>
> I'm trying to achieve the same thing. -- accessing my external storage SD
> card (in the BBB which is booting off emmc). I have log files which I save
> to the SD card and I want to access them by connecting my beaglebone to the
> computer (instead of taking out the SD card, putting it into a reader and
> then into my computer).
>
> However, /usr/bin/g-ether-load.sh and
> /lib/systemd/system/storage-gadget-init.service don't exist where it's said
> to in this answer, so I don't know how to proceed.

Both of those were a feature of Angstrom..

We need to shoehorn this feature into "am335x_evm.sh" found in
/opt/scripts/boot/

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L548

modprobe g_multi file=${boot_drive} cdrom=0 ro=0 stall=0 removable=1
nofua=1 ${g_network} || true

file=/dev/mmcblk0p1 (microSD partition)

Regards,


--
Robert Nelson
https://rcn-ee.com/

meierf...@gmail.com

unread,
Jun 13, 2017, 8:08:41 AM6/13/17
to BeagleBoard
Hi Robert,
i'm working with uname=3.8.13-bone79 and my /opt/scripts/boot/am335x_evm.sh has only 285 lines.
Can i use your linked .....avm335x_evm.sh (and insert after line#748 the 2 lines


modprobe g_multi file=${boot_drive} cdrom=0 ro=0 stall=0 removable=1
nofua=1 ${g_network} || true                                                              ) ?


Thanks a lot for all of your other helps !
Fritz 
Reply all
Reply to author
Forward
0 new messages