Install custom Recovery on Xiaomi via computer

The process of modifying the Android operating system on Xiaomi devices often requires access to hidden memory partitions that are not available in standard mode. Custom Recovery is a key tool for advanced users to perform a full backup system, clear cache, install third-party firmware and obtain root rights. Without this software, deep customization of the smartphone is impossible.

The standard Mi Recovery environment has extremely limited functionality and is designed only for basic resets or updates via OTA. Unlike it, TWRP or OrangeFox provide full control over the file system of the device, installing such software requires connecting the smartphone to the computer, having special drivers and strictly following the sequence of actions to avoid errors.

In this guide, we will discuss in detail the technically complex process of replacing a regular loader with a modified one. USB-Any interference with the system partition carries risks, so preparing the theoretical basis before starting practical actions is mandatory.

Tools and environment preparation required

Before any manipulation with the bootloader, you need to prepare the workspace and software. The computer must run the Windows, Linux or macOS operating system, since the debugging tools are cross-platform. It is critical to use an original or quality certified USB-cable capable of transmitting data, not just charging current.

The main tool for interaction will be the ADB and Fastboot suite, which are Google's console utilities that allow you to send commands directly to the bootloader of the device, without the ADB environment installed and configured, you can't do the next steps, and you also need to download a current recovery image that is compatible with your smartphone model.

  • ๐Ÿ“ฑ Xiaomi smartphone with a charged battery of at least 60%.
  • ๐Ÿ’ป Computer or laptop with Internet access.
  • ๐Ÿ”Œ Original. USB-cable.
  • ๐Ÿ“‚ Downloaded Recovery Image File (.img format).

Note that firmware and recovery files often have complex names that contain device code names. Set a recovery image for another model (e.g., the global Chinese version) will result in a brick of the device. Always check your model's code name in the settings or on the box before downloading files.

โš ๏ธ Note: You perform all actions to modify the system software at your own risk. The author of the article is not responsible for possible data loss or device failure.

๐Ÿ“Š What is the purpose of installing Recovery?
Getting Root Rights
Installation of custom firmware
Building full backups
Just experimenting.

Unlocking the Bootloader bootloader

Xiaomi blocks the bootloader of its devices by default, which prohibits changes to system partitions. Unlocking Bootloader is the first and mandatory step, without which custom recovery is impossible, the process requires linking the Mi Account to the device and obtaining special permission from the manufacturer's servers.

The procedure takes at least 7 days (168 hours) from the date of application, a security limitation that cannot be legally circumvented, and after the waiting period has expired, you must re-start the Mi Unlock Tool application on your computer and follow the instructions to unlock, while completely clearing the user data.

โ˜‘๏ธ Checking before unlocking

Done: 0 / 4

It is important to understand that once the bootloader is unlocked, Find My Device and some banking applications may stop working as standard due to security integrity violations, and the manufacturerโ€™s warranty may be cancelled in some regions, but for enthusiasts this is a necessary sacrifice for the sake of gaining full control of the gadget.

Installation of drivers and setting up ADB

For successful communication between the computer and the smartphone, the PC operating system must correctly recognize the device in boot mode. Windows often has problems with automatic installation of drivers for the Fastboot mode. It is recommended to use the universal driver package Xiaomi or ADB Installer, which automatically installs the necessary components.

After installing the drivers, activate the debugging mode on the smartphone itself. Go to Settings โ†’ About Phone and quickly click on the build number seven times to unlock the developer menu. Then, in the additional โ†’ For developers, activate the โ€œDebugging by USBโ€ and โ€œFactory Unlockโ€ options.

You can check if the drivers are installed correctly and you can communicate via the command line. Connect the phone in normal mode, type in the adb device command. If a device with a serial number appears in the list, then the basic connection is established. To work with the bootloader, the phone is switched to Fastboot mode, and the command is changed to fastboot devices.

adb devices


fastboot devices

If your computer doesnโ€™t see your device in Fastboot mode, try replacing it. USB-switching to another port or cable, preferably USB 2.0, located on the motherboard, not on the front panel of the case. ADB They may conflict with other phone management programs, so a clean installation often solves the problem.

Recovery Firmware Process via Fastboot

The most reliable and common installation method is using Fastboot mode. First, switch your smartphone to this mode: turn off the device completely, then press the volume down button and plug in. USB-The screen should show a hare repairing an android, or the words Fastboot.

Open the command prompt (CMD) or PowerShell in the folder where the downloaded recovery image file is located. Rename the file for convenience, for example, in recovery.img. Enter the command to check the connection:

fastboot devices

If the device is displayed, you can go to write the image to the recovery section, and the command looks like this:

fastboot flash recovery recovery.img

Once the process is completed, which takes a few seconds, you need to immediately put the device into recovery mode, which is a critical point: if you just reboot the phone into the system, Xiaomiโ€™s hardware firmware can automatically replace custom recovery with the original one.

Why does Recovery fly off after the reboot?
Modern versions of MIUI and HyperOS have a self-defense mechanism. When you load into the main system (System Boot), the integrity of the recovery partition is checked. If a modification is detected, it is replaced by a stock one. So the first login to Recovery must be made by force through a button combination or a fastboot command, bypassing the OS boot.
  • ๐Ÿ”„ Press the volume and power button at the same time.
  • ๐Ÿ”Œ Hold the buttons until the Mi logo appears, then release the power, leaving the volume.
  • ๐Ÿ–ฅ๏ธ Or use the command fastboot boot recovery.img temporary-launch.

โš ๏ธ Warning: Do not disconnect the cable or interrupt the recording process (flash) under any circumstances. interrupting the write to the recovery section can make the phone unable to boot even in recovery mode.

First Start and Configure TWRP

Once you've installed it successfully and logged in, you'll see a TWRP interface or other recovery installed. The first thing you need to do is allow modifications to the system. The screen will see a request for "Swipe to Allow Modifications." Swipe your thumb through the slider. If you don't, the next time you restart, all changes will be canceled.

Next, clean up the data if you plan to install custom firmware or if the current system is unstable after unlocking the bootloader. Select Wipe, then Advanced Wipe and select the Dalvik / ART Cache, Cache and Data sections. Do not touch the Internal Storage and System sections if you are not sure about your actions.

SectionFunctionRecommendation
DataUser data, applications, settingsClean when changing firmware
CacheTemporary system filesIt's safe to clean always.
Dalvik/ARTCash of application optimizationClean up after installation
SystemOperating system filesDo not touch unnecessarily

An important step is data encryption. Modern versions of TWRP can request a password or a pattern lock when you first run. If you can't enter a password or it's not accepted, you may need an encryption patch or a data reset via Wipe Data, which will delete all the information on the phone.

๐Ÿ’ก

Make a full backup of the Boot, System, and Data partitions immediately after installing Recovery while the system is stable, which will save you in case of future experiments that fail.

Solving Typical Problems and Errors

During installation, users often encounter a โ€œWaiting for deviceโ€ error in the command line, which indicates that the computer does not see the phone in Fastboot mode. if there is a device with a yellow exclamation point, you need to manually update the driver, indicating the path to the folder with drivers ADB/Fastboot.

Another common problem is the Invalid sparse file format error when running firmware, which occurs when you try to flash an image that is not intended for your device, or if the file is corrupted when downloading. Always check the file checksums and download them only from trusted sources, such as official developer channels on Telegram.

If the phone goes into an endless restart after installing recovery, try clearing the Data partition through Recovery Mode. If that doesn't help, you'll need to run the firmware through the Mi Flash Tool in Clean All mode, which will return the device to factory status.

Can I install Recovery without unlocking the bootloader?
Officially, no. Entry to the recovery section is protected. There are exploits for some older models, but for modern Xiaomi devices, unlocking is mandatory.
Will the bank application fly off after installation?
Yes, banks' applications may fail because of an unlocked bootloader, so Magisk and root-rights-hiding modules can do that, but it's a complicated process.
How do you get back to the stock if something goes wrong?
You need to download the official firmware for your model, unpack it and flash boot and recovery sections through Fastboot, or use the Mi Flash Tool for full flashing.
Do I need an unlocked bootloader to install MIUI updates?
Officially OTA-Updates may stop coming or not installed on the modified system. You will have to update manually, downloading full firmware packages.

๐Ÿ’ก

Installation of custom Recovery is a point of no return, which opens up full access to the system, but requires high responsibility and understanding of the risks of loss of warranty and data.