With the final touches going onto R1.4 before it gets given to QA to tear up, the number of builds taking place per day has increased a bit. I prefer to test the changes that get made, so I'm regularly flashing my bug sd card. I was presented with a minor problem/challenge today: I had left my SD card reader at home and needed to get a new build running on my development bug.
The solution: Don't ask the guy/lady sitting next to you if you can borrow his/her card reader. Instead, use the bug to flash its own rootfs. If you're a pompous detractor, naysayer, or kernel/filesystem elitist you might be turning your nose up at this suggestion. Resist the negativity and think about it for a second. Everything the bug needs to get this done (kernel, drivers) will be loaded into memory and removal of the old rootfs would go mostly unnoticed. Here's how to get it done:
Unsnap all modules, plug in the AC adapter and ssh into your bug via USB, or get on the serial console if you have a Handylink cable. I personally would kill concierge/cvm before proceeding but its not entirely necessary, I just like to have less things to blame when something goes wrong. At the prompt enter the following:
root@bug~# rmmod g_ether && modprobe g_file_storage file=/dev/mmcblk0
This will kill your ssh session and turn your bug into a USB mass storage device. If you do a dmesg on your host pc, you should see it get enumerated/recognized. On my machine, it comes up as /dev/sdb with one partition at /dev/sdb1. Just like an SD card reader...
You can now dd your rootfs ext3 images onto the bug's partition in the same way you would with an SD card reader, per these instructions: http://bugcommunity.com/wiki/index.php/Update_your_BUG_memory_card. It takes a bit longer than the card reader so be patient. Once its done run e2fsck and resize2fs on the partition. Once that completes unplug the USB cable and power down the bug. Power it back on and enjoy your new rootfs.
Mandatory disclaimer: The naysayers are partly right here. Lots of things can go wrong with this. If you bother the bug/try to use it while flashing, things are likely to go bad. There's little to fear though: the worst that can happen is that your SD card will get corrupted, and you'll have to reflash the card with an actual card reader. So plan on having one handy just in case. I should emphasize that your bug can *not* be bricked by doing this.
Try it, you might like it...