Replace Recovery Partition

From Android Wiki

Revision as of 09:10, 31 January 2013 by Ldo (Talk | contribs)
Jump to: navigation, searcha


Flashing edited recovery partition to your G1

A user on XDA-Developers has created a replacement recovery image that can be flashed onto the recovery partition that will block OTA updates from being applied, but will still allow custom signed updates to be flashed


1: download the replacement recovery image rename it to .zip and unzip it to your sd card.

Simplified auto-install instructions

This is (so far) unproven to work (meaning I have not talked to anyone who has done this, it sounds logical and worth a try).

  1. copy the file /system/recovery.img to your sd card (as a backup)
  2. place the file "recovery.img" in /system (replacing the one you just backed up with the one you downloaded)
  3. reboot

It was said that this file is automatically flashed onto the recovery partition each time you reboot (during shutdown or boot??) which saves you from having to manually flash it. It would be a good idea to then boot into recovery to make sure you are using the modified version (which should say "using test keys")

Instructions pasted from forum post on and still needs editing

The recovery image (recovery_testkeys.img) uses the test keys that are distributed with the android platform source. This means that an OTA update or an update must be signed with the test key in order for it to install. In other words, it will no longer install OTA updates from t-mobile. You don't want them stealing back root access from you now do you? .

I've also included the test keys and the SignApk.jar tool, so you can sign your own update scripts (for use only with the modified recovery image). You can resign any image, even if it has been signed before. So for example, if you needed to install an "official" t-mobile update, you must re-sign it with the test keys first.

Another bonus in this recovery image is that ADB is enabled while in recovery mode. You can't adb into a shell (no sh binary), but you can at least use it to push and pull files from the device. For example, you could push an file to the sdcard.

The boot image (boot_nosecure.img) has been modified so that adb has root access by default. So when you do an adb shell, you automatically get a root shell. You can remount the system image using adb, and then push files directly to the system partition.

Finally, the "update - Restore Original RC29 Boot" file is an file signed with the test keys, which will restore your boot partition back to the stock RC29 image. Useful if you accidentally hose your boot partition..

To install the recovery image onto your phone:

D:\Android\AndroidMod>adb push recovery_testkeys.img /data/local/recovery.img
912 KB/s (0 bytes in 1767424.001s)

D:\Android\AndroidMod>adb shell
$ su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock2 /system
mount -o rw,remount -t yaffs2 /dev/block/mtdblock2 /system
# cd /system
cd /system
# cat /data/local/recovery.img > recovery.img
cat /data/local/recovery.img > recovery.img
# flash_image recovery recovery.img
flash_image recovery recovery.img

Note: You must place the recovery image at /system/recovery.img. the init.rc boot script automatically flashes the recovery partition with that file every time you boot up the phone.

At this point, it's probably a good idea to reboot the phone into recovery mode, and make sure it loads OK. If the recovery image is corrupt somehow, it will throw you back into SPL mode (the multi-color bootloader screen). If that happens, just boot the phone normally, and reflash recovery image.

Once it boots into recovery mode, press alt+L, and the next to top line of text should say something like "using test keys.". If it doesn't, then you're still using the original recovery image.

Now that you know you have the modified recovery image loaded, you can install the boot image:

D:\Android\AndroidMod>adb push boot_nosecure.img /data/local/boot.img
939 KB/s (0 bytes in 1533952.001s)

D:\Android\AndroidMod>adb shell
$ su
# flash_image boot /data/local/boot.img
flash_image boot /data/local/boot.img
# rm /data/local/boot.img
rm /data/local/boot.img

Now reboot the phone and let it boot normally. If the boot image was corrupted, it will boot into recovery mode instead. You can use the included update zip file to reload the original RC29 boot image.

Otherwise, if it boots up normally, open a command prompt however you like (telnet, adb, terminal emulator app, etc.) and type "getprop". If it says 0, then you're running the modified boot image. Otherwise, if it says 1, you're still running the original boot image.

Personal tools