[Samsung Galaxy Nexus] chriv:
dd instead of flash_image

OK. This is late to the game, but I DID find a way to flash recovery from the device (if you have one like the Samsung Galaxy Nexus where flash_image will not work for you).

Well, I know now how koush's ROM Manager does it on my Galaxy Tab 2 10.1 (from /data/data/com.koushikdutta.rommanager/files/rommanager.sh):

echo 3 > /proc/sys/vm/drop_caches ; dd if=/sdcard/clockworkmod/download/download2.clockworkmod.com/recoveries/recovery-clockwork-touch-6.0.2.3-p5113.img of=/dev/block/mmcblk0p6 bs=4096 ; sync ;

The above, is, of course, specific to my GT-P5113 and must be run with root privileges. Don't even think about using that exact line on your device. Using dd to copy an image file to a block device is VERY dangerous. I will not be responsible for your bricked device (even if it is a GT-P5113). Don't come crying to me if you brick your device.

I don't have a clue why "3" is replacing the contents of drop_caches, and I don't know what the "sync" command does.

I do, however, know a little bit about dd (which is used to block-level copy "disks" or "images") from one to another:

if= designates the input "file", in this case CWMR Touch 6.0.2.3 for the Samsung GT-P5113.

of= is used to designate the output "file". In this case, it is not a file, but a block device that will be completely overwritten using a block-level copy of the infile. Be DAMN sure what you are copying to which block devices. Make a mistake here, and you might just PERMANENTLY hard-brick your device. Also, in the example above, partition 6 of mmcblk0 is the output "file".

bs= designates the block size, in bytes to copy at a time. In this case 4096 bytes, or 4KiB.

NEVER EVER EVER use dd to write to a block device or partition that is mounted! Always make sure the if and the of are mounted or not before using dd to block copy. You can do this easily by using either the "mount" program or the "busybox mount" applet. If either one is mounted, make sure it is safe to unmount them, then do it, then use dd.

I don't endorse this. It's much safer to pay Koush the $2 to flash it (CWMR Touch) for you (with ROM Manager and root access) than to risk getting the command wrong and bricking your device, wiping your data, or accidentally nuking a third-world country just by trying to save $2. But, at least you know it can be done with dd. If you are not a GNU/Linux / sh / bash / dd / su / adb expert, then please don't do it yourself. If you are such an expert, don't get cocky; be CAREFUL. This IS a possible way for you to flash your recovery partition from the device itself. It's also a possible way to turn your Android device into a doorstop.

If this helps you, please hit the Thanks button. If you are feeling especially generous, PM me and I'll allow you to donate to my paypal account. :)

P.S. This assumes you have a terminal app on your Android, have a working su binary/app combo, have a rooted device, and have busybox installed with sym-linked applets in your path. Terminal and superuser apps, the su binary, a good version of mount, a good version of dd, and a properly installed busybox are NOT standard equipment on most stock Androids. ;)