Nexus Howto

From gr0x0rd
Revision as of 23:44, 10 January 2013 by Gr0x0rd (talk | contribs)
Jump to navigation Jump to search

In order to do anything with a Nexus phone, the first thing you'll need is a working android development framework. This guide is the only one I've found geared toward doing this in a Linux environment, which seems sort of ridiculous, since Android is a linux based platform.
<r> The first step is to enable the developer options on your Nexus. Go into your phone settings, and choose "Developer Options". If you don't see this option, go into "About Phone" and tap on "Build Number" until the option appears. Once you've entered the Developer Options, enable Android Debugging.
<r> Connect your Nexus to the PC using a USB cable. To ensure connectivity

$ sudo lsusb

You should see a device in the list similar to as follows:

...
Bus 001 Device 055: ID 18d1:4ee1 Google Inc.
...

If you haven't already, you'll need to add the platform-tools folder in the Android development framework to your system path to get access to tools like adb and fastboot. Once you've done this, you can use adb to query your phone.

$ adb devices

The device should show up as follows:

List of devices attached:
<random string here>            device

You can then reboot the phone into the bootloader. You can also do this manually by turning the phone off, then holding power and volume down (volume up on newer Nexus models).

$ adb reboot bootloader

Once into the bootloader, you'll need to unlock it. THIS WILL WIPE ALL OF THE DATA ON THE NEXUS PHONE. So have all of your goodies backed up before you do this, or better yet, make this the first thing you do when you take your Nexus out of the box.

$ fastboot oem unlock

Once you've issued the command, the phone should prompt you as to whether or not to proceed. Once you've chosen to do so, your phone will now be unlocked, and you can flash it with a custom recovery image.

Download the latest recovery image (or not) for your phone model. You can get them from the CWM site. Note, for my nexus for, the Mako recovery image (6.0.2.0) worked, while the Manta recovery image (6.0.2.3) did not. To flash the recovery image,

$ fastboot flash recovery /path/to/yourrecoveryimage.img

It should only take a few seconds to do this. Once completed, you should see a message similar to

sending 'recovery' (XXXX KB)... OKAY
writing 'recovery'... OKAY

If you see a message saying FAILED, it's probably because you haven't unlocked the bootloader.
You should now have an unlocked phone with a custom CMW recovery image that you can use to perform nandriod backups. This only gets us halfway to our goal, however, which is achieving root access to the device. The next step is to download the SU package, or a package containing SU and Busybox (which contains all your favorite linux commands and allows you to use them in a shell on your phone). The best way to find this is by searching google, since it is usually hosted by an ever changing file cloud download service of some kind. It should be in a .zip file: once you've downloaded it, you'll need to use adb to push it to the sdcard on your Nexus.

$ adb push /path/to/SU.zip /sdcard/SU.zip

You should see something similar to

XXXX KB/s (XXXXXXXX bytes in X.XXX secs)

Now that the package is on the device, you can install it using your newly flashed recovery image. From the menu on your phone, use the volume up/down keys to select "Recovery mode", and use the power button to select it. You should notice that the initial Google screen should now have a symbol of an unlocked padlock in the bottom middle.
Once in the recovery menu, select "install zip from sdcard", then "choose zip from sdcard". If you copied the SU zipfile correctly, you should see it in the root of your sdcard and should be able to select it. If you don't, you'll need to go back to the previous step. There is an option from the main menu "mounts and storage", if you still can't seem to find the SU zip on your sdcard, you can select "mount sdcard" and trying the push process again. There seems to be some sort of abstraction with newer Nexus models that makes this more difficult than it should be.
After you've installed the binary, choose "+++++Go Back++++++" until you're back at the main menu. At this point, it would be a good idea to wipe the phone's caches and any data, which may give you problems during bootup. In the main menu, you'll want to choose "wipe cache partition" and "advanced" then "wipe davlik cache". At the main menu, choose "wipe data/factory reset". This will completely virginzie the phone.

Finally, choose "reboot system now". This should bring you up to the initial greeting screen. You should see the Android loading screen, and the prompts to set up your phone for the first time.

Congratulations! You now have a rooted Nexus, as you should.