A boot loader is the first program that runs when you boot your device. Boot loader takes care and initiates your hardware and Android kernel. Without this program, our device doesn't boot. Those manufacturers of your devices usually write boot loaders and so usually they are locked. This ensures that the end users cannot make any changes to the device firmware. To run custom images on your device, boot loader has to be unlocked first before we proceed with it. Even when you want to root a device with a locked boot loader, it requires unlocking it first if there is a possible and available way to do it. Some manufacturers provide an official method to unlock boot loader. In the next section, we will see how to unlock a boot loader on Sony devices. If the boot loader cannot be unlocked, we will have to find a flaw that allows us to root the device.
As mentioned earlier, some manufacturers provide an official method to unlock boot loaders.
Specifically on Sony devices, we can type the following code and follow the steps shown:
*#*#7378423#*#*
When we type the preceding number on Sony devices, it opens up the following screen:
The following steps show the process of unlocking boot loader on Sony devices. This gives an idea of how vendors provide support for unlocking boot loaders on their devices:
http://developer.sonymobile.com/unlockbootloader/unlock-yourboot-loader/
For Sony devices, follow these steps:
These steps should connect the device to the laptop in fastboot mode.
We can check the devices connected using the following command:
fastboot devices
Once the device is connected in fastboot mode, we can run the following command with the vendor provided unlock code to unlock the device:
The preceding code shows that boot loader unlock is completed.
Though the process here is shown specifically with Sony devices, this is almost the same with most of the official manufacturer methods.
Warning: This process sometimes may cause damage to your device. While writing this book, this boot loader unlock process provided by the manufacturer has lead my Sony device to get into boot loop. Looking at the stack overflow questions, we have noticed that this happened to many other people on these models (C1504, C1505). We had to flash the device with a stock OS provided by the vendor later to get our device working again. Finally, it is safe! Apart from this, an unlocked boot loader is nothing but a door without lock. So it is possible for an attacker to steal all the data from the lost/stolen device.