$%@##$&^#$#$%#$ web interface.... sorry about that last email....

 
Hi Craig,
 
The file underlying the loop device was on the flash.
It does now seem to work, having moved to using /tmp.
I also suspect that part of the problem was with using a disk which was too small - 4 Mb. The disk which I now have working on /tmp is 32Mb in size. Handily, a formatted version of this fits easily into the compressed filesystem, which makes it easy to copy across the drive on boot up.

I also did as you suggested, and formatted the file from windows, as the gadget does export the raw device.
We couldn't find a gadget which forwards the gumstix file system, but I think that this solution is better, as it prevents people from accidentally overwriting something on the gumstix.
 
So, should anyone else want to set up the gumstix as a filestorage gadget, and be able to write into memory area so that it can be read off the gumstix via USB...
 
1. Create a file to represent the file system, as per http://www.linux-usb.org/gadget/file_storage.html . Make it a decent size.
2. Load the file storage and loop modules
    # modprobe loop
    # modprobe g_file_storage removable=y
3. mount the file to the gadget interface as rw
    # echo $FILENAME > /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/file
4. Format it in windows. (I've noticed that it takes 2-3 minutes for windows to pick up the gumstix - not sure why)
5. unmount the file
    # echo  > /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/file
6. now, mount the file on the gumstix loopback device, as per the filestorage page, ie
    # losetup -o 4096 /dev/loop0 $FILENAME
    # mount -t vfat /dev/loop0 /mnt/loop0
7. Set it RO from the gadget
    # echo 1 > /sys/devices/platform/pxa2xx-udc/gadget/gadget-lun0/ro
the gumstix can now write to this file to its hearts content. For the contents to be updated on the file storage gadget, just load and unload it using the echo commands above. 
 
Thanks for your help,
 
Stuart
 
On 11/4/05, Craig Hughes <craig@gumstix.com> wrote:
On Nov 4, 2005, at 9:27 AM, Stuart Bass wrote:

I seem to be having problems though in setting up the fat file system on both ramdisks and loop back devices, onto a file in the flash memory (presumably because they are very similar.
I can mount, read and write these when they are formatted as ext2, but when formatted as FAT i get a bunch of buffer I/O errors, ie:
 
# umount loop0/
Buffer I/O error on device loop0, logical block 41
lost page write due to I/O error on loop0
 
Buffer I/O error on device loop0, logical block 1
lost page write due to I/O error on loop0
 
Buffer I/O error on device loop0, logical block 3
lost page write due to I/O error on loop0
 
Buffer I/O error on device loop0, logical block 5
lost page write due to I/O error on loop0
 

 
Where is the file which underlies /dev/loop0?  Is it on the gumstix flash?  Or on a removable MMC or CF card?  Or in /tmp?  What happens if you create the file, point the gadget at it, then plug the gumstix into a window box, and format the "file" there?  ie create the partitions and filesystem from windows, rather than natively on the gumstix -- I'm assuming that the gadget essentially exports a raw device, so that this would work.

The loop device file (in this example) was created as per the directions at http://www.linux-usb.org/gadget/file_storage.html .
 
The ramdisk is formatted using the command mkdosfs -S 1024 /dev/ram0

Rather than using a ramdisk, I think if you want the thing to be in RAM, the better way would be to just use a loopback file located under /tmp, which is in RAM.

 
Another alternative is that I think there's another gadget device (forgot the name) which allows the gaget's own filesystem to show up on the USB host -- or am I misremembering that?

 
C