Xiaomi Mi 5 firmware: a complete guide from unlocking the bootloader to installing MIUI or custom OS

Why to Switch Xiaomi Mi 5 and What Risks It Can Have

The Xiaomi Mi 5, released in 2016, is still a popular device thanks to its powerful hardware (Snapdragon 820, 3/4 GB of RAM) and support from the development community. However, over time, official MIUI updates stop coming out, and users face slowdowns, errors or the desire to install the latest version of Android.

Incorrect actions lead to a β€œbricking” (completely inoperable) device, loss of warranty or problems with communication modules (for example, Baseband unknown). In this article, we will analyze all the ways of firmware – from official updates via Updater to install custom ROMs like LineageOS or Pixel Experience, and you will learn how to avoid typical errors and what to do if something goes wrong.

Before you start, answer three questions: 1. What is your goal? MIUI, switching to Android 12+, Bloat removal, performance overclocking) 2. Are you ready for possible data loss? (Backup is mandatory!) 3. Do you have experience with data loss ADB, Fastboot or TWRP?

If the answer is no to at least one question, start with the official firmware methods.

Firmware Preparation: Backup and Necessary Tools

The first step is to save all the important data, and even if you plan to run the firmware on top (without resetting), a failure can result in the loss of photos, contacts, or messages.

  • πŸ“± Local Copying: Transfer Files to PC via MTP (in data mode) or use Mi Mover (a backup app from Xiaomi).
  • ☁️ Cloud Storage: sync your contacts with Google Account and photos with Google Photos or Mi Cloud.
  • πŸ”§ Titanium Backup: If you already have root rights, Titanium Backup will save apps with settings.
  • πŸ“‹ Recording. IMEI: Enter the dialer *#06# and save both IMEI β€” They will be needed if the network disappears after the firmware.

Now, prepare the tools. You'll need:

Tool.AppointmentDownload link
Mi Flash ToolOfficial utility for firmware through FastbootOfficial Xiaomi website
ADB & FastbootCommand Tools to Unlock the BooterAndroid Developers
TWRP RecoveryCastomy recovery for installation ZIP-firmwareTWRP Site
Xiaomi Unlock ToolUnlock the bootloader (requires a Mi Account)Unlocking page

⚠️ Note: If you are using Windows, turn off the driver digital signature check before installing the Mi Flash Tool. To do this, type in the command line on behalf of the administrator: bcdedit /set nointegritychecks on and restart the PC. After the firmware, return the settings back with bcdedit /set nointegritychecks off.

πŸ“Š What kind of firmware you plan to use?
Official Update via Updater
Fastboot (Mi Flash)
Install custom ROM through TWRP
I don’t know if I’ll choose after reading the article.

Step 1: Unlock the bootloader on Xiaomi Mi 5

Without unlocking the bootloader, you won’t be able to install custom firmware or TWRP. Xiaomi has introduced this protection to prevent unauthorized changes, but the unlocking process is legal – the company provides an official utility.

  • πŸ”“ Unlocking erases all data on the device (including internal memory!).
  • ⏳ Linking a Mi Account to a device takes 72 hours (if the account is new).
  • πŸ“± The device must be installed official firmware MIUI (custom ROM unsupported).
  • πŸ”Œ Battery charge - at least 60%.

Instructions for unlocking:

  1. Link your Mi Account to your phone: Go to Settings β†’ Mi Account β†’ Sync and enable all options.
  2. Activate Developer Mode: Go to Settings β†’ About Phone and click on MIUI Version 7 times.
  3. Back to Settings β†’ Additionally. β†’ For developers and include: πŸ”§ Debugging by USB πŸ”“ Unlocking OEM (point-of-point!)

Mi Unlock Tool

Sign in to the program under the same Mi Account as on your phone.

Mi 5

Fastboot

Loudness down + Nutrition

Unlock

⚠️ Note: If the utility gives you a "Couldn't unlock" error with code 86006 or 86012, then your account is not tied to the device for long enough. Wait 72 hours, actively using the phone with this account (synchronize data, install apps from the Mi App Store).

Linked Mi Account to the phone|Debugging is on. USB|Unblocking permitted OEM|Drivers installed ADB/Fastboot|Battery charge >60%-->

Step 2: Choosing a firmware for Xiaomi Mi 5

The type of firmware depends on the functionality of the device. Let's consider all the options:

1. Official. MIUI (Stable/Beta)

Suitable for those who want to stay on stock firmware with support for OTA updates. Download only from the official website, choosing the Mi 5 model (codename gemini).

  • 🌍 Global – International version (supported by Google Services).
  • πŸ‡¨πŸ‡³ China – Chinese version (without Google, but with more features) MIUI).
  • πŸ‡ͺπŸ‡Ί EEA β€” European version (corresponding to the GDPR).

2. Castomic ROMs (LineageOS, Pixel Experience, crDroid)

If you want Android 12/13 or pure Android without Xiaomi's blobate, opt for custom firmware. Popular options for the Mi 5:

FirmwareAndroid versionFeaturesReference
LineageOS12/13Stable, minimalistic, regular updatesOfficial website
Pixel Experience12/13Google Pixel interface, good optimizationPixel Experience website
crDroid12Maximum customization, good productivityPage crDroid
Havoc-OS12Many functions for fine tuningOfficial website

Critical information: Android 11+ firmware may not support the NFC module on Xiaomi Mi 5 due to lack of drivers. Check reviews on the 4PDA or XDA forum before installing.

3. port firmware (MIUI from other devices)

Some enthusiasts are adapting MIUI from Xiaomi’s new smartphones for the Mi 5, like MIUI ports 12.5 or 13, which is risky: there may be bugs with a camera, sensors or communication, such firmware look for on 4PDA or XDA Developers.

πŸ’‘

Before downloading custom firmware, check the release date. If the last update was more than a year ago, there is a risk of incompatibility with modern applications (for example, banking).

Step 3: Fastboot (Mi Flash Tool)

This is the most reliable way to install an official MIUI or bring your phone back to life after a failed firmware.

  1. Download firmware in.tgz or.zip format (for example, gemini_global_images_V12.5.1.0.RFAMIXM_20210310.0000.00_10.0_global_1234567890.tgz).
  2. Unpack the archive in a folder without Cyrillic characters (for example, C:\Mi5_Fastboot).
  3. Install the Mi Flash Tool and drivers (if you haven’t done it before).
  4. Turn the phone into Fastboot mode (turn it off, then press Volume Down + Power).
  5. Connect the Mi 5 to your PC and start the Mi Flash Tool.
  6. In the program, click Select and specify the path to the unpacked firmware.
  7. Select firmware mode: πŸ”„ Clean all – complete cleaning (recommended when changing version) MIUI). πŸ”„ Clean all and lock - cleaning + Loader lock (if you want to return the official status). πŸ”„ Save user data – saving data (risky, can lead to bugs).

Flash

Once the firmware is in place, the phone will automatically restart. The first run can take up to 15 minutes - don't interrupt the process!

⚠️ If the Mi Flash Tool is making an error "flash_all_lock.bin β€œnot found” means you downloaded the firmware for the locked bootloader. Download the fastboot version without lock in the title or use Clean all instead of Clean all and lock.

What to do if the Mi Flash Tool is 99% deficient?
This is usually due to drivers or antivirus. Try: 1. disable the antivirus (e.g., Avast or Kaspersky can block the process). 2. Reinstall the drivers manually through Device Manager (look for "Android Bootloader Interface"). 3. Try another one. USB-port (preferably) USB 2.0 on the back of your PC). 4. Run the Mi Flash Tool on behalf of the administrator in Windows 7 Compatibility Mode.

Step 4: Install custom firmware through TWRP

To install LineageOS, Pixel Experience or other ZIP-The scaling will require custom recovery β€” TWRP. The process is more complicated than firmware via Fastboot, but gives more options.

Installation of TWRP Recovery

Download the latest version TWRP for Mi 5 (file twrp-3.6.2_9-0-gemini.img) and do it:

fastboot flash recovery twrp-3.6.2_9-0-gemini.img


fastboot boot twrp-3.6.2_9-0-gemini.img

After that, the phone will load into TWRP. Important: immediately make a backup of the EFS partition (contains IMEI and modem data)! To do this, go to TWRP Backup β†’ Select EFS β†’ Swipe for confirmation.

Firmware custom ROM

Installation algorithm:

  1. Download the firmware (ZIP-file) and, if necessary, Gapps (e.g. OpenGapps for Android 12).
  2. Transfer files to your phone or flash drive (TWRP has a file manager).
  3. V TWRP run the Wipe β†’ Advanced Wipe and mark: 🧹 Dalvik / ART Cache 🧹 System 🧹 Data 🧹 Cache

Then swipe for confirmation.

Install

Gapps

Install

Wipe β†’ Format Data

yes

Reboot β†’ System

⚠️ Note: If you have a customized ROM phone doesn't see SIM-Some builds (especially Chinese ports) don't have a module for European operators. Solution: run modem and EFS squirt TWRP.

πŸ’‘

Always check firmware compatibility with the Mi 5 model (codename gemini). Installing firmware for Mi 5s (capricorn) or Mi 5c (meri) will cause the device to fail!

Step 5: Solving Common Errors After Firmware

Even with the right actions, there can be problems, and let's look at the most common ones and how to fix them:

Mistake.Reason.Decision
Baseband unknownModem damaged (no communication)Sweat modem from stock firmware via Fastboot or TWRP.
Hanging on the Mi logoIncompatible firmware or installation errorLog in to Fastboot and run the official MIUI through the Mi Flash Tool.
No command in recoveryRecovery section damagedRefuse TWRP or stock recovery through fastboot flash recovery.
No IMEI.EFS section damagedRestore the EFS backup or use the IMEI Tool (requires root).
Fast battery dischargeUnoptimized core in custom firmwareInstall another core or return to stock MIUI.

If the phone doesn’t turn on at all (black screen, no button response), try EDL emergency mode.

  1. Download the firmware for EDL (see 4PDA).
  2. Connect your phone to your PC by holding Volume Up + Volume Down + Power (should be defined as Qualcomm HS-USB QDLoader 9008).
  3. Use the Mi Flash Tool in EDL mode to recover.

Important: EDL mode requires an authorized Xiaomi account with unlocked rights. Unauthorized use can result in permanent locking of the device.

FAQ: Frequent questions about the firmware Xiaomi Mi 5

Can I flash Mi 5 without unlocking the bootloader?
No, custom firmware or TWRP is required to unlock, but you can update the official MIUI via Updater or Mi Flash Tool in Save user data mode (if the bootloader is locked).
How to return the official status of the device after firmware?
To do this, run the official MIUI through the Mi Flash Tool in Clean all and lock mode, and then the bootloader will lock, and the Unlocked inscription will disappear in the settings, but note: this will erase all data again.
Which firmware is better for performance: stock MIUI or custom?
If you want to keep all the functions running (camera, NFC, IR-Blaster, choose the official blaster MIUI. Custom firmware (like Pixel Experience) gives a fresher Android and no bloat, but may be less optimized for the Snapdragon 820. MIUI background-deactivated.
How to flash Mi 5 if it doesn’t turn on (brick)
If the phone doesn't respond to buttons, but the PC detects it in Fastboot or EDL mode, try: Swipe the official firmware through the Mi Flash Tool. If it doesn't work, use EDL (requires an authorized account); in extreme cases, contact the service center (but it can be expensive for an old device).
Do I need to use the modem separately?
Usually not, the modem is stitched with the main firmware. However, if the network is lost after installing the custom ROM, download the modem from the stock firmware (NON-HLOS.bin file) and run it through Fastboot: fastboot flash modem NON-HLOS.bin