- Hacking Android
- Srinivasa Rao Kotipalli Mohammed A. Imran
- 795字
- 2021-07-14 10:56:09
Locked and unlocked boot loaders
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.
Determining boot loader unlock status on Sony devices
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#*#*
Note
Note: These device codes could vary from manufacturer to manufacturer and could be obtained from the respective manufacturer if they provide support for it.
When we type the preceding number on Sony devices, it opens up the following screen:

- Click the Service Info button. It shows the following screen:
- Click the Configuration button to see the status of your boot loader. If boot loader unlock is supported by the vendor, it will show the following output under Rooting status:
- If the boot loader is already unlocked, then it will show the following output:
Unlocking boot loader on Sony through a vendor specified method
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:
- Check if boot loader unlock is supported. This was shown earlier.
- Open up the following link:
http://developer.sonymobile.com/unlockbootloader/unlock-yourboot-loader/
- Choose the device model and click Continue:
- This then shows us a prompt for entering an e-mail address. Enter a valid email address here:
- After entering a valid email address, click the Submit button. We should receive an email from Sony as shown in the following screenshot:
- The email consists of a link that takes us to another link, where Sony verifies the IMEI number of the device whose boot loaders have to be unlocked. Enter your IMEI number here:
- This IMEI number is required to generate the unlock code. Once we enter a valid IMEI number and click Submit, we should be greeted with a screen with an unlocking code followed by the steps to unlock:
- Once we receive the boot loader unlock code, we connect our device in fastboot mode. The steps to enter into fastboot mode could vary from model to model. Most of the time it is the difference with, which hardware keys have to be pressed to get into fastboot mode.
For Sony devices, follow these steps:
- Power off the device.
- Connect your USB cable to the device.
- Hold the volume up button and connect the other side of the USB cable to the laptop.
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.
Note
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.
Rooting unlocked boot loaders on a Samsung device
In this section, we will discuss how to root an unlocked Samsung note 2 which uses Samsung's customized version of Android OS, we will also see what the differences between Stock Recovery and Custom Recovery are, and finally we will install a Custom ROM on our Note 2 device.
- Qt 5 and OpenCV 4 Computer Vision Projects
- Mobile Application Development:JavaScript Frameworks
- Git Version Control Cookbook
- C/C++常用算法手冊(第3版)
- 差分進化算法及其高維多目標優化應用
- C語言程序設計案例精粹
- Clean Code in C#
- RubyMotion iOS Develoment Essentials
- Distributed Computing in Java 9
- 零基礎看圖學ScratchJr:少兒趣味編程(全彩大字版)
- Julia數據科學應用
- 編程的原則:改善代碼質量的101個方法
- Blender 3D Cookbook
- WCF全面解析
- Natural Language Processing with Python Cookbook