Monday October 5 2015

Almost certianly not of much use these days other than for reference if you have an old Nexus 5 with a currently locked bootloader.

Date: 2015-10-05 18:25


Earlier today I found out about Android M being officially released for Nexus devices as of today. Considering that I had just recently activated my Nexus 5 and was not even running Android 5.1 I decided to give it a go. There aren’t a lot of custom roms for 6.0, and I’ve always liked running stock anyway.

Also as a word of caution this guide has a Linux system in mind, and I highly suggest even a Ubuntu flash drive for this as installing drivers for these phones is a total pain on Windows.

If you’re looking for just Android 6 and don’t care about Root access and or Tethering then you might as well wait for the OTA.

Thing you will need:

Back up your files

I absolutely cannot stress this enough, if you have not done so already back up every single file on your phone, especially if you have not unlocked the boot loader. If you unlock the boot loader already the phone will erase all data on the phone including the /sdcard directory.

Unlocking the boot loader:

Power off the phone, hold the volume down and power at the same time. You should see a boot loader screen come up.

Once your phone is in the boot loader menu plug it in and run the following command:

user@host:~/$ fastboot oem unlock

Installing factory Android 6 Image

If you have fastboot this process is actually quite simple. Do be warned that this will take some time. I also strongly encourage you to make sure that your phone boots properly and has cellular service after this is complete

user@host:~/Downloads$ tar xfz hammerhead-mra58k-factory-52364034.tgz
user@host:~/Downloads$ cd hammerhead-mra58k
user@host:~/Downloads/hammerhead-mra58k$ ./
     # Now is where you go and make yourself some coffee

Install of custom recovery

In order to root our phone and flash a custom kernel we’re going to need to install a custom recovery. Now that you’re booting into Android 6 go ahead and shutdown the phone. Hold down the volume down and the power button to get back to the boot loader menu. This time there won’t be a lot of waiting as we’re only installing a recovery.

user@host:~/Downloads$ fastboot flash recovery twrp-hammerhead.img

Now once this is done do not reboot your device, simply unplug your Ethernet cable and hit the volume up/down to select reboot recovery and then tap the power button.

This will boot you into TWRP, it will pop up and ask you about modifying the file system. Go ahead and tell it that modifying the file system is fine. But don’t root your device from the recovery menus. Only do it by flashing a zip

Install of custom Kernel and Root access

Now that you’re in the recovery, you should be able to use either ADB to transfer the zip files over to your phone. I prefer the side load method, that way I don’t actually have to copy a zip to the phone and worry about managing zip files in two locations.

Go into the advanced menu in the recovery and select ADB Sideload Flashing this file will probably bring up a pretty technical installer. The options have safe defaults, just know what you’re doing if you tweak any of the settings.

user@host:~/Downloads$ adb sideload

The phone will probably reboot after installing the kernel. This is fine, just hold down the volume down and the power buttons until the phone shuts off. At that time release the power button. ( But not the volume down ) This should bring you back into the boot loader menu. Use this to get back into the recovery.

Once you’re back into the recovery go ahead and go to the advanced menu and ADB Sideload once more, this time be sure to check on the wipe cache and wipe dalvik cache buttons.

user@host:~/Downloads$ adb sideload

Once this is done you’re going to go and flash the SuperSU zip file you downloaded earlier. If you don’t have the permissive mode flashed you’re not going to be able to boot into android.

user@host:~/Downloads$ adb sideload
Go ahead and reboot the phone ( System ) from the recovery menu. The first boot might take a bit of time ( ~6 minutes on my phone ) #### Unlock tethering ( Optional ) - - - Although carriers want to charge extra for tethering and limit how you can use it. This is not the way it used to be. I argue that carriers should provide you with a data service and not try to micro-manage and track your usage of it.
user@host:~/$ adb shell
android$ su
root# echo "net.tethering.noprovisioning=true" >> /system/build.prop
root# content insert --uri content://settings/global --bind name:s:tether_dun_required --bind value:i:0
root# reboot