Install custom Recovery on Xiaomi via ADB: The Complete Guide

Modifying the Android shell opens up huge opportunities for Xiaomi smartphone owner that are not available in stock firmware. Installing a customized recavator such as TWRP or OrangeFox is the first and most important step towards full control of the device, and it is through this tool that users gain superuser rights (Root), install global firmware on Chinese versions or create full backups of the system.

Replacing the normal recovery mode requires careful understanding of the bootloader’s architecture. Unlike a regular software update, here we interfere with low-level memory partitions, which carries certain risks if the technology is broken. However, if you follow the instructions clearly and understand the meaning of each ADB and Fastboot command, the likelihood of turning the phone into a brick is minimized.

In this guide, we will take a detailed look at the entire journey from unlocking the bootloader to the first successful boot into a modified recovery environment, and we will look not only at the standard scenario, but also at the nuances of modern models with Snapdragon and MediaTek processors. Preparedness for the procedure and availability of a worker USB-Cable is where the path to customization begins.

Preparation of tools and drivers for working with ADB

Before connecting a smartphone to a computer, you need to prepare a software environment. The basic element is the Platform-tools package containing executable files adb.exe and fastboot.exe. Without these slits, any communication with the device in debugging or bootloader mode will be impossible.

The critical step is to install the right drivers. Xiaomi devices often require Qualcomm’s HS-USB QDLoader 9008 universal driver (for crash recovery modes) and the standard Android Bootloader Interface. If Windows Device Manager displays an unknown device or device with an exclamation mark when connecting a smartphone in Fastboot mode, commands will not be executed.

You also need the recovery image file itself with the.img extension. It's important to download a version that strictly matches your smartphone model. 10, on the Redmi Note 11, This will cause the touchscreen to fail or the download to be completely blocked. recovery.img And put it in the root folder with tools. ADB command-in.

⚠️ Warning: Make sure the battery is at least 60% battery power. interrupting the process of writing data to the Recovery partition due to battery discharge can lead to a failure of the boot sector.

Unlocking the bootloader: a mandatory stage for Xiaomi

Xiaomi has implemented strict protection against unauthorized software modifications, so custom Recovery firmware is impossible without an unlocked bootloader. The regular bootloader signs all sections with a digital key, and any attempt to change the system image without removing the lock will be rejected. First, you need to link the Mi Account account to the device through the β€œDevelopers” menu.

Once you have an account attached, you have to wait a certain amount of time, which is usually 168 hours (7 days), but in rare cases, the timer can be extended to 30 days, during which time you can not log out of your account on your device or reset your settings, otherwise the countdown will start again, a security measure designed to protect your data in the event of a device being stolen.

After the waiting period, the procedure is performed through the official Mi Unlock Tool utility. The smartphone is transferred to Fastboot mode (clamping the volume button when connecting USB), after which the program checks the status of the account and gives permission to unlock. The process completely clears the internal memory of the device, so the preliminary creation of a data backup is mandatory.

πŸ“Š Have you encountered an increased unlock timer (more than 7 days)?
No, I unlocked it in 168 hours.
Yeah, waited 15-20 days.
I can't even unblock my account.
I've already unlocked the bootloader.

Set up debugging and enter Fastboot mode

For a PC to communicate successfully, you need to activate the hidden developer menu. On most MIUI and HyperOS shells, this is done by seven times pressing the build number in the About Phone section. Once the "You've become a developer" notification appears, you should go to the advanced settings and turn on the Debugging on USB.

When the first cable is connected to the computer on the smartphone screen, a request for debugging permission with a fingerprint will appear. RSA-You need to check "Always allow from this computer" and click "OK." If you don't do that, ADB-The demon will not have sufficient rights to execute commands, and the device will appear as "unauthorized" when checking status.

Transfer of the device to Fastboot mode is carried out by completely turning off the smartphone and then pressing the volume reduction button when connecting USB-The screen should show the distinctive logo of the hare repairing the android, or the inscription FASTBOOT. In this mode, the phone waits for low-level commands to work with memory partitions.

adb reboot bootloader

This command can be used to automatically navigate to Fastboot if the phone is on and debugging is active. Once the command is executed, the device will reboot to the desired mode without mechanically pressing the buttons.

Recovery Firmware Process Through Command Prompt

When the preparatory steps are complete, you can go to the direct recording of the image. Open the command line (CMD) or PowerShell in the folder with the Platform-tools tools. First of all, check the visibility of the device with the command fastboot devices. If you see the serial number of the device in response, then the drivers are installed correctly and the connection is established.

The basic firmware command looks standard, but has its own features on different versions of Android. For most modern Xiaomi devices, the following instruction is used:

fastboot flash recovery recovery.img

However, there is an important nuance associated with the mechanism of A/B-partitions (Seamless Updates). On devices with such architecture (for example, Xiaomi Mi 9, Redmi Note 8 and later), the command may differ, or after firmware you will need to manually switch the active slot. If after standard firmware the phone loads into stock boot Recovery instead of TWRP, try the command fastboot recovery.img for the first run, and already inside TWRP fix it permanently.

β˜‘οΈ Checklist before firmware

Done: 0 / 4

Once the process is successfully completed (OKAY and Finished status), you can’t just turn on the phone with the power button. On many new Xiaomi models with AVB (Android Verified Boot) activated, the standard system may not start if it detects changes in the Recovery section, so you often need to press the button combination immediately after firmware is installed to enter recovery mode.

Typical errors and methods of their elimination

One of the most common problems is the FAILED (remote: device is locked) error, which occurs when you try to flash Recovery onto a locked bootloader, and you need to go back to the unlock phase through the Mi Unlock Tool, which is impossible to ignore because the bootloader physically forbids you from writing to secure partitions.

Another common situation is that the phone goes into an endless restart (bootloop) after installation. TWRP. This may be due to incompatibility of the Recovery version with the Android version (e.g. firmware). TWRP Android 11 on Android 13, and the problem may be damaged. USB-a cable or port through which data transmission was interrupted during recording.

The CMD MistakeProbable causeDecision
FAILED (remote: unknown command)Wrong syntax or old FastbootCheck the path to the file, update the Platform-tools
FAILED (status mismatch)Conflict of loader versionsUse the Fastboot version from the firmware
FAILED (remote: flash write failure)Problems with memory or cableReplace USB-cable, try another port USB 2.0
waiting for device...Drivers not installedInstall Xiaomi/Qualcomm drivers manually

If you encounter an error that is not described in the table, try using another one. USB-port, preferably USB 2.0, Some older versions of Fastboot are not stable with ports. USB 3.0/3.1. It also makes sense to double-check the integrity of the downloaded image file through a checksum (MD5/SHA1), If provided by the developer of Recovery.

What if TWRP doesn’t see internal memory?
Often, after the first TWRP installation, internal storage is displayed as 0 MB. This is related to data encryption. You need to go to the Wipe β†’ Format Data menu, type "yes" and confirm the action, which will delete all data, but decrypt the partition, making it available for file writing.

First Start and Basic TWRP Setup

After the firmware is installed, it is important to correctly enter the first one. Press the volume button and the power button (on some models, only power if the Recovery is already fixed). If you see the Xiaomi logo, and then the standard Mi-Logo screen that says "Powered by Android", but the TWRP menu does not appear - perhaps the system overwrote Recovery back to stock, in which case the fastboot procedure should be repeated and flash buttons immediately pressed.

When you first run the TWRP, you can ask for a screen unlock password. This is standard data protection. If you don't remember the password or it's not accepted, you'll have to format the data, which will delete all the information. Recovery interface can be in English or Chinese, but the basic functions (Install, Wipe, Backup) are intuitively located.

For stable operation, it is recommended to perform the following actions immediately after installation:

  • πŸ“± Swipe to Allow Modifications: Swipe across the screen to allow modifications, otherwise the system may replace Recovery again when you restart.
  • πŸ”’ Format Data: If you plan to install custom firmware, be sure to complete the full formatting.
  • πŸ’Ύ Backup: Backup your Boot and System partitions before any further experiments.

πŸ’‘

If you plan to install firmware with Google services (GApps), do so immediately after installing TWRP, before the first start of the system, and this will eliminate the need to re-enter Recovery mode.

Now your device is ready to install custom firmware, Magisk patches for Root rights, or just to create full backups. The ability to work with ADB and Fastboot opens the door to a world of deep customization, allowing you to extend the life of even outdated smartphone models.

πŸ’‘

Successful firmware Recovery through ADB is possible only with unlocked bootloader and the right drivers. Violation of the sequence of actions or the use of incompatible files is the main cause of failure.

Can I install Recovery without unlocking the bootloader?
No, on modern Xiaomi devices, it's not possible. The bootloader checks the digital signature of the Recovery partition. If the signature doesn't match the factory one (and custom Recovery can't), the bootloader will refuse to run it. The only way is to officially unlock it through Mi Unlock.
Will the warranty fly after TWRP firmware?
Technically, unlocking the bootloader and modifying the software would void the manufacturer's warranty. However, it is theoretically possible to return the stock Recovery and lock the bootloader back, making the interference invisible in surface diagnostics. But if the iron is severely damaged, the service center may refuse repairs if it detects flashing.
What if the phone stopped turning on after the firmware?
If the screen is black and the phone is not responding, try pressing the power and volume button for 10-15 seconds. If the device is in Fastboot mode, you can try flashing stock Recovery image or full firmware. If the phone goes into EDL mode (Blinking indicator, black screen), you will need a special cable or disassembly to close the contacts and flash through the Mi Flash Pro.
Do I need to re-strip Recovery after the Android update?
Yes, when you update your official firmware over the air (OTA) or through Recovery, the system partition is overwritten and custom TWRP is replaced with stock. You will have to rerun the fastboot flash recovery command after every major system update if you want to keep access to the modified Recovery.