Android - How to re-lock Android bootloader?

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:

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

    • Linux: ./fastboot-linux oem lock
    • OSX: ./fastboot-mac oem lock
    • Windows: 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.