Hello Everyone,
In this post, I will provide the steps you need to take in order to prevent Clockwork or any custom recovery from being overwritten by factory stock-ROMs at system reboot:
DEFINITION:
Just like on a desktop computer, when you power on your Android device, several things happen before the system is loaded. These “things” take place in what is essentially the BIOS of the phone, tablet, etc.
On many desktop computers, you can tap a key on the keyboard immediately after powering on the PC to get into the hardware BIOS. This is where you can configure the boot order of various devices, set the system date and time, etc. The point is that the BIOS starts before Windows, Linux, etc. The Mac has a kind of BIOS also. Unlike the operating system of the PC, the BIOS is a tiny program stored on an actual chip inside the computer. While it is possible to change or flash updated versions of the BIOS on your desktop computer, many people don’t bother as, in recent years, it really isn’t necessary. But, it can be done.
Your Android device also has a BIOS that runs before the devices operating system starts; only on a mobile device the BIOS is called the boot loader; and within the boot loader is the system recovery program. All mobile devices have a system recovery program including iOS devices. As on the desktop computer (or notebook for that matter) the system recovery is a tiny program that is stored on a chip inside the device, itself.
Unlike on many computers where tapping a key such as F10 will open the BIOS, there is no standard key combo for mobile devices. Each model has its own key combo in order to bring up the boot loader interface. For example, on the Nexus S i9020, you power on the phone while holding the volume up button until the boot loader is displayed. Once inside the boot loader, you select the recovery option which brings up the installed system recovery program.
What is meant by the stock recovery is that it is the recovery program (BIOS) installed by the wireless carrier or manufacturer of the device. Even if you purchase a pure Google device, stock recoveries are extremely limited. This is on purpose in order to prevent, among other things, accidental bricking of the phone.
What is meant by the stock operating system is that it is the operating system installed by the wireless carrier or manufacturer of the device.
The boot loader will never change on your device. It is simply a menu system that allows you to reboot the system, get device info and launch the system recovery program. All you can do with the actual boot loader, itself, is either unlock or lock it.
PROBLEM:
So, in order to do some really cool stuff on your phone or android mobile device, the first step is to unlock the boot loader. This is simple enough but keep in mind that doing so will erase all of your user information. (In effect, it resets your device to the factory settings. The good news is that you only need do this once.
How to unlock the boot loader is beyond the scope of this post but it is very simple.
How to install (flash) a system recovery other than the one that came preinstalled on your device is beyond the scope of this post.
So, you’ve unlocked your boot loader and you have installed a different (more robust) system recovery program, such as Clockwork, on to your device.
Keep in mind that at this point, you are still using the original stock operating system that came preinstalled on your device. All you have done is install a new system recovery. Why would you do this? Because among other things, you can now make system backups and restores on the device itself.
So, you’ve just installed the new system recovery and all is well. Then, as you must do, you reboot the device and allow it to start up in your stock operating system. Next you power off the device. Finally, you initiate the boot loader command again and attempt to launch your new system recovery program only to discover that the original stock system recovery has been restored. No, you’re not crazy and you didn’t do anything wrong. Many stock ROM/operating systems actually reflash the original system recovery on your device at system startup. This is an attempt to provide added security, or so they say.
Unless you resolve this little glitch, you will have to install a new system recovery just before installing a new custom ROM/operating system such a Cyanogen. Also, having to reinstall a system recovery each time you want to use it kind of takes the fun and efficiency out of things especially should you need to restore your device to a known state.
SOLUTION:
The reason your stock recovery system keeps getting overwritten at Android startup is because of a script that is being run. All you need to do is either rename this script or simply delete it.
Please keep in mind that if you restore your stock ROM, this script will be restored with it so you will have to rename or delete it again. Do the following:
1.
Make sure your device is powered on and running normally,
2.
Make sure you have rooted your device and that you have all of the necessary permissions in order to manipulate system files.
3.
In the root file system go to \system\etc
4.
Find the file named install-recovery.sh and either rename it or, as I did, delete it.
That’s all there is to it.
Please keep in mind that you will need to flash your custom system recovery one more time after modifying the script file. After that, reboot away and you will always be able to get back into your new system recovery.
Good Luck and Happy Tweaking.
Mark