How to re-lock Android bootloader? 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:


Reboot your phone to Bootloader Mode
Connect the USB Cable to your computer.
Open a Command Prompt (Terminal on Linux or OSX)
Navigate to the platform-tools directory inside the unzipped CF-Auto-Root directory.
Use the following command, depending on your OS.


Linux: ./fastboot-linux oem lock
OSX: ./fastboot-mac oem lock
Windows: fastboot-windows.exe oem lock