How to: Rooting your Nexus One - a definitive guide to what’s involved
So what is rooting anyway? Rooting means gaining access to your phone as the root user. Just like on Linux or Unix the root user is the superuser, or administrator on Windows and has unrestricted access to the system files to install new software etc. Logging in as root is not in itself dangerous, but often comes with the ‘with great power comes great responsibility’ warning because the root user has permission to overwrite and delete system files.
Why should I care? Rooting a phone allows you to install modified versions of Android which can have new features and software configurations not available in the official branch. You might for example want to install Flash on the Nexus One before it becomes available via an official update, or enable full memory usage to speed up performance. With root user access you have full control over all your system files just as you would on a desktop computer. With root access, custom ROMs (read-only system software packages) can be flashed (witten via USB) onto your phone, meaning that you can run modified versions of Android.
What are the downsides?
Rooting your phone requires unlocking the Bootloader which voids the warranty. This is due to the terms of Google’s hardware support agreement with HTC. This action is permanent and currently irreversible, and will display an unlocked padlock during the boot cycle indicating that the device has been unlocked. It also means that future over-the-air updates may not be automatically installed especially if you’ve made changes to the recovery image on the phone.
You’ll still be able to install new software of course, but you’re likely to have to manage future updates and installs manually. So it’s not for everyone. But Android is about putting choice in the hands of the user. So if you want to try out other versions of Android on your phone, and don’t mind leaving the official Android branch then rooting is for you.
A bit of background
If you’ve decided that you want to root your phone then it’s worth familiarising yourself with some basic concepts. Whilst this isn’t all necessary for gaining root access it’s a good idea to understand a bit about what’s going on at a lower level, rather than just following a list of essential instructions. The knowledge will also come in handy later when you want to flash your newly unlocked phone with a customised ROM.
The NVRAM on Android phones is divided into the following six partitions. Once you have root access to your Nexus One it’s these partitions that you’ll be accessing to flash custom software. In most cases it’s only the /boot and /system partitions which get replaced when putting a new system on the phone but here’s a list of all the partitions and what they’re for.
- /misc - a miscellaneous partition
- /recovery - the recovery partition, used when the phone is booted into recovery mode for making changes, installing new software
- /boot - the boot partition containing the kernel and initial boot ramdisk
- /system - this is where all of the system software (ROM) resides
- /cache - cache data. This is wiped when you factory reset the phone
- /userdata - applications, login info and user settings. This partition is wiped when you factory reset the phone
Accessing your phone via the command line
To control your phone via USB you can use ADB (Android Debug Bridge) and Fastboot, which are command line programs included with the Android Software Development Kit. Whilst Fastboot can be downloaded separately, it’s worth installing the full SDK, especially if you’re running Windows as it also includes all the necessary USB drivers. Once you have these programs installed you can then plug your phone into your computer via USB and issue commands from your computer’s command line. For this to work you need to make sure that USB debugging is enabled on the handset which can be accessed via Settings => Applications => Development => USB debugging [checked].
Android Debug Bridge
ADB is a tool which let’s you manage the state of an Android powered device. Here’s a list of some useful commands:
- adb devices - Gives a list of all connected devices. A good way of checking that your phone is connected to your computer.
- adb reboot - will reboot your phone
- adb reboot bootloader - will reboot your phone into the bootloader (A white screen with skating Androids)
- adb reboot recovery - will reboot your phone into the recovery console
- adb shell - will give shell access to explore your phone’s file system
- adb remount - remounts the system partition on the phone
- adb push x y - will push file x from your computer into y location/file on your phone (root access required).
- adb pull x y - will pull file x from your phone into y location/file on your computer (root access required)
Fastboot
Fastboot is a command line tool used to update the filesystem in Android devices from your computer via USB. The operation of overwriting partitions is commonly referred to as ‘flashing’ and allows unsigned partition images to be written to the phone. Depending on what operating system you are running the fastboot command will be either fastback-windows, fastboot-mac or fastboot-linux. We’ll simply use fastback in our instructions which you should substitute with the appropriate command for your operating system:
- fastboot devices - Similar to the adb devices command, gives a list of all devices connected to your computer. A good way to check that your phone is connected.
- fastboot reboot - will reboot your phone normally
- fastboot reboot-bootloader - will reboot your phone into the bootloader
- fastboot oem unlock - this will unlock your bootloader (and void your Nexus One warranty and delete all personal data from the phone via factory reset)
- fastboot erase x - Will erase the partition x. An easy way to factory reset your phone via the command line eg. fastboot erase userdata
- fastboot flash x y - This will flash the x partition with the y image eg. fastboot flash system system_mod.img will replace your current system partition with the system_mod.img
Rooting - 1. Unlock the Bootloader
With all that introduction out of the way, the process of rooting your phone is relatively simple. Once you’ve installed the Android SDK and connected your phone via USB you can simply run ‘fastboot oem unlock’ from your computer’s command line to unlock the bootloader and allow the installation of custom software.
Rooting - 2. Install the Superuser Package
is a modified boot image which will root your device and install the superuser package the first time that it boots. Check your device ‘about’ screen to make sure that you download and install the correct version:
- - and extract it to a directory on your computer
- - Put your device into bootloader mode. You can either use ADB or turn the phone on whilst holding the trackball to enter the bootloader.
- - If on Windows double click ‘install-superboot-windows.bat’
- - If on a Mac, cd into the directory containing the files and type ‘chmod +x install-superboot-mac.sh && ./install-superboot-mac.sh’
- - If on Linux, cd into the directory containing the files and type ‘chmod +x install-superboot-linux.sh && ./install-superboot-linux.sh’
Backing Up
Once you’ve gained root access to your phone it’s a good idea to make a backup of your system before installing any custom ROMs. One easy way of doing this is to install the . This custom recovery image adds lot’s of useful functionality to the standard recovery console including Nand backup and restore as well as some other convenient options for managing device partitions. It’s a useful install if you’re going to be making use of your root access on your phone. You can install the image using Fastboot.
- - Download the latest to your computer
- - Boot your phone into fastboot mode (power on whilst pressing the trackball) and connect to your computer via USB
- - Open up a command line prompt on your computer and navigate to the directory that contains the downloaded recovery image
- - Run fastboot devices to make sure that your phone is connected
- - Run fastboot flash recovery recovery-RA-nexus-v1.5.3.img
- That’s it. Booting into recovery mode will now give you all the RA extended options.
How (not) to brick your phone
Fundamental to your phone being able to work are the Radio and Bootloader (SPL) images. The radio software provides all of the phone’s telephony functionality and the Bootloader bootstraps other software as well as performing various low level diagnostic functions, similar to BIOS on a desktop PC. Both the Radio image and SPL (Second Program Loader) must be compatible versions. Flashing a phone with incompatible SPL/Radio versions is the only way of bricking your phone and rendering it useless. You can’t brick your phone by flashing ROM or recovery images, but always be very sure that you have the right version if you ever decide to update the phone’s Radio or SPL.
Customise Away
If you’ve made it through to the end of this guide then hopefully you’re ready to go and start experimenting with some custom ROMs. Rooting your phone isn’t all that complex a process but we thought the subject deserved a bit of attention as it opens up a whole new level of access to your phone.
And that, of course, gets to the heart of why an open phone is such a nice thing to have. We’re no longer dependent on the manufacturer to get everything right, and we’re no longer dependent on wireless carriers to hold off from crippling our devices. We bought the hardware, and we wrote the software and are well within our rights to change how it all works. It’s unfortunate that, at this time, so few devices afford this kind of freedom, but with any luck at all, awareness of the value of this freedom will spread over time, and vendors will find that their customers will settle for nothing less.