The initial step to rooting and flashing custom ROMs on any Android phone is to unlock the bootloader of the device. And even though there is speculation that the bootloader can actually be unlocked on only a handful of Android models, this isn’t true and it is supported on the majority of the phones we use today.
What is a Bootloader?
The book definition of bootloader will be a code that is executed before the OS begins to run. The general idea of the bootloader is basically the same to all Operating systems including the ones on your computer, laptop, smartphone and other similar devices. The bootloader essentially packs the complete instructions necessary to boot the operating system kernel, and some of them even have their own debugging or modification environment. As the bootloader launches before any other software on your smartphone, every motherboard has its own bootloader due to the fact it is extremely processor specific. Perhaps this is the main reason why all Android phones have different custom ROMs developed, due to the high variation of processing hardware present on the phone. The devices which operate on iOS to some extent share the same hardware components and therefore you won’t see much of a difference in their bootloader.
The Bootloader on Android
All Android devices have bootloader that guides the OS kernel to boot normally. However, you need to know that because the Android OS is an open source operative system and is available on a lot of different hardware; separate manufacturers will probably have their own modified version of the bootloader which will be specific for the hardware present in its current environment. A perfect example of this is the Motorola which packaged an “eFuse” command in their Android devices, which will immediately turn off your device on permanent basis if you attempted to flash a Custom ROMs.
Is it required to unlock bootloader on Android devices?
The answer to this is easy. If you want to root, you would definitively want to flash Custom ROM post-root, and in case you want to install a custom ROM, you will need to have your android phone’s bootloader unlocked. To generalize the whole concept, this means that by unlock bootloader, you will be able to install custom Firmware on your Android device.
Reminder: By unlocking the bootloader of your phone, you will immediately lose its warranty. In addition, your phone will be formatted and all the internal memory including the apps, SMS, MMS, contacts will be permanently deleted.
You cannot Bootload all phones
Two kinds of phones exist in this world: The ones which allow you to unlock the bootloader, and the ones who don’t.
The option to unlock bootloader on Android phone depends on the manufacturer, the model and sometimes even the carrier in use. For example, all Nexus phones can be unlocked, while the majority of the phones manufactured by Motorola and HTC enable you to unlock the bootloader via a similar method as the one which is used to unlock bootloader on Nexus phones.
Some other phone models and carriers however do not allow the user to unlock the bootloader with a standard procedure. This basically means that you will need to wait for the developers to find an exploit in the security before you can root and flash ROMs. In case you have one of these types of phones, then unfortunately this tutorial will not be much of use to you.
The recommended method in order to find out to which category your phone belongs is to browse the section of the device called “XDA Developers”. If you own HTC or Motorola phone, then you may find out whether its bootloader can be unlocked by visiting their website. If the unlock is not supported, then you will need to use an unofficial rooting or unlocking procedure, a procedure which can be found on one of the XDA developers forums.
But if your phone has bootloader unlock support thru an official channel, then please continue reading.
Make backup of the entire data on the phone
Right before we begin, you ought to know that the bootloader unlock process will delete all the data stored on the device. So in case you have any important data you want to keep for later use, now it is the time to transfer it to your computer. Moreover, in case you have any app settings you wish to keep, use the backup option they provide and transfer them to your computer as well.
Furthermore, since I always unlock bootloader when I buy a new phone, I basically know that eventually I am going to root my phone. In this way, I do not need to waste time to adjust the settings when I know I will delete it after a week or so. In case you are Android tweaker and you know you are going to root your device soon, perhaps you should consider unlocking the device before you adjust all the settings. In this way you will save up a lot of time.
Let’s continue, if you already have backed up all the data you need, then follow the guide bellow:
Install all your Phone Drivers and Android SDK
This procedure requires two things: The USB drivers of your phone and the Android Debug Bridge, which is a command line tool which enables your computer to interface with your phone.
Even if you already have these installed, check and see if you have the latest versions now.
Here is the short version on how to install them both:
- Go to the Android SDK Download site, scroll down to “SDK Tools Only” and download the files
- Unzip the downloaded file in a folder where you want to store the ADB files
- Launch the SDK Manager and deselect all, besides “Android SDK Platform-tools”. If you are utilizing Nexus Phone, you can download the Google drivers by selecting “Google USB Driver”
- Once the installation is finished, close the SDK manger
- Now install the USB drivers for your device. They can be found on your phone manufacturer website respectively like Motorola or HTC. If you are using Nexus phone, then you can install the Google drivers which you have downloaded with the previous step.
- In case you are prompted, Reboot your computer
Turn on your device and connect it to your computer with USB cable. Launch the platform-tools folder found under the Android SDK Folder and click on an empty area holding the SHIFT+RIGHT CLICK buttons together. Select “Open a Command Prompt Here” and type the following command:
If you see a serial number, then your device is recognized and you can continue with the procedure. However, if this is not the case, go back and check if you have followed all the instructions properly.
ENABLE USB Debugging
This step will require that you enable several options on your device. Launch the app drawer of your phone, press on the Settings Icon, and choose “About Phone”. Scroll down and press on “Build Number” item seven times. Shortly after, you should receive the message “You are now a developer”.
Go back to the main Settings page, and a new option near the bottom should be shown, called “Developer Options”. Open this, and enable “OEM Unlocking” (if the option is available, if not, do not worry too much, it is only necessary on several type of phones).
Now, enable “USB Debugging”. When prompted, enter your PIN or password.
Once you have done this, connect your phone with your computer. A new popup called “Allow USB Debugging” should always be shown on your phone. Check the field “Always allow from this computer” and press OK.
Acquire an Unlock Key (only for non-Nexus phone users)
If you own Nexus phone, then skip this step. All the users who have other phone models, besides Nexus will need to go thru this extra step before you can proceed.
Visit the manufacturer’s bootloader unlock site again, select the model of your device if asked, and log in or create a new account (if you do not have one).
The rest of the procedure is a bit different and it solely depends on the model of your phone ( if use Motorola Phone see this guide here or if use HTC go on this page here). However, do not worry too much because the manufacturer’s site instructions should guide you thru the process.
The entire procedure goes something like this:
First, turn off your phone and boot it into Fastboot mode. Note that this is different on every phone, however on most smartphones you can get there by simply holding down the “Volume down” and “Power” button together for several seconds. Release them and you should enter your device into Fastboot mode. (Any HTC user will need to select “Fastboot” with the volume down button and press power to select it first). More information about this can be found by trying a quick Google search, so feel free to do that right before you proceed.
Next, connect your phone and computer using USB cable. You should see a notification on your phone that is connected. Open the platform-tools folder which us under Android SDK Folder on your computer and Right Click+Shift on an empty area. Select “Open a Command Prompt Here” and use this command prompt window to get your unlock key as described by your manufacturer. (For instance, all Motorola devices will run the Fastboot oem get_unlokc_data command, while the HTC phones will run this command: Fastboot oem get_identifier_token command).
The command Prompt will throw out a token which will be in a form of very long string of characters. Select the token, and copy-paste it into the applicable box of your manufacturer’s website (make sure that there are no spaces) and submit the form. In case your device can be unlocked, an email with a key will be forwarded to you, which you will need to use in the next step.
But, if your device is not unlock-able, you will receive a message informing you about this. If you still want to root your device or flash a ROM, then you will need to use some of the unofficial methods, which can easily be found on a site such as the XDA Developers.
Unlock Bootloader of your Phone
This is the final step where you will actually do the unlock. In case your device is still into a “Fastboot mode” then run the command provided bellow. However, if not, then turn of your phone and hold down the “Volume down” and “Power” buttons together for couple of seconds. Release them simultaneously, and you should enter “Fastboot mode”. (Any HTC user will need to select “Fastboot” with the volume down button and press power to select it first).
Use USB cable and connect your phone and PC.
On your PC, open the platform-tools folder which is in your Android SDK Folder and Right Click+Shift on an empty area. Select “Open Command Prompt Here”
In order to unlock your phone, you only need to run one short command.
For the majority of Nexus phones, the command is:
“Fastboot oem unlock”
But if you own a newer Nexus phone like the Nexus 5X or Nexus 6P, then type this command instead:
“Fastboot flashing unlock”
If you own a phone different than Nexus, then your manufacturer will let you know which command to run. Motorola users for instance, need to run this command
fastboot oem unlock UNIQUE_KEY
using the unique key from the email which was sent to you.
The HTC devices need to run this command:
fastboot oem unlocktoken Unlock_code.bin
using the Unlock.bin code you have received via the manufacturer’s email.
Once you have run the correct command, your phone may prompt you if you certain that you want to unlock. Confirm this by using the volume keys.
After you are done here, reboot your phone using the on-screen menu (or simply run the Fastboot reboot command from your computer). In case all worked properly, a new message should be shown, saying that the bootloader of your phone is unlocked, and after a few moments it should boot into Android.
It is very important that you boot into Android before you do anything else, like for instance flashing custom recovery.
And that’s it; you have unlocked your phone. You may see that there isn’t a big difference; however an unlocked bootloader will allow you to flash a custom recovery that will pave the way to root access and custom ROMs on your phone.