In previous blog posts I’ve talked about booting the Samsung Galaxy Nexus from ClockworkMod recovery. This is a third-party open-source application that is very useful for performing system maintenance on an Android phone.
Personally I just manually boot the phone from a CWM image whenever I need to, but a few people have asked me if it’s possible to overwrite the stock Android recovery partition with CWM.
The answer is yes you can, but by default Android is set to automatically flash the stock-recovery on every boot. So as soon as you reboot CWM will be overwritten. We need to stop that happening, which luckily is easy enough to do. We just need to move two files out of the way.
First, from the bootloader flash CWM to the recovery partition and then boot into CWM.
# fastboot flash recovery recovery-clockwork-18.104.22.168-maguro.img
# fastboot boot recovery-clockwork-22.214.171.124-maguro.img
Now move both /system/recovery-from-boot.p and /system/etc/install-recovery.sh to a different location so they do not get executed. I recommend just renaming them to .bak. Some people say to delete them, but I prefer to make non-destructive modifications that I can undo.
$ adb shell mount /system
$ adb shell mv /system/recovery-from-boot.p /system/recovery-from-boot.p.bak
$ adb shell mv /system/etc/install-recovery.sh /system/etc/install-recovery.sh.bak
$ adb shell umount /system
$ adb reboot
And that’s it. You now have CWM installed permanently. Do bear in mind if you are running an otherwise-stock release of Android you will now no longer be able to install OTA updates since they require the stock recovery system in order to be installed.
If you decide you want to go back to the stock recovery system, then just rename those two files back again (remove the .bak) and reboot the phone.