Many advanced smartphone users sooner or later are faced with the desire to gain complete control over their device. Standard manufacturer restrictions often interfere with installing custom firmware, removing system junk, or overclocking the processor. The key to freedom of action is a modified one, which allows you to load not only the official operating system, but also third-party recovery images. bootloader, which allows you to boot not only the official operating system, but also third-party recovery images.
The process of replacing the stock bootloader with a custom one, for example TWRP or OrangeFox, requires certain technical training and understanding of risks. Errors at any stage can lead to the device turning into a โbrickโ and stopping responding to commands. However, if you act carefully and follow the instructions, you will discover new customization options Android.
In this article we will analyze in detail all the stages: from preparing drivers and unlocking the bootloader to directly writing a new image to the phone's memory. We will look at the nuances of working with the utility fastboot and explain why some models require special approaches.
Preparing the device and necessary software
Before starting any manipulations with system partitions, it is necessary to provide a stable environment for work. The first step is to install the ADB and Fastboot drivers on your computer. Without them, the system will not be able to recognize the smartphone in bootloader mode. For Windows users, it is recommended to download a universal package Minimal ADB and Fastboot or official drivers from the device manufacturer.
You will also need the bootloader image file itself with the extension .img. You need to look for it strictly for your device model on specialized forums, such as XDA Developers. Using an image from another model is guaranteed to damage the phone. Save the downloaded file to the root folder with ADB utilities for ease of working with the command line.
Don't forget to make a full backup of your important data. The process of unlocking the bootloader often initiates a full factory reset of the device. Transfer photos, contacts and documents to cloud storage or to your computer so as not to lose them forever.
โ ๏ธ Attention: Unlocking the bootloader in most cases will void the official warranty on the device. Manufacturers are violating the integrity of the software.
โ๏ธ Ready for firmware
Activating USB debugging and unlocking Bootloader
In order for the computer to send commands to the smartphone, you need to activate the hidden developer menu. Go to your phone settings, find the item About phone and quickly click 7 times on the field Build number. After a notification appears that you have become a developer, return to the main settings menu.
In the new section For developers find and turn on the switch USB debugging. This will allow data exchange between the PC and the device. Next, you need to allow bootloader unlocking. In some models, for example Xiaomi or Huawei, this requires obtaining a special unlock code through the manufacturer's official website and waiting from several days to a month.
Connect the phone to the computer with a cable and enter the command adb reboot bootloaderin the command line. The device will reboot into Fastboot mode. To check the connection, enter fastboot devices. If the serial number is displayed in the console, then the connection is established correctly.
fastboot oem unlockor
fastboot flashing unlock
A warning about data loss will appear on the smartphone screen. Confirm the action with the volume buttons. The device will reset and reboot. Now the bootloader is unlocked and we are ready to install the new image.
Use the original USB cable that came with the phone. Cheap charging cables often do not have data lines, which leads to connection errors.
The process of installing custom Recovery via Fastboot
The most critical step is writing the image file to the recovery partition. Make sure your phone is in Fastboot mode again. In the command line on your computer, go to the directory where the firmware file is located. The recording command is as follows:
fastboot flash recovery file_name.img
Instead file_name.img substitute the real name of your image, for example twrp-3.5.2-0-generic.img. After executing the command, a message finishedwill appear in the console. However, the process does not end there.
Many stock bootloaders automatically replace the custom recovery with the factory one upon first boot. To avoid this, you must immediately reboot into recovery mode after flashing the firmware without loading the main system. To do this, use a combination of buttons or the command:
fastboot boot file_name.img
This command will temporarily boot the image without permanently recording it, which is convenient for testing. If everything works correctly, you can perform a permanent installation. In some devices with dynamic partitions (A/B partition), the command may differ, requiring the slot to be specified, for example fastboot flash recovery_a.
Features of devices with encryption
On modern smartphones with Android 10 and higher, the data partition is encrypted. Older versions of TWRP may not see the internal memory and show 0 MB. The solution is to install a recovery version that supports the current encryption scheme, or format the data through the Wipe -> Format Data menu.
Compatibility table and common commands
Different manufacturers use different variations of the Fastboot protocol. Below is a table with the main commands that may be required when working with the bootloader.
| Action | Fastboot command | Note |
|---|---|---|
| Checking connection | fastboot devices |
Displays the serial number device |
| Unlocking | fastboot flashing unlock |
For new Android 9+ devices |
| Write image | fastboot flash recovery file.img |
Main firmware command |
| Boot without writing | fastboot boot file.img |
Temporary launch recovery |
| Reboot | fastboot reboot |
Exit bootloader mode |
Using the wrong command may result in writing the image to the wrong partition, for example, instead of recovery you will write data to boot. Check the syntax carefully before pressing Enter. For devices Pixel and OnePlus the commands are standard, but for MediaTek often you need to use the SP Flash Tool utility instead of Fastboot.
Possible errors and methods for eliminating them
During the flashing process, users often encounter an error (remote: device is locked). This means that the bootloader is still locked despite your attempts. Check the status with the command fastboot getvar all and find the line locked. If there is one, repeat the unlocking procedure.
Another common problem is an error (remote: Unknown command). This happens when you use the command oem unlock on a device that requires flashing unlock. The protocol has changed in recent versions of Android, and older instructions may be misleading.
If your computer does not see the device in Fastboot mode, try installing drivers manually through Windows Device Manager. Select the device with the yellow exclamation mark, update the driver and specify the path to the Google USB drivers folder. Sometimes changing the USB port on the motherboard helps (it is advisable to use USB 2.0 ports).
โ ๏ธ Attention: If after flashing the phone the phone goes into an endless reboot (bootloop), do not panic. Hold down the power and volume buttons to enter Recovery mode and perform a data reset (Wipe Data/Factory Reset).
Most errors at the firmware stage are related to drivers or an incorrect version of the image. Always download files intended strictly for your model and board revision.
First steps after installing a modified bootloader
After successful installation TWRP or an analogue, you have access to an extended menu. First of all, it is recommended to make a full backup of the current system state (Nandroid Backup). This will save images of all partitions (Boot, System, Data) and will allow you to roll back in case of unsuccessful custom OS firmware.
Next you can get root access. To do this, download the file Magisk.apk, rename it to Magisk.zip and install through the Install menu in Recovery mode. After rebooting you will have full access to the file system. This will allow you to remove system applications, change fonts and customize the kernel.
Remember that with a modified bootloader, some banking applications and services (Google Pay, Netflix in HD) may stop working due to SafetyNet or Play Integrity API protection. To bypass these restrictions, you will need additional configuration of Magisk modules, such as Universal SafetyNet Fix.
Your device is now completely in your control. You can install custom firmware, such as LineageOS or Pixel Experience, extending the life of your old smartphone and getting the latest versions of Android that the manufacturer no longer produces.
Is it safe to unlock the bootloader on a Samsung phone?
Unlocking on Samsung is possible, but has its own characteristics. A Knox trigger fires, irreversibly changing a physical bit in the processor. This permanently disables Samsung Pay, Secure Folder and warranty, even if you lock the bootloader back. On other brands, this process is usually reversible.
Is it possible to update the system over the air (OTA) with a custom bootloader?
Official updates over the air most often do not arrive or are not installed on devices with an unlocked bootloader and custom Recovery. The system checks the integrity of the partitions and cancels the installation. You will have to update manually by downloading full firmware images and installing them through Recovery mode.
What to do if the phone does not turn on after the fastboot command?
Try holding down the power button for 10-15 seconds to force a reboot. If the phone enters Fastboot mode, try flashing the stock bootloader image (boot.img) and recovery image (recovery.img) from the official firmware. If the screen is black and there is no response to the buttons, you may need Download Mode (for Samsung) or flashing it through test points.
Will unlocking the bootloader erase my photos?
Yes, the unlock command (fastboot flashing unlock) initiates a full reset of the device to factory settings for security purposes. All data in the internal memory will be deleted. Data on the SD memory card is usually saved, but it is better to remove it before starting work.