BeagleBone and multi boot usb

This really should have beagleboard@googlegroups.com in cc. I don’t feel like waiting for you to do the right thing, so I’m just replying with you in bcc.

Hey Jason,

Hope you are safe and doing well.

Wondering if the BeagleBone Green or other variants can act as a usb host and client at the same time.

On 2 separate ports, yes. The USB specification itself does not support multi-master. Man, makes me miss IEEE-1394 every time.

I.e. connect USB flash drive to beagle bone, and have the beagle bone act as a larger flash drive when plugged into a client?

Sure. You can have the BeagleBone act as a USB storage device and you can add intermediary layers that perform transactions on other devices, including a USB host port.

https://hackaday.com/2013/07/02/usb-sniffing-with-the-beagleboard-xm/ shows one proof-of-concept (done as a Google Summer of Code project under BeagleBoard.org mentorship).

I’d suggest you also look at https://github.com/microsoft/uf2-linux to see the way they used network-backed block device (NBD) to create a daemon that listens for the block accesses. This can be pretty tricky, but you can fake all sorts of storage handling in-between.

The use case is a multi boot USB tool - throw a bunch of ISOs on the BB and select which one you need, plug it in and boot the machine!

When structuring such a support e-mail, I always suggest with starting with what you are wanting to accomplish FIRST:

  1. what you want to do
  2. what you tried
  3. what you expected
  4. what you actually got (and why it isn’t what you expected, if you know)

Nice guide on smart questions: http://www.catb.org/~esr/faqs/smart-questions.html. I don’t think you researched this one much. Anyway, it is still something useful to get out to searchable land.

If you have a right way to control the UI, the files on your target disk, and the target disk is already mounted when you connect to your host, this is actually pretty trivial. You’d simply set the backing store of your of your gadget ahead of making the connection. USB ConfigFS makes this pretty easy.

Here’s an example that configures the default USB flash drive on Beagle Debian images (https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L458-L465):

echo “${log} enable USB mass_storage ${usb_image_file}”
mkdir -p functions/mass_storage.usb0
echo ${usb_ms_stall} > functions/mass_storage.usb0/stall
echo ${usb_ms_cdrom} > functions/mass_storage.usb0/lun.0/cdrom echo ${usb_ms_nofua} > functions/mass_storage.usb0/lun.0/nofua echo ${usb_ms_removable} > functions/mass_storage.usb0/lun.0/removable
echo ${usb_ms_ro} > functions/mass_storage.usb0/lun.0/ro
echo ${actual_image_file} > functions/mass_storage.usb0/lun.0/file

The ${actual_image_file} would need to point to the .iso on your target storage file system.

See: