Unlocking the Android bootloader allows for the installation of a custom Android OS — known as a ROM — to the device. Android OSes are read-only, hence the term ROM — read-only memory. The bootloader determines which software, including which ROM, is to be run when the device is powered on.
Based on the guide provided by HTC, this guide provides some additional details along with edits and illustrations for further clarity. For downloadable code, you may need to follow along in the HTC step-by-step instructions. This guide has been tested with, and is specific to, the HTC One M8 handset with Android version 6.0.
- Downloads from HTC require an account: https://www.htcdev.com/register/
- About the bootloader: http://www.htcdev.com/bootloader/faq
- Start page for unlocking the bootloader: http://www.htcdev.com/bootloader
- Step-by-step, detailed instructions: http://www.htcdev.com/bootloader/unlock-instructions
- Instructions for re-locking: http://www.htcdev.com/bootloader/unlock-instructions/page-4
- Android Studio – http://developer.android.com/sdk/index.html
- Java Runtime Environment – https://java.com/en/download/mac_download.jsp (MacOS)
- HTC Sync Manager – http://www.htc.com/ca/software/htc-sync-manager/
2. Unlocking the bootloader
WARNING: Unlocking the bootloader will erase all user data and third-party apps from the Internal Storage. Backup all user data or move it to Removable Storage.
Desktop – Download desktop executable
1. Download to your desktop and unpack the fastboot binary executable appropriate to your OS. (Instructions are for MacOS. Link to Linux executable is included for convenience.)
- Linux — “fastboot” (https://www.htcdev.com/images/uploads/fastboot-linux.zip) — 61887 bytes — Checksum ffd3b02cdf9aa7609462e3957663d238
- MacOS — “fastboot-mac” (https://www.htcdev.com/images/uploads/fastboot-mac.zip) — 59071 bytes — Checksum 0b3e2a8c5cfeb7c23b362483b93f7dd6
Device – Enable fastboot mode
2. Power off your device. Press and hold the Volume Down button and then simultaneously press and hold the Power button for several seconds. This will launch the device into bootloader mode.
3. The Volume buttons are used to make selections in the bootloader screen. Highlight “fastboot” and then press the Power button. A label FASTBOOT should now appear highlighted in red on the device screen.
4. Connect your device to your computer with a USB cable. The FASTBOOT label should now read FASTBOOT USB.
Desktop – Generating a token
5. Using Terminal (MacOS) from your desktop, issue the following command.
fastboot-mac oem get_identifier_token
6. A code block will be generated. Copy this text, including the lines “<<<< Identifier Token Start >>>>” and “<<<<< Identifier Token End >>>>”. Omit any line prefixes, such as “INFO.” On device SH45FWM01420 (I nicknamed this device “sapphire”), the code block was as follows.
<<<< Identifier Token Start >>>>
<<<<< Identifier Token End >>>>>
HTC Web Site – Requesting the unlock binary
7. Paste the code block from the previous step into the form provided at Step 7 on the HTC web site. Click the Submit button.
Desktop – Flashing the unlock binary
8. An unlock code binary file will be sent to you by email. It will be an attachment named Unlock_code.bin. Save this file to your desktop alongside your earlier fastboot files.
9. Using Terminal (MacOS) from your desktop, issue the following command.
fastboot-mac flash unlocktoken Unlock_code.bin
Device – Confirm
10. Your device should now display a disclaimer. Use the Volume buttons to select and press the Power button to confirm your selection.
- If you select Yes, your device will be reset to its factory default settings and your bootloader will be unlocked. This step will erase all user data and third-party apps from the Internal Storage.
- If you select No, your device will reboot and no modifications will have been made.
3. Relocking the bootloader
(Steps 1 through 3 below are identical to steps 2 through 4 above.)
1. Power off your device. Press and hold the Volume Down button and then simultaneously press and hold the Power button for several seconds. This will launch the device into bootloader mode.
2. The Volume buttons are used to make selections in the bootloader screen. Highlight “fastboot” and then press the Power button. A label FASTBOOT should now appear highlighted in red on the device screen.
3. Connect your device to your computer with a USB cable. The FASTBOOT label should now read FASTBOOT USB.
4. Use the following command in Terminal for MacOS.
fastboot-mac oem lock
5. Note: This will not restore the factory default lock, but will simply re-lock the bootloader so no further changes can be made. If you want to unlock your bootloader again, simply reinstate FASTBOOT USB mode (steps 2 through 4 for unlocking), then repeat step 9 for unlocking with your original unlock key file.
Appendix 1 — Stock (Official) ROM Information
- M8_UL PVT SHIP S-ON
- eMMC-boot 2048MB
- Dec 12 2015,16:24:40.0