Saturday, October 9, 2010

Root...Way 1, Way 2, Way 3, A Mix of 1+2+3....

I have a Nexus One (N1) phone.  I clawed some posts to understand how to root it. What does root actually do. Here is my journey. 

Note: I did it when my N1 is on Android 2.1. Your mileage may be different. 

Useful Pre-Readings:
  1. This page on android-dls.com has good info on the Android NAND partitions.
  2. I find this page in xda-forum useful.  It explains some basic terms/concepts.
Disclaimer
The following is a summary of my understandings. It mostly serves as my own reference for me to go back later. You are welcome to correct any mistakes (which I believe there are tons).


What does rooting N1 do? 
I still don't know after clawing for enough time.  For now, I understand it as something being done in the boot.img which is the kernel.  Some posts said we can think of it as getting su/root access.

Step 0:Download Files:
1. Download Amon recovery image from here.
2. Pick a custom ROM to download from here and copy it to the root partition of the N1 sdcard.

Step 1: Unlock Bootloader
The first step is unlock the bootloader? I don't know what does it do either but I did it.  I only know it will void your warranty.

1. Connect the USB cable
2. Reboot the phone to fastboot mode. Two ways:
    a. #> adb reboot bootloader
    b. Power off your phone.  Hold down the trackball and then press the power button till the screens lights up.
3. Run the following fastboot command from your computer:
# > fastboot oem unlock
4. Follow the instructions on the phone screen and say, "Yes, I do"

Step 2: Superboot
Some posts mentioned the 'superboot' step.  After downloading it, it seems it is a boot.img.  I skipped this step since I believe it will be done together when I flash a customer ROM later (keep reading)

Step 3-1: Flash Recovery
Most posts also mentioned to replace the existing recovery image on the NAND.  I ended up skipping this step also.  I found out that I can boot any recovery image resided in my desktop instead of replacing the one in Android.

If you wanna do it, you can google it. There are enough of consistent instructions on the web.

Step 3-2: Boot to Any Recovery stored in Desktop/Laptop

1. Connect the USB cable
2. Reboot the phone to fastboot mode. Two ways:
    a. #> adb reboot bootloader
    b. Power off your phone.  Hold down the trackball and then press the power button till the screens lights up.
2. Ensure your computer can find N1 by:
# > fastboot devices
3. Boot the RA recovery:
# > fastboot boot /desktop/path/to/recovery-RA-nexus-vXXXX.img

Step 3-3: Backup
It's a good idea to backup the boot and system partition before replacing a customer ROM.  Follow the instructions on the screen to do this.  A NANDROID directory will be created on the sdcard

Step 3-4: Flash the ROM into the NAND
Follow the instructions on the screen to choose the ROM that you have just downloaded and copied to the sdcard.  It may take a few minutes.

The custom ROM you have just downloaded has the boot.img and system.img.  Hence,this step should root N1 at the same time.

Some post said we need to do a superboot step.  If I understand it correctly, superboot is to replace the boot partition with a rooted boot.img.  If you only want root access without messing around the system partition, you may consider to do it and forget flashing a custom ROM in step 3-4.

No comments:

Post a Comment