How to reflash Xiaomi Mi5: the complete guide

The Xiaomi Mi5, released in 2016, is still a legendary device thanks to its compact body and quality components. However, time is running out and official software support has long since ceased, leaving owners alone with an outdated version of Android and security holes. The only way to breathe new life into the gadget and get current features is to reflash it on a custom build.

The process of replacing the operating system on this device requires care and preparation, since the model is based on the Snapdragon 820 processor, which has its own features of unlocking the bootloader. You will have to face waiting in line from the company, setting up the ADB environment and choosing the right firmware version among the many options created by enthusiasts.

In this article, we will take a look at all the steps from obtaining superuser rights to installing a stable version of Android 10 or 11, learn what tools are needed to work with Fastboot and Recovery, and how to avoid the typical bugs that turn a phone into a β€œbrick”.

Workplace preparation and backup

Before you start technical manipulations, you need to create a safe environment for work. You will need a computer running Windows, as drivers and utilities for Xiaomi work best in this OS. USB-cable, preferably original, to avoid communication interruptions during critical data recording moments.

The most important step is to save user data, as the flashing process involves completely cleaning the device’s internal memory. Make copies of photos, contacts and documents to the cloud service or external hard drive. Remember to check the battery power of your smartphone – it must be filled at least 60-70% so that the device does not turn off at the most inopportune time.

⚠️ Note: The process of unlocking the bootloader automatically initiates a full data reset (Wipe Data). Even if you plan to just upgrade, all files will be deleted without the possibility of recovery.

To work, you will need the following software components, which should be downloaded in advance:

  • πŸ“¦ Drivers. ADB and Fastboot for Windows.
  • πŸ”“ Mi Unlock Tool (last version from the official website).
  • πŸ“± The image of a custom Recovery TWRP, codenamed "gemini".
  • πŸ€– Firmware file (ZIP-archive corresponding to the selected version of Android.

β˜‘οΈ Firmware readiness

Done: 0 / 4

Make sure your computer has all the necessary drivers installed.Sometimes the system may not see the phone in bootloader mode right away, so installing Google USB Driver universal drivers or Xiaomi's dedicated drivers is a must.

Unlocking the Bootloader bootloader

The foundation for any customization of the Xiaomi Mi5 is an unlocked bootloader. Without this step, installing a third-party recover or firmware is impossible. Xiaomi has implemented this security measure, so you can’t just flash the device β€” you need official permission from the server.

First, you need to link your Mi Account to your device. Go to your smartphone settings, find the About Phone section, and click on the MIUI version several times to activate the developer menu. Then, in the advanced settings, turn on USB debugging and OEM Unlocking.

Settings β†’ About the phone β†’ (we tap on the version of MIUI) β†’ Advanced settings β†’ For developers

Once you turn on these features, download Mi Unlock on your PC, launch it and log in to your account. Put your phone into Fastboot mode, pressing both the power and volume buttons, and connect it to your computer. The program will check the status of the device and, if the accounts match, allow unlocking.

⚠️ Attention: From the moment of account binding to successful unlocking, it can take from 7 to 360 hours (3 to 15 days) This is a server restriction that cannot be circumvented by software.

If you get a message about successful unlocking, the phone will automatically restart and clear the data, and now the path to installing the modified software is open.

πŸ“Š How many days have you waited for the bootloader to unlock?
Less than 3 days (old accounts)
3-7 days (standard)
More than 15 days
I've already had it unlocked.

Installation of custom TWRP Recovery

Xiaomi’s regular recovery menu allows you to reset or update in an official way that doesn’t suit us. We need TWRP (Team Win Recovery Project) – a powerful environment that allows you to install unsigned packages, make full backups and work with the file system.

The installation process on Mi5 (codename gemini) is done via a computer using the command line. First, place the downloaded image file (usually with the.img extension) in the folder with the ADB tools. Rename it for convenience, for example, in twrp.img.

Put your smartphone into Fastboot mode (volume down + power buttons) and connect to your PC. Open the command line in the folder with ADB and enter a command to check the connection:

fastboot devices

If you see the serial number of the device, you've got the connection, and now you're going to type in the command for the recovery firmware.

fastboot flash recovery twrp.img

An important nuance for Xiaomi Mi5: after firmware can not just boot into the system, otherwise the staff bootloader will rewrite TWRP back to stock. You need to immediately, without releasing the power button, press the volume button to enter Recovery mode.

πŸ’‘

If the TWRP crashed after the first reboot, repeat the firmware procedure and immediately press the button combination to log in to Recovery, preventing the system from booting.

In the TWRP menu, you will see the ability to select a language (including Russian) and adjust the time zone, and now you can move on to the main stage - installing a new operating system.

The process of installing firmware and cleaning partitions

Before installing a new system, you need to properly prepare the memory partitions. In the TWRP menu, select "Wipe" (Clean up). To switch to another version of Android or custom build, it is recommended to format the Data, Cache, Dalvik and System partitions.

⚠️ Note: When selecting Format Data, everything will be deleted, including internal memory. Make sure you save important files in advance, as it will be impossible to restore them after that.

Once cleaned, go back to the main menu and select "Install." Find the previously copied memory card or internal storage. ZIP-Firmware archive. Confirm the selection and move the slider to start the installation. The process can take anywhere from 3 to 10 minutes depending on the speed of the memory card.

If you install firmware based on Android 10 or 11 (like LineageOS 17.1 or Pixel Experience), you will also need to flash a compatible version of GApps (Google Applications) if they are not built into the firmware.

Type of firmwareThe basis of AndroidStabilityRecommendation
LineageOS17.1 / 18.1Tall.For everyday use
Pixel Experience10 / 11MediumFor fans of pure Android
ArrowOS11Tall.Optimal speed balance
Resurrection Remix9 / 10MediumFor advanced users

After installing all the necessary packages (firmware, GApps, possibly patches for camera or sound), select "Reboot System". The first download can last up to 5-7 minutes, this is normal for the application optimization process.

Return to the official firmware (Stock ROM)

Sometimes you need to return the Xiaomi Mi5 to its original state: for sale, fix custom build errors or restore warranty (although this is no longer relevant for the Mi5).

You'll need to download the official Fastboot firmware for your model, and it's important to distinguish it from Recovery firmware: the Fastboot file has a.tgz extension and contains many files inside, and Recovery is one.zip file. Unpack the archive to the root of the disk so that the path doesn't contain Cyrillic.

Launch the Mi Flash Tool, connect your phone to Fastboot mode, and press the "Refresh" button. Specify the path to the firmware folder. At the bottom of the window, select "Clean all" mode to avoid file conflicts.

What if the Mi Flash Tool is in error?
A common reason is that Qualcomm drivers are not installed or the file path contains Russian letters. USB-Port or cable: In some cases, it helps to run a program on behalf of the administrator.

Press Flash and wait until the process is over. The indicator turns green with the words "Success." The phone automatically reboots to a clean MIUI system.

Typical problems and their solution

Owners of Xiaomi Mi5 can face a number of specific problems when flashing, one of the most common is a broken touch screen after installing some custom firmware, due to different versions of displays (JDI, Sharp, BOE) that were used in production.

To solve this problem, you need to find and flash a special patch or Magisk module adapted to your screen type, and there is also a common problem with a double tap to wake, which may not work without the corresponding drivers in the kernel.

  • πŸ“Έ Photo quality: custom firmware is often below the runoff; it is recommended to use Google Camera (GCam) with the correct config.

If the phone is gone into an endless bootloop, don't panic. Press the power and volume buttons to return to TWRP, and try to redo Wipe Data or roll back to the previous firmware version.

πŸ’‘

Most of the errors when firmware Xiaomi Mi5 is not associated with hardware, and with improper cleaning of partitions or incompatibility of the Android version with installed Recovery.

Frequently Asked Questions (FAQ)

Can I reflash Xiaomi Mi5 without unlocking the bootloader?
No, it's impossible. The bootloader blocks the entry to system partitions, and any attempt to flash the device without unlocking it will cause the same version of the software to fail or be installed.
Will the Mi Account be dropped after the flash?
When you install custom firmware, the Mi Account binding is lost as the system partition changes, however, if you are not logged out before flashing, you may need to enter a password (FRP lock) when you return to the stock.
What is the best firmware for Xiaomi Mi5 in 2026?
The most stable are Android 10-based builds, such as LineageOS 17.1 or ArrowOS 10. Android 11 can already run unstable on the old Snapdragon 820 hardware.
Is it safe to use the Magisk Root on the Mi5?
Yes, setting superuser rights through Magisk is safe if you follow instructions, but it can disrupt banking applications that require hiding root rights.