I've unlocked my Nexus 5 by using CF-Auto-Root. I want to undo my actions and return the device to its original state: unrooted and locked.
How can I do this?
You'll need to use
fastboot, which is provided in the CF-Auto-Root zip file, and also available standalone and packaged with lots of other software. It's part of the Android SDK Tools / Platform Tools, which can be installed on Windows, OSX, or Linux.
Note: If you've installed a custom ROM or kernel on top of rooting, you'll want to flash the necessary stock versions from the Nexus 5 stock image with fastboot or possibly through TWRP/ClockWorkMod Recovery.
In order to re-lock the bootloader:
platform-toolsdirectory inside the unzipped CF-Auto-Root directory.
Use the following command, depending on your OS.
./fastboot-linux oem lock
./fastboot-mac oem lock
fastboot-windows.exe oem lock
On a rooted device, you can use BootUnlocker to re-lock the bootloader without using fastboot. You can also use it to unlock the bootloader again without wiping data. I use it to keep my bootloader locked most of the time, but unlock it prior to installing a system update or doing anything else that might require re-rooting via fastboot flash.
First of all there is no need to relock bootloader on a Nexus device as their specialty is that they have a unlocked bootloader by default. So maybe u can talk about unrooting.
Refer here : http://en.m.wikipedia.org/wiki/Google_Nexus