A Novice’s Guide to Android Rooting, Recovery and Flashing

1
74
Modding Android

Modding Android

This is an introduction to customising Android (rooting, recovery and flashing), which is intended for those already acquainted with Android and wish to unleash the power of open source. We will cover more in the future, tailored to, and depending on, your feedback.

Android has turned out to be another revolutionary product from Google — but its strength stems from its being released as open source, which has led it to dominating the mobile OS market. The Android Market will soon top the Apple’s App Store in the number of apps.

Android is a bundle of the OS kernel, middleware, applications and a superb framework, which gives developers a chance to create superb applications with an unforgettable user experience. The Android architecture (Figure 1) has applications (that are available to end users) at the top; below that are a bed of managers (the package manager, notification manager, telephony Manager, etc).

The architecture of Android OS
Figure 1: The architecture of Android OS

Developers can use the framework, as well as systems resources based on local hardware, to create apps. Below this framework are libraries like OpenGL, WebKit and even database solutions like SQLite. All applications are written in Java. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The OS is a multi-user Linux system, in which each application is a different user.

Some basic terms

  • Boot-loader: Much like PC boot-loaders, this handles booting an OS from ROM (used instead of hard disc on PCs). It is also responsible for enabling flashing of new ROM images and other components.
  • Rooting: A new Android phone runs everything as an unprivileged user to avoid non-tech-savvy users messing it up. Rooting enables access to the superuser mode. You gain full control over the phone, and can optimise settings to boost battery life, etc, but the biggest advantage is that you can add customised ROMs (which is called “flashing”). It even enables you to control, at the baseband level, your phone’s telecom components.
  • ADB: The Android Debug Bridge (ADB) provides an interface/command-line access to the OS from your PC. It’s bundled with the standard SDK package.
  • CID unlocking: When ROMs are locked by carriers, CID unlocking is required to unlock them.
  • Custom Recovery Program: Custom Recovery mode is a command-line interface, available before your current ROM is booted. It allows you to do many things like flash a new ROM, partition your SD card, wipe the phone’s data and Dalvik cache, and more. It is a very powerful tool, but very dangerous if you don’t know what you are doing. The app, ROM Manager, available in the Android Market, gives you a nice interface with which to execute recovery commands from your phone, as well as installing a nice recovery image. Examples of custom recoveries include: Amon Ra Recovery, ClockworkMod Recovery, etc.
  • Nandroid or Nandroid Backup: Much like we back up OS images on PCs, Nandroid backs up an image of the phone’s current state, which can be used in case of errors like Boot Loop or ROM update failure.
  • Flash: Flashing is writing something over ROM, derived from the ancient way of flashing chips by fusing components on the chip. You often have to wait months for Android update releases due to complications at the manufacturer’s end; this enables you to get new releases running on your phone earlier.
  • Over-clocking: This refers to running processors at higher cycles per second than factory settings. Flashers generally use it for higher-performance processing or graphics. A simple way to test it is to view higher-FPS videos. Upgraded phones can run videos at 70 FPS or even higher.
  • Under-volted Over-clocked: Developers have been trying very hard to maximise battery life by reducing the voltage supply at lower processing speeds. By doing this, the power efficiency of Android devices can be improved. However, this technique is not used very often.
  • <Bricking: This refers to when your phone is rendered “dead” while rooting, flashing, or upgrading ROMs (which voids the manufacturer’s warranty). This is the biggest risk in customisation.
Warning: Rooting your device will nullify its warranty. In addition, performing these customisation procedures incorrectly may have unexpected consequences. Any such customisation is at your own risk! Get as much information from the many online sources as you can, before undertaking these procedures on your phone, because inadequate information may cause your phone to be bricked. Make sure you back up before doing any wiping of your phone.

Rooting

As explained already, rooting is necessary to get full control over the phone. You may have wondered how rooting can enhance battery life — it enables you to edit the kernel, and code changes at certain layers of the kernel can optimise your phone, resulting in greater battery life, faster performance and unlimited tweaking, depending on you how much you can play with it. While rooting opens the way to endless opportunities, it also opens the gate to a lot of potential problems, so be very careful and well-informed when doing this.

Possibilities after rooting your phone:

  • A Linux distro can be installed with Android.
  • You can run applications requiring super-user authentication.
  • You can install the latest Android updates, even when they are not available from the manufacturer.
  • You can enhance your phone’s capabilities — like turning your phone into a router, or enabling tethering to a PC/laptop to share Internet connectivity.
  • You can create backups, and enable the SD card as a target for installing applications.

Rooting isn’t rocket science. You just install a .apk like for any other application, though for specific phones, specific rooting software is recommended. However, these three are universal — SuperOneClick, Universal Androot and Z4Root. Figure 2 shows the rooted phone’s Add drawer, featuring Superuser.

Rooted Android
Figure 2: Rooted Android

Custom recovery

Custom recovery is equivalent to the BIOS of your computer. It provides access to basic low-level maintenance and recovery tasks. However, to gain full control over your Android phone, you need to wipe the stock recovery image, and flash a new recovery image to gain full control of your device’s administration. A custom recovery image allows you to perform the following tasks:

  • Wipe the phone’s factory settings and Dalvik cache.
  • Manage backups and recovery.
  • Install a custom ROM.
  • Enable logging.
  • Change your filesystem format.

You can see custom recovery settings in Figure 3.

Custom recovery
Figure 3: Custom recovery

To install a custom recovery image, you have to run certain commands via adb, like the following, where the image is first copied to the SD card, and then flashed over the stock image, which is ultimately wiped.

adb push c:image /sdcard/
adb push c:recovery.img /sdcard/
adb shell
su
mount -o remount, rw /system
cp /sdcard/flash_image /system/bin
cd /system/bin
chmod 777 flash_image
flash_image recovery /sdcard/recovery.img

Flashing a ROM

Before flashing, you have to have done rooting and custom recovery. Flashing completes your customisation. It is also device-specific; the Google Nexus S and Nexus One require bootloader unloading, whereas for others it can be skipped. There is a generalised set of steps to achieve flashing, which is given below.

You should choose a very reliable source for your ROM; you may have to do some research before you download a ROM!

  1. Download the chosen ROM zip file and transfer it to the SD card.
  2. Reboot the mobile and enter recovery mode.
  3. Back up current ROM status, software and data. This is the most important thing to do, as you may end up bricking your phone without it — and remember, there is no recovery from bricking! Nandroid recovery is the name of the recovery file.
  4. Now clear the factory settings and other data, and the Dalvik cache as well.
  5. Next, install the new ROM from the zip file on the SD card.
  6. Reboot, and your job is done.
Custom ROM booting up
Figure 4: Custom ROM booting up

Over-clocking

This is another step often used in customisation, to speed up the phone’s processing so you can play bigger and heavier games on your Android :-)

Feature image courtesy: Andrew Mason. Reused under the terms of CC-BY 2.0 License.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here