Christian Adams wrote:
> moinmoin
>
> there is no "must" for using /dev/mmc* .. you could also use a plain  
> file:
>
> preparations:
>
> create mem_stick.fs file
> dd if=/dev/zero of=mem_stick.fs bs=512 count=1048576 # for a 512mb  
> "memory-stick" with blocksize=512 bytes
>
> create filesystem on mem_stick.fs:
> mkfs.ext3 mem_stick.fs
>
> from FR you can mount this filesystem with:
> mount -o loop mem_stick.fs some_mount_point
>
> and for exporting via usb:
>
> rmmod g_ether
> # if mount -> umount!
> modprobe g_file_storage file=mem_stick.fs
>
> regards, morlac
>
>   
>> On Fri, Sep 5, 2008 at 4:41 AM, Dale Maggee  
>> <[EMAIL PROTECTED]> wrote:
>>     
>>> Petr Vanek wrote:
>>>       
>>>> I have spent a while googling this up and have no wiki skills but
>>>> someone might find this useful:
>>>>
>>>> to make FR act as a memory stick, here is what my script does:
>>>>
>>>>
>>>> #!/bin/sh
>>>> /etc/init.d/networking stop
>>>> rmmod g_ether
>>>> modprobe g_file_storage file=/dev/mmcblk0p1
>>>>
>>>> --
>>>> Petr Vaněk
>>>> http://biodynamika.cz
>>>>
>>>>         
>>> very cool, but before I test it out (potentially breaking my usb
>>> networking in the process), I have a couple of questions:
>>>
>>> 1. will this persist over a reboot, or will it revert back to  
>>> being an
>>> ethernet gadget when I reboot?
>>>       
>> It's not persistent unless you add something like this to the init
>> scripts. After rebooting the ethernet gadget will be back.
>>
>>     
>>> 2. is the following sufficient to switch it back?
>>>
>>> #!/bin/sh
>>> rmmod g_file_storage
>>> modprobe g_ether
>>> ifup usb0
>>>
>>> (assuming I replaced '/etc/init.d/networking stop' with 'ifdown  
>>> usb0' as
>>> recommended by Daniel)
>>>
>>> 3. can somebody point me to a resource for the g_file_storage module
>>> where I can learn more about it? I did a couple of quick googles but
>>> didn't see anything promising. specifically I'd like to know more  
>>> about
>>> the file parameter - I assume that in this scenario our "usb  
>>> stick" is
>>> using partition/device information from /dev/mmcblk0p1, and will be
>>> partitioned in the same way as the SD card? what If I wanted to  
>>> have my
>>> home directory accessible in "usb stick" mode?
>>>       
>> I suggest to read the comment in the source code, it's quite detailed:
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/ 
>> linux-2.6.git;a=blob;f=drivers/usb/gadget/file_storage.c;hb=HEAD
>>
>> The file parameter determines the raw backing store for the storage
>> device, so if you
>> have file=/dev/mmcblk0p1, its contents will directly appear as
>> /dev/sdx on the host. As mmcblk0p1 doesn't contain a partition table,
>> so won't sdx. If you want to export the whole device, use
>> file=/dev/mmcblk0, you'll get the partition table in /dev/sdx and the
>> kernel will parse it and create /dev/sdx1 (containing the contents of
>> /dev/mmcblk0p1) etc.
>>
>> The host has direct access to the block device, so it is important
>> that /dev/mmcblk0p1 is not mounted on both the phone and the host at
>> the same time (unless it's mounted ro on both).
>>
>> regards
>> Philipp
>>
>>     
>
>   

Thanks for the info! very usefull indeed!

I made a script as follows (echo's are for debugging):

#!/bin/sh 
echo ifdown usb0...
ifdown usb0
echo rmmod g_ether...
rmmod g_ether
echo umount /media/card...
umount /media/card
echo modprobe g_file_storage file=/dev/mmcblk0p1...
modprobe g_file_storage file=/dev/mmcblk0p1

only problem is, when i run this in the 2007.2 terminal, it echoes 
'umount /media/card', and then totally freezes the freerunner! (to the 
point ofhaving to unplug the battery and reboot)

if i comment out the offending line in the script, then type 'umount 
/media/card', then run the script, it works fine...

thoughts?

Thanks,
-Dale

_______________________________________________
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community

Reply via email to