Thursday, December 15, 2016

Nexus 5 Setup - Bootloader Unlock, Custom Recovery, Root, and Pure Nexus ROM

This post has been a long time coming.  I originally set up my personal Nexus 5 back in October, 2015, but now had to go through the process again on three used Nexus 5's recently acquired from eBay for family members.  Enough about me, so let's dive into this already.

The process is essentially broken up into four parts, Unlocking the bootloader, installing a custom recovery, rooting the phone, and finally installing a custom ROM.

This post assumes you have the Android SDK installed and setup already.  This post also uses a laptop running Fedora Linux, so Windows users will need to grab the USB drivers specific for their phone.

Ok, Part 1, pull down files and unlock the bootloader.

Pure Nexus ROM & GApps
http://forum.xda-developers.com/google-nexus-5/development/rom-pure-nexus-project-layers-t3158484

SuperSU
http://forum.xda-developers.com/showthread.php?t=1538053

TeamWin Recovery Project (TWRP)
https://dl.twrp.me/hammerhead/

I put the above four downloads in the platform-tools directory under AndroidSDK just to make the adb push part a little easier.

Next, with the phone off, boot into the Fastboot by holding the Volume Down (-) button and then holding Power until the Fastboot menu pops up on screen.

From Terminal or a Command Prompt, navigate to the platform-tools directory

# cd /home/User/android-sdk-linux/platform-tools

and type

# fastboot devices

The result will show the serial of any connected devices and what state they are in.  At this stage, the result should look something like

# fastboot devices
942617834519            fastboot

If you see the device like above, then your phone is recognized by the system.  If not, then update the Android SDK and try again.

Now type 

# fastboot oem unlock

A pop up window should pop up on the phone asking if you want to unlock the bootloader, use the volume rocker to select Yes and the power button to confirm.

Now type

# fastboot reboot 

The phone will reboot and setup.  This step takes a few minutes, so be patient.

Part 2 - Install a custom recovery

After the phone boots up, you have to enable USB debugging.  Just skip through the Android setup (you will set all of this up later), go into Settings > About phone and tap the Build number seven (7) times to access the Developer options menu.  Then go to Settings > Developer options and turn USB debugging on.

With USB debugging enabled, we get to use ADB to push files onto the phone for the next steps.

With your terminal window still in the platform-tools directory, run

# adb devices

The response should be something like

# adb devices
942617834519            device

Now, lets push some files to the phone via adb.  To make life easy, I put any files I want to transfer in the platform-tools directory.  Then in the terminal window, transfer the custom recovery, SusperSU for root, the customer ROM and GApps packages with the following commands:

# adb push twrp.img /sdcard/
# adb push SusperSU.zip /sdcard/
# adb push pure_nexus_ROM.zip /sdcard/
# adb push GApps.zip /sdcard/

After all of the files are transferred, shut down the phone and boot into Fastboot again by holding Volume Down (-) and Power until the Fastboot screen is displayed.

Once in Fastboot, run the following command from terminal:

# fastboot flash recovery twrp.img

Once completed, use the volume keys to scroll through the menu and select Restart Bootloader, and when the bootloader restarts, scroll through the menu to get to Recovery Mode and start into recovery.

At this point the recovery menu should be displayed on the screen.

Part 3 -  Root

Now it is time to root the phone.  From the Recovery menu, select Install, then select SuperSU.zip and swipe to confirm.  Once the installation is finished, keep pressing back to get to the Recovery home screen.

Select Wipe, then swipe to confirm.  Once completed, press back to get to the Recovery home screen.

Part 4 - Load a customer ROM and GApps

Still in Recovery, select Install, then navigate to the pure_nexus_ROM.zip file, select and swipe to confirm the installation.

Once the installation is finished, keep pressing back to get to the Recovery screen, then select Wipe and swipe to confirm.  Press the back button a few times to return to the Recovery home screen.

Now install the GApps package by navigating to and selecting the GApps package on the home directory and swipe to confirm the installation.

Once the installation is finished, keep pressing back to get to the Recovery screen, then select Wipe and swipe to confirm.  Press the back button a few times to return to the Recovery home screen.

On the Recovery menu, select Reboot > System.

The phone will reboot, and the initial boot up will take a few minutes, so go grab a drink, you are all rooted and running a custom ROM.

No comments:

Post a Comment