USB usages?(Ben)

Joshua Judson Rosen rozzin at
Thu Jun 9 17:00:53 EDT 2011

Werner Almesberger <werner at> writes:
> Stefan Schmidt wrote:
> > Using the usb storage gadget driver from the linux kernel will give
> > you the functionality to emulate a usb storgae device to the host.
> Okay, the block device export. I was afraid it would be that
> one :)

Don't be afraid...:

> > 3) The partitions must hold and filesystem that the host actually
> > understands. Speak fat32 or such if you want to connect it everywhere.
> > Thats quite a limitation if you want the same partition shared for
> > rootfs and usb storage emulation.
> Hmm, but can you have FAT32 on NAND with what's available in Linux
> today ? Even with the UBI block layer, it doesn't look as if this
> was something that would work out of the box

You don't have to export a partition--it's possible to use a regular file;
quoting linux-

            tristate "File-backed Storage Gadget"
            depends on BLOCK
              The File-backed Storage Gadget acts as a USB Mass Storage
              disk drive.  As its storage repository it can use a regular
              file or a block device (in much the same way as the "loop"
              device driver), specified as a module parameter.

              Say "y" to link the driver statically, or "m" to build a
              dynamically linked module called "g_file_storage".

So you can, e.g., create a VFAT filesystem in a file on the UBIFS/JFFS2/etc.
volume, and just export that file as a `mass storage device'.

"Don't be afraid to ask (λf.((λx.xx) (λr.f(rr))))."

More information about the discussion mailing list