OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Angstrom & OpenZaurus => Topic started by: obergix on June 15, 2005, 03:13:27 am

Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: obergix on June 15, 2005, 03:13:27 am
Hi guys.

With the Sharp rom, we're able to access the SD or CF cards in the Z as usb mass-storage drives from a computer connected to the Z.

Is it also possible when the Z is running OpenZaurus (3.5.3 here) ?

If yes, any pointer to a howto would be great

I know I could do mostly the same if I had networking working between both units, through scp, samba or anything else... but networking with usbnet is actually broken at the present time (linux kernel 2.6.11, etc.)

Best regards,
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: Hrw on June 15, 2005, 05:45:19 am
which Z?

on c7x0 with 2.6.x kernel you have to upgrade kernel to newer 2.6.11 release which have USB gadget modules modularized. Then all what is needed is "modprobe g_file_storage WITH_I_DONT_REMEMBER_OPTION=/dev/hda" for CF card and /dev/mmcblk0 for SD
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: obergix on June 15, 2005, 05:23:52 pm
Quote
which Z?
SL-C1000

Quote
on c7x0 with 2.6.x kernel you have to upgrade kernel to newer 2.6.11 release which have USB gadget modules modularized. Then all what is needed is "modprobe g_file_storage WITH_I_DONT_REMEMBER_OPTION=/dev/hda" for CF card and /dev/mmcblk0 for SD
[div align=\"right\"][a href=\"index.php?act=findpost&pid=84309\"][{POST_SNAPBACK}][/a][/div]

I'm using OZ 3.5.3, so Kernel 2.4.20 at the present time... but maybe the 2.6.11 is ready for the 1000 ? I'm gonna check...

Thanks anyway for the answer.

Best regards,
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: lardman on June 16, 2005, 05:10:16 am
Quote
I'm using OZ 3.5.3, so Kernel 2.4.20

The source for storage_fd should be in the kernel code, it just may not have been built - have a look in the machine feed and see if it's there.


Si

P.S.

You may be able to use the storage_fd.o module from a Sharp ROM (with the same kernel version) directly (but this is not ideal and it may not work due to missing symbols anyway).
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: obergix on June 17, 2005, 02:29:55 am
Quote
Quote
I'm using OZ 3.5.3, so Kernel 2.4.20

The source for storage_fd should be in the kernel code, it just may not have been built - have a look in the machine feed and see if it's there.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=84485\"][{POST_SNAPBACK}][/a][/div]

Thanks for the info.

The module was available in a package, that I've then installed.

Had to do an insmod -f (tainting the kernel)...

But not working :
insmod: init_module: storage_fd: Invalid argument

excerpt from dmesg :
Code: [Select]
wifi0: LinkStatus: BSSID=02:00:92:2f:97:00
storage_fd: storage_fd 0.1 035 2002-06-12 20:00 (OUT=64,IN=64)
storage_fd: vendorID: 4dd productID: 9050
storage_fd: usbd_register_function failed.

Dunno... maybe a problem with the cable, etc.

Any clue ?
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: lardman on June 17, 2005, 05:40:16 am
Quote
Any clue ?

Did you try a search for storage_fd.o??

The module still needs to know which of the devices it is to use for mass storage.

This script of mine (from long ago, repeated a fair few times on this forum, should do the trick for you):

start_storage.sh:

Code: [Select]
#!/bin/sh
# change the next line if you want SD rather than CF
umount /dev/hda1
/sbin/rmmod pxa_bi
/sbin/rmmod net_fd
/sbin/rmmod usbdcore
/sbin/insmod /lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/usb/device/usbdcore.o
/sbin/insmod /lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/usb/device/storage_fd/storage_fd.o storage_device=/dev/hda1
# change /dev/hda1 to /dev/mmcda1 or whatever if you want
/sbin/insmod /lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/usb/device/bi/pxa_bi.o shortpacket=1 recvpacket=256

Obviously your kernel version is different so change the paths accordingly, I'm also not sure whether the shortpacket, recvpacket settings are needed/correct for your Z.

Do a search for start_net.sh to get back to normal functionality.


Si
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: obergix on March 27, 2006, 04:32:39 pm
Quote
which Z?

on c7x0 with 2.6.x kernel you have to upgrade kernel to newer 2.6.11 release which have USB gadget modules modularized. Then all what is needed is "modprobe g_file_storage WITH_I_DONT_REMEMBER_OPTION=/dev/hda" for CF card and /dev/mmcblk0 for SD
[div align=\"right\"][a href=\"index.php?act=findpost&pid=84309\"][{POST_SNAPBACK}][/a][/div]

Seems to me that the option is file= (http://www.linux-usb.org/gadget/file_storage.html)

However, I've tried that on 3.5.4.1-alpha1 (file=/dev/hda1), and didn't work well... lots of errors...

I hope I didn't screw the CF card :/

Anyway, hope this helps.
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: SimedonMyrrho on March 29, 2006, 06:42:20 am
I also have some problems with g_file_storage.

I use the command

Code: [Select]
modprobe g_file_storage file=/dev/hda
for both my 256 MB compact flash card and my IBM 340 MB microdrive, which both have a fat partition.

I tried 3.5.4 and 3.5.4.1.

I tried to mount them under Linux (2.6.16-ck1) and under win2k.

The compact flash card works, after some time (about 1 minute). The card is recognized as Linux File Storage, the fat formatted drive is recognizd and usable under win2k just like a normal usb stick.

The microdrive does not work like the flash drive. Neither Linux, nor win2k detect the partition, only the drive is recognized, either als Linux File Storage or as sdb. So with g_file_storage the microdrive is not usable. Of course it can be mounted under OZ 3.5.4 and 3.5.4.1, and i can install ipkgs from it.

I even tried to make a ext2 partition on the microdrive, then make a file on that partition, and make a partition inside that file, formatted it and then used this file as the parameter for g_file_storage. It also did not work.

The listing for the latter:
Code: [Select]
mkfs.ext2 -m 0 /dev/hda
mount /dev/hda /mnt
dd if=/dev/zero of=/mnt/store bs=1M count=340
fdisk /mnt/store
modprobe g_file_storage file=/mnt/store

Maybe some devs may take a look at it. Probably a newer kernel (2.6.16) is a solution for problems like these. I have read somewhere (lkml or so), that in 2.6.16-mm1 there are some bugfixes for the gadget devices. Unfortunately there is not much information on this topic out there, the file storage gadget howto is a good source of information, but there are no solutions for problems like these.
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: lardman on March 29, 2006, 08:14:00 am
Quote
mkfs.ext2 -m 0 /dev/hda

No partition?

Si
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: Da_Blitz on March 29, 2006, 07:55:40 pm
to look up arg names for modules modinfo <module name> can come in handy
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: SimedonMyrrho on March 30, 2006, 06:16:03 am
@lardman

Quote
No partition?

Yes, no partition. All i wanted was a logical drive where i can create the file i would be using as a backup for g_file_storage on. So i decided to create a superfloppy. Win probably does not like it, but oz did not have a problem mounting it.

Quote
to look up arg names for modules modinfo <module name> can come in handy

Thanks, i wasn't aware of that. All i did was looking into the source code file on my gentoo box, where i did find some of the parameters one can give to g_file_storage gadget.

BTW, I use a C860, which has 2 bad eraseblocks, if that matters.
Title: How To "mount" Cards As Usb Mass-storage With Oz
Post by: SimedonMyrrho on April 29, 2006, 08:38:53 am
I finally got it working with my microdrive.

The new kernel 2.6.16 in oz-3.5.4.1-rc1 did the trick. I takes some time until windows recognizes the drive, but some seconds ago i finished a download to the drive, and no errors whatsorever.

The microdrive is partitioned as usual. One partition, with one logical drive in it, formatted with fat32.

The modprobe command is the usual one
Code: [Select]
modprobe g_file_storage file=/dev/hda
Thanks for providing an OZ with this new kernel.