Unlocking the bootloader on Xiaomi devices opens up a wide range of customization options: custom firmware, root rights, or modified cores. However, sometimes users need to return the factory lock β whether for sale, warranty repair, or security restoration. Backlocking is much more difficult to unlock and is not officially documented by the company. In this article, we will discuss all current methods, their features and potential risks.
It is important to understand that Xiaomi does not provide a direct tool to re-lock the bootloader through the Mi Unlock Tool. All existing methods are based on the use of utility firmware functions or the use of engineering modes. Some methods require deep technical knowledge, others require special equipment. We will look at the options from the simplest to the most radical so that you can choose the right one.
Before you start, make sure you understand the consequences: wrong actions can lead to a device blink (complete failure) or data loss.
Why you may need to block the loader back
There are several good reasons to return the device to factory status:
- π¦ Selling or transferring a smartphone: The new owner may not need an unlocked bootloader, and an open bootloader increases the risks of installing malware.
- π§ Warranty repairs: Xiaomi service centers often refuse warranty repairs if they detect an unlocked bootloader.
- π‘οΈ Security: A locked bootloader protects against unauthorized access to system partitions, even if the device is stolen.
- π Back to stock firmware. Some features (e.g. Mi Pay or Widevine) L1) They may not work properly on custom firmware.
But thereβs a downside: once you lock, youβll lose the ability to install unofficial firmware or modifications without re-unlocking, and some locking methods can reset the device to factory settings.
Official method: Mi Flash Tool (for some models)
The most reliable, but also the most limited way is to use the proprietary utility Mi Flash Tool, which works only on some models (mainly until 2020 release) and requires:
- π» Windows computer 7/10/11 (64-bit)
- π Original. USB-cable (preferably from the set)
- π₯ Fastboot Firmware for Your Model
- π Mi Account Linked to the Device
The process looks like this:
- Download the official firmware for your model in.tgz format (choose the Stable version, not the Developer version).
- Unpack the archive and place the firmware folder in the root of the C:\ drive (the path should not contain Cyrillic!).
- Install the Mi Flash Tool and Xiaomi drivers.
- Turn off the phone and press Volume Down + Power to enter Fastboot mode.
- Connect the device to your PC and in the Mi Flash Tool, select the folder with the firmware.
- At the bottom of the window, select the clean all and lock option (this is key!).
- Press Flash and wait until it is completed (the process will take 5-15 minutes).
Note that the clean all and lock option is not available for all models, and if it's not on the drop-down menu, it won't work.
Download the correct firmware version |Install Xiaomi |Check the availability of the option clean all and lock |Do backup data | Charge the phone at least 50%
-->
Alternative method: through the Engineering Menu (EDL)
If the official method doesnβt work, you can try blocking the bootloader through Emergency Download Mode (EDL) mode, which is more risky and requires:
- π§ Knowledge of working with ADB and Fastboot
- πΎ Special firehose file for your model
- π Contact or test point solders (for new models)
Instructions:
- Download the QFil or Mi Flash Pro utility (to work with EDL).
- Transfer the device to EDL mode: For older models: adb reboot edl For new: you will need to close test contacts on the board (see instructions for a specific model).
QFil
prog_emmc_firehose.mbn
Lock Bootloader
Run the firmware. If everything goes well, the bootloader will be locked.
β οΈ Attention: Incorrect work with EDL This can lead to a complete blink of the device, which can not always be restored even in the service center.
On newer models (Xiaomi 12/13/14 series, Redmi Note 11/12), EDL entry is often blocked at the hardware level, and specialized hardware (such as UFi Box or EasyJTAG) may be required.
Method for advanced: modification of the aboot section
This method involves manually editing the aboot (or bootloader) partition, where the lock status is stored, and requires:
- π The unblocked bootloader (paradox, but the fact)
- π± Root rights (Magisk or SuperSU)
- πΎ Backup copy of the aboot section
- π₯οΈ Knowledge of working with a hex editor (for example, HxD)
Algorithm of action:
- Make a backup of the aboot section through ADB: adb shell su dd if=/dev/block/bootdevice/by-name/aboot of=/sdcard/aboot_backup.img
- Download. aboot_backup.img on PC and open in HxD.
- Find the bytes that are responsible for the lock status (usually offset 0x104 or 0x1FC, but depending on the model).
- Change the value from 01 (unlocked) to 00 (locked).
- Save the file and backshoot back: adb push aboot_modded.img /sdcard/ adb shell su dd if=/sdcard/aboot_modded.img of=/dev/block/bootdevice/by-name/aboot
- Reset the device.
Warning: Incorrect editing of the aboot partition will make it impossible to boot the system, and without a backup, it will be extremely difficult to restore the device.
Where to find offset for your model?
What to do if nothing works: JTAG and service centers
If all of these methods fail, there are two options:
- Official Xiaomi Service Center: π Find the nearest authorized SC on the official website. π° The cost of the service varies from 1,500 to 5,000 rubles (depending on the model). β³ Term of implementation: 3 to 10 days.
β οΈ Note: Service centers may be refused if the device was purchased informally (e.g., imported from China) and may require proof of purchase (check or box).
- π§ Use devices such as UFi Box, EasyJTAG or Medusa Pro.
- π° Price: from 3 000 to 10 000 rubles (depending on the complexity).
- β‘ Time: 1-3 hour (usually on the day of the application).
| Method | Difficulty | Cost | Risk of a brick | Suitable for new models |
|---|---|---|---|---|
| Mi Flash Tool (clean all and lock) | Low. | Free of charge. | Medium. | β No. |
| Engineering Menu (EDL) | Tall. | Free of charge. | High-pitched | β οΈ Partially. |
| Editing by aboot | Very high. | Free of charge. | critical | β Yes. |
| Xiaomi Service Center | Low. | 1 500β5 000 β½ | Low. | β Yes. |
| JTAG (specialized workshop) | Medium | 3 000β10 000 β½ | Low. | β Yes. |
Frequent Mistakes and How to Avoid Them
When trying to block a bootloader, users often face typical problems:
- π "Device Not Found" in Mi Flash Tool: Solution: Install Xiaomi drivers manually via Android SDK Use Mi Flash Pro instead of the standard utility.
π‘
If the Mi Flash Tool doesnβt see the device in Fastboot mode, try running the utility on behalf of the administrator and temporarily disabling the antivirus, and reinstalling drivers via Zadig will also help (choose the libusb-win32 driver).
Checking the status of the loader after blocking
To ensure that the bootloader is successfully locked, follow the following steps:
- Turn off the device and go to Fastboot mode (Loudness down + Power).
- Connect your phone to your PC and type in the command: fastboot oem device-info
- Find the Device unlocked: false string. If you have one, the bootloader is locked.
You can also check through the phone menu:
- Go to Settings β About Phone β MIUI version.
- Tap 7 times on the MIUI version line to activate Developer Mode.
- Back to Settings β Additionally. β For developers.
- Find the bootloader status, and if it's gray and inactive, the bootloader is locked.
On some models (such as the Xiaomi 13 Pro), the status of the bootloader may not appear in the settings, in which case it is more reliable to check through fastboot.
π‘
Even if the bootloader is locked, some modifications (such as the modified boot.img) may remain in the system. For complete "purity", it is recommended to flash the stock firmware through Fastboot after blocking.