[Nexus 5 General] Mohhamad Rehan:
I did this with my nexus 5 and I thought It should be useful and handy as well as useful to keep warranty.

I want to thank all the great devs who have made all this things down here and made our devices more useful

+Chainfire​

Osmosis

And the ppl on XDA

THIS IS THE SAFEST AND THE MOST USEFUL WAY OF ROOTING AND UNLOCKING BOOTLOADERS AND STILL KEEPING WARRANTY

FIRST OF ALL FEW THINGS ABOUT NEXUS 5 WE MAY OR MAY NOT KNOW

1:- THERE IS A NEW IMPLEMENTATION LIKE WHAT SAMSUNG DID FROM NOTE 2, S3 AND SOME DEVICES AFTER THAT LIKE THE EFS PARTITION AND FLASH COUNTER THEORIES (THE REASON WHY I HATE SAMSUNG'S PLASTIC ****)

2:- IN NEXUS 5 WE DONT HAVE A SEPERATE PARTITION FOR EFS BUT THE THING IS PUT IN BY GOOGLE. IT CAN ACCIDENTALLY WIPE WHILE FLASHING CUSTOM ROMS, FACTORY IMAGES OR ANY OTHER THING AND MAY RENDER YOUR DEVICE USELESS LEAVING YOU WITH A DEVICE WITH UNKNOW IMEI AND SERIAL NUMBER ( THERE IS ONE CASE OF THIS THING HAPPENING TO A USER ON XDA)

3:- THE BOOTLOADER HAS A HASTAMPER FLAG WHICH WHEN REBOOTING TO BOOTLOADER AND CONNECTED TO THE PC AND RUNNING A COMMAND IN COMMAND PROMPT IN WINDOWS AND TERMINAL IN LINUX AND MAC ( I HATE APPLE)

AND TYPING IN THE COMMAND fastboot oem device-info

Displays this three things:-

Device tamper: [true/false]

Boot loader unlock : [true/false]

Secure boot:[enabled/disabled]

Now we all know the ppl at the manufacturing company [Samsung for gnex/ lg for nexus 4]

Use to see our bootloader status for warranty

Now things and technology have changed and so is the security and policies of companies

So if the device tamper shows true then be aware that the warranty is void of our very own latest Google flagship phone

THINGS THAT WE NEED FOR ROOTING AND BACKING UP RECOVERY, EFS AND CHANGING THE DECIVE TAMPER FLAG TO FALSE

1:adb and fastboot tools for Linux/windows/MAC search it on google to how to setup Adb and fastboot for your respective OS

Also enable development settings by tapping build number in 7 times and enable USB debugging in development settings and don't consider yourself a developer after doing so, it need much more to be a developer in Android

2:-cf-auto-root from

http://xdaforums.com/showthread.php?t=2507211

you will get all the info that the cf-auto-root will wipe all your data and unlock your bootloader, so make a backup of all your data and all those things that you want

Now we have a rooted devices

Now download http://downloads.codefi.re/autoprime/LG/Nexus_5/Nexus_5_Backup_EFS.zip and copy it to the sdcard

2:- now we need to relock the bootloader

This step needs two things

A custom recovery either twrp or Clockworkmod I prefer Twrp over cwm (Twrp is user friendly but when it comes to flashing my favorite ROM Catacalysm, I prefer Cwm )

Download this

http://xdaforums.com/showthread.php?t=2239421 and move it to the internal storage

Done with the recovery. Now copy the recovery in platform-tool in Android-Sdk in window. Or if u are in Linux then copy it to the Home directory not on desktop.

Now open Terminal

And type

sudo apt-get install adb

sudo apt-get install fastboot

This will install adb and fastboot

Now navigate to the folder in which you have saved the recovery

By cd ~/Home

In windows copy the recovery.img to platform tools that is better rather than CD ing

And hold shift and right click and select open command prompt here

Now u are ready for the commands to put in

There are no different commands for windows and Linux but Mac have commands like ./fastboot

So now connect the device The. Computer and start the commands to put in

1st command

adb devices

Accept what pops up on your device

2nd command

adb reboot-bootloader (Linux)

adb reboot bootloader (windows)

./adb reboot-bootloader (Mac)

Now you may know what the command does it will reboot to bootloader

3rd Command

fastboot devices

The serial number show up with device online status

4th command

fastboot oem device-info the one I mentioned previously It above

It will display the device tamper and bootloader info

5th command

Ensure that you have the recovery.img in platform-tools and your command prompt is opened in platform-tools/ you have navigated to the directory in which the recovery is placed

Now type the following command

fastboot boot recovery.img

(Ensure that the downloaded recovery is renamed to recovery.img | if while renaming in windows it may come out like recovery.img.img so just remove the one .IMG )

This won't replace the stock recovery partition

But

Your device will boot into Twrp

Or Cwm only

Here make a system backup Advanced backup will have an option for efs backup just tick all of others except the efs and backup. It will be saved to sdcard and move it to ur PC This will be helpful while Ota updates. If u want you can backup efs also. You can follow this step to recover everything at the time of OTA

4)

Now when u are in the recovery just flash the cwmnexusbooloaderunlock.zip

And Nexus_5_Efs_backup.zip one after the another.

BY THIS PROCESS YOU WILL RELOCK THE BOOTLOADER AND CHANGE THE HASTAMPER TO FALSE. YOU CAN CHECK THAT AGAIN BY THE 4TH COMMAND MENTIONED ABOVE. You will also have a folder in the sdcard with efs1,efs2 and efsflashable.zip named efs_backup transfer / copy this to PC AND FLASH THIS WHENEVER U LOSE THE SERIAL NUMBER AND IMEI

WITH THIS YOU HAVE A ROOTED DEVICE WITH A BOOTLOADER LOCKED AND WARRANTY INTACT

Now download 3 apps from play store

Flashify

Bootunlocker

Use flashify to backup current recovery and kernel

And bootunlocker to unlock the bootloader without tampering the

Hastamper flags and without wiping data and u can relock with the same u can verify it by my favorite command

Optional :-

Use tasker and its plugins and follow every tutorial about tasker

Actions that I use are like call recording , wave to take call, and activating voice while incoming call when in silent mode.

I also use xposed framework

Gravitybox, AppsOpsXposed, Google search Api , smoother system progress bars.

ROMS AND KERNELS I USE ARE

OMNIROM:- BEING A CONTRIBUTOR

CATACALYSM:- Favorite

Might come with my own ROM in the future

KERNELS:-

BRICKED, FRANCO AND ELEMENTAL X

I MAY ALSO COME UP WITH A KERNEL OF MY OWN NAMED PRIME KERNEL IN JANUARY

BACKUP APPS:-

GO BACKUP

TITANIUM BACKUP

THIS WILL BE USEFUL WHEN U RETURN TO STOCK WITH TWRP U CAN USE THEM TO GET YOUR APPS AND GET THE OTA WITHOUT LOOSING THE DATA

KUDO AND THANKS TO ALL THE DEVELOPERS AND PEOPLE AND ALL THE BEST WITH ROOTING AND DONT MESS UP YOUR DEVICE AND

FOLLOW THE COMMAND PROPERLY I HAVE DONE THIS MANY A TIMES DO IT PROPERLY I AM NOT RESPONSIBLE IF YOU GO WRONG AND MESS UP YOUR DEVICE

The EFS BACKUP SCRIPT IS NOT MY CREATION AND NOT THE SCRIPT THAT RELOCKS THE BOOTLOADER

OSMOSIS MADE THE CWM UNLOCK BOOTLOADER SCRIPT AND SORRY THE PERSON WHO MADE THE EFS BACKUP SCRIPT I AM REALLY SORRY I DONT REMEMBER YOUR NAME THANKS TO ALL OF YOU GUYS

ALL THE BEST ﻿