Features Download
From: Craig Hughes <craig <at> gumstix.com>
Subject: Re: replacing a file system image - questions
Newsgroups: gmane.linux.distributions.gumstix.general
Date: Wednesday 25th January 2006 21:58:45 UTC (over 11 years ago)
On Jan 25, 2006, at 9:10 AM, Michael Taylor wrote:

> Works like a charm.  I'd think the reset at the end would be the  
> preferred way to go for as long as it works, with the longer  
> timeout being the next best thing.  I'm not sure how to detect the  
> RTC frequency issue if it occurred.  Is there a way to test for the  
> frequency problem?  I'm planning to use the wdt soon enough, so I  
> suppose I will hit this one head on in the next month.

So I had a bit of a productivity boost today as a result of merging  
this thread and the one about the g_file_storage USB gadget which I'd  
been meaning to try out.  It used to be that when developing on my  
mac laptop/fast server for compiles setup, I'd be ssh'd to a  
buildroot on my big fast server from my mac laptop, with a gumstix  
serial console hooked to a USB-to-serial converter, with a ckermit  
window running on the mac.  I'd build something on the buildroot, scp  
it to the mac, then use sz/rz under ckermit to transfer the file to  
the 'stix at a blistering 8k/s or so.  That's miserable when dealing  
with root_fs images, and leads to lots of 5 minute delays while data  
tries to move at 115200bps.  I've tried messing with CDC ethernet  
drivers under OSX to create a usbnet link twixt gumstix and mac, but  
it just doesn't work right.  So, I just built the g_storage_file  
gadget, installed on the gumstix, and loaded it.  A couple tips below:

1. The mac doesn't see the USB device at all (no events, no device  
showing up on the USB bus, nothing) if you do
# modprobe g_file_storage file=/dev/mmcblk0

when linux already knows about /dev/mmcblk0 (ie you load pxamci  
*after* the MMC card is inserted)


gum# modprobe g_file_storage removable=1
gum# echo /dev/mmcblk0 > /sys/devices/platform/pxa2xx-udc/gadget/ 

and the drive pops up on the mac!  I now scp from my server into the  
mac-mounted MMC drive.

Gotcha #2: when you eject the drive on the mac, it goes away, then 2  
seconds later, it remounts!


gum# while ! echo > /sys/devices/platform/pxa2xx-udc/gadget/gadget- 
lun0/file;do continue;done
[and now eject on the mac]

now the eject "sticks", since the "file" param of the gadget device  
will get nuked as soon as the driver says it's not in use, at which  
point "echo" returns true, and the while loop exits.  I have no idea  
if the eject-immediate-remount thing is mac-only and/or expected  
behavior; it'd be nice to not have to use this loop btu to just be  
able to eject on the mac;echo > .../file on the gumstix, without  
having to do this loop race thing.

Ok, so now I have a root_fs_arm_nofpu file on the MMC card in the  
gumstix.  Next:

gum# mount /mnt/mmc
gum# cd /mnt/mmc
gum# mount -o remount,ro /
gum# modprobe sa1100_wdt margin=1
gum# echo          [to make sure this gets cached in RAM]
gum# flashcp -v root_fs_arm_nofpu /dev/mtd1
gum# echo > /dev/watchdog

Badabing!  It worked!  One improvement here would be to have an arg  
to flashcp which writes a byte to dev/watchdog then closes the file  
after it's done successfully writing the new fs, so that there isn't  
that fear of having the final echo command say "echo: command not  
found." and then being hosed.


This SF.net email is sponsored by: Splunk Inc. Do you grep through log
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
CD: 3ms