If you ever tried rooting your phone or flashing custom ROMs (just different versions of Android that is developed by Android enthusiasts), you may come accross something called Bootloader. Most of the times, Rooting and flashing Custom ROMs require you to unlock Bootloader of your phone. First of all, lets know what it really is.

What is Bootloader in Android? And what does it do?

Well, technically Bootloader is the lowest level software of and Android phone, as well as other devices like a computer (Linux or Windows or whatever).

  • What does a lowest level software mean? It means that this is the first program that runs when you power on your phone.

Bootloader contains instructions about how to turn on your phone. As the name sounds, “Bootloader” does the job of “load”ing the “boot” or kernel in your phone.

Whenever you turn on your phone, the Bootloader is loaded and run before anything else. Then it finds and starts the kernel, which in turn loads the Android operating system. Thus in a few seconds after pressing the power button, you land in your homescreen and can use your phone. All this work is done under the hood and you won’t notice anything from the outside.

  • Bootloader is similar to BIOS in Windows. BIOS is the first code that is executed after the power on self tests and it checks for several hardwares and initializes the operating system. So does bootloader.

Therefore bootloader is really very important because this initializes loading of the kernel so that the OS and all features in your phone is started properly and then you can use it.
Every bootloader is extremely hardware specific, that is, every device has different bootloaders because every device comes with different hardwares and slightly or largely different versions of Android.

Also read: What Is Kernel In Android Phones? What Does It Do?

Android Bootloader

Bootloader and Rooting and Bootloop:

  • Okay that described the bootloader but why is it relevant in rooting?

As we know, rooting means gaining control of your phone’s internal memory and operating system related files and programs; so that you can customize and tweak your phone deeply and freely to to your fit. In order to do that, you first need to put some files (like the su binary) in the system partition which is basically the android OS itself.

Therefore, rooting requires you to modify your phone’s system partition. But by default, the system partition is mounted Read-only. That means you cannot copy files into system partition. Even if you manage to tamper and modify anything, your OS or kernel, or even try to flash a custom ROM or kernel, next time when you turn on your phone, the bootloader detects those changes and stops loading the kernel and OS. Thus you end up with a phone that is stuck in the bootlogo (the logo of manufacturer that is displayed first when a phone turns on). Thus any attempt to modify your phone’s firmware leaves your phone useless. This situation is famously called Bootloop.

Bootloader has its own security measures, so if you tamper your OS, a locked Bootloader will detect these changes, and will stop loading the OS and keep your phone in bootloop forever.

Manufacturers keep their bootloaders locked due to security reasons and because they want people to stick to their OS. But just because Android is open source, that means anyone with proper skill can always create custom versions of Android and test them on a phone. So, although bootloader is locked,it can be unlocked so that all those security measures can be disabled and you can flash custom firmwares. Unlocking bootloader voids the warranty for most of the phones.

How to unlock Bootloader?

If you try to root your phone or flash custom ROMs, first of all you need to unlock the bootloader to enable it to boot custom OSes.
The general method to unlock bootloader in Nexus phones, as well as other stock or close-to-stock phones is by running

fastboot oem unlock

from the command prompt in your computer, while your devices is connected to it and is in Fastboot mode. Anyways, Remember that unlocking bootloader also wipes your data.

Bootloaders are very much hardware specific and every phone has its own way of unlocking bootloader. Every manufacturer set different methods for this. Some bootloaders are encrypted, like HTC and Motorola phobnes. So you need the decryption code to unlock it. For example, the HTCdev site gives decryption codes for unlocking bootloaders of HTC phones. Don’t forget to search for commands to unlock Bootloader before doing it.


Related: What is Recovery Mode in Android phones? Everything you need to know.

Other things that it does:

Bootloader doesn’t always necessarily boot the OS. The Recovery Mode is also booted by Bootloader. By pressing the right key combinations (which are different for different phones) bootloader can be instructed to load the Recovery kernel, which will boot the phone into Recovery mode.
how Android Bootloader boots OS or Recovery

android bootloader explained

The stock recovery doesn’t have advanced functions so we often need to use a custom recovery, to flash more ROMs or to root the phone, and so a custom recovery is also required very often. Flashing a custom recovery also needs a very unlocked bootloader.

Read about recovery here

What is Fastboot?

People often get confused and mix up the term Fastboot with Bootloader, and the reason, more or less is that many phones display a message “Fastboot Mode” when booted into Bootloader. But to be exact, these two are not the same. Instead, Fastboot is more like a interface of the Bootloader.

Fastboot Mode enables a connection between your computer and your phone, and you use Fastboot to make commands and modifications to the Bootloader, that is, you use Fastboot to unlock/lock Bootloader, flash different Recovery or Kernels to the ROM. As I described earlier, bootloader boots the Android OS by booting the Kernel first; but you can “tell” Bootloader what to boot by sending commands via Fastboot mode. So in a way, Fastboot is an interface that you use to interact with the Bootloader of your phone.

fastboot protocol

After we sum all these up, we know bootloader is something that we don’t notice at all but is always required to boot Android or other OS in any device. Thats why bootloader is kept in non-volatile flash memory to prevent it from getting damaged over time. Unlocking bootloader is the first step of customizing your Android with different ROMs and recovery and kernel and anything else. The minimum of it, just rooting, also requires unlocking of bootloader.