freedomThere are times when you might need to lock the bootloader on  your HTC One M7 or M8 when you are S-OFF. The first thing that comes to mind would be if you bought and HTC One M8 and wanted the extra Google Drive storage space. Another reason to lock the bootloader might be to install an RUU. Whatever the case, once you’ve locked, unlocking via HTCDev is going to wipe your phone.

The process is pretty short and sweet if you have ADB installed on a computer, which if you’re S-OFF chances are good you’ve got that part down.

S-ON people, this is not for you, it just doesn’t work.

The following are lists of commands xda member scotty1223 came up with and posted over at xda. Before executing them I advise you to read the thread (it’s only 11 pages) linked below and make sure there’s nothing that your particular M7 or M8 has a problem with.

If you mess up the command that starts with “echo” you could theoretically brick your device, so it’s a really good idea to just go to the linked thread and copy it directly from there in case I somehow flubbed it or it gets messed up in formatting.

Unlock bootloader

The commands to execute to unlock the bootloader are:

  • adb devices (just to make sure the device is showing)
  • adb shell
  • su
  • echo -ne “HTCU” | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
  • exit
  • exit
  • adb reboot bootloader

Lock the bootloader

  • adb devices
  • adb shell
  • su
  • echo -ne ‘\x00\x00\x00\x00’ | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
  • exit
  • exit
  • adb reboot bootloader

Important to note that locking the bootloader this method says “locked.” Locking it with fastboot generally yields a “relocked” state.

Google Drive relocking

While I have not had a chance to test this yet, there are posts indicating that people got the drive space that HTC included for locked devices that they lost for not activating their Google Drive before unlocking.

[xda-developers]