How to change the firmware on the Xiaomi phone: official and custom methods

Xiaomiโ€™s smartphone firmware is a process that can both bring a device back to life and turn it into a โ€œbrickโ€ if you approach it without preparation. Unlike a regular update through Settings โ†’ Phone โ†’ Updating the system, completely replacing the firmware requires unlocking the bootloader, choosing the right version of the software and carefully executing instructions. In this article, we will analyze all the methods of firmware โ€“ from official MIUI to custom builds based on Android, and also tell you how to avoid typical mistakes that even experienced users make.

Many people think that the firmware is only needed to โ€œreanimateโ€ the phone after a crash, but in fact it solves other problems: removing preinstalled software (bloatware), installing a global version instead of the Chinese, switching to Android without a MIUI shell (for example, LineageOS or Pixel Experience), as well as overclocking performance on older models. However, before you start, it is worth assessing the risks: loss of warranty, possible bugs in custom firmware and even blocking IMEI when the modem part is incorrectly firmware.

In this article, we won't convince you to firmware, but instead provide the full information so you can make an informed decision. If your goal is to just upgrade to the latest version, maybe the standard version is enough. OTA-But if you want to change the behavior of the phone, remove the manufacturer's restrictions, or restore the brick-and-brick machine, read on.

1. Firmware Preparation: What to Do Before Starting

The first and most important step is data backup, which erases all information from the /data partition, including photos, contacts and messages. Even if you plan to stitch your phone without a dirty flash, the risk of data loss remains. Use Mi Mover (a built-in Xiaomi app) or third-party utilities like Titanium Backup (requires root).

Next, check the phone model and the current firmware version. This is critical, as the firmware from the Redmi Note 10 Pro (sweet) will not work for the Poco X3 Pro (vayu), even if the devices are similar in appearance. You can find out the code name of the model in Settings โ†’ About Phone โ†’ MIUI version (click several times on the โ€œCoreโ€) or via the command:

adb shell getprop ro.product.device

Also prepare:

  • ๐Ÿ”Œ Cable USB Type-C (original or high-quality โ€“ cheap cables can interrupt data transmission).
  • ๐Ÿ’ป Computer on Windows 10/11 Linux (MacOS will require additional drivers).
  • ๐Ÿ”‹ Battery charge of at least 60% (firmware can take up to 30 minutes, and discharging during the process will lead to failure).
  • ๐Ÿ“ฅ Firmware that corresponds to your model (official or custom).

โš ๏ธ Note: If your Xiaomi is purchased in China, chances are that it has firmware tied to your Mi Account. After the firmware is installed, you may need to unlock the global version through the official service, otherwise the phone will be locked during the first setup stage.

๐Ÿ“Š What kind of firmware do you plan to install?
Official MIUI (Stable/Beta)
Custom (LineageOS, Pixel Experience, etc.)
Stock Android without MIUI
I haven't decided yet.

2 Unlocking the bootloader: without this firmware is impossible

The bootloader on all Xiaomi smartphones is locked by default, a security measure that prevents uncertified software from being installed. To unlock it, you need to get permission from Xiaomi through the official Mi Unlock Tool utility.

The unlocking process takes 3 to 30 days (depending on Xiaomiโ€™s policy) and requires you to link your Mi Account to your phone.

  1. Download Mi Unlock Tool from the official website.
  2. Turn on the developer mode on the phone (click 7 times on "Version" MIUIยป In Settings โ†’ The phone).
  3. Activate in the OEM Unlock developer settings and USB debugging.
  4. Connect your phone to your PC, launch the Mi Unlock Tool, and log in to the same Mi Account as your phone.
  5. If you see a message that says โ€œNeed to bind accountโ€, you have to wait (usually 72-168 hours).

Once successfully unlocked, the phone will restart and you will see a warning about the unlocked bootloader each time you turn on.This is normal โ€“ this is how Xiaomi signals that the device can be stitched with unofficial software.

โš ๏ธ Warning: Unlocking the bootloader resets the phone to factory settings. If you don't backup in the first phase, the data will be lost without recovery.

Linked to Mi Account on phone|On. OEM Unlock in the Developer Settings|Drivers installed ADB PC-only|The phone is charged at least 60 times%|Backup of important data is made-->

3. firmware selection: official MIUI vs custom builds

Before you download the firmware, determine the purpose:

  • ๐Ÿ”„ Want to return the phone to the โ€œfactoryโ€ state? โ†’ Official. MIUI (stable).
  • ๐ŸŒ We need a global version instead of a Chinese version? โ†’ MIUI Global Stable.
  • ๐Ÿš€ You want to get rid of it. MIUI And get a "clean" Android? โ†’ Castom firmware (LineageOS, Pixel Experience, ArrowOS).
  • โšก You need to โ€œdisperseโ€ the old phone? โ†’ Firmware with an optimized core (for example, Corvus) OS POCO F1).

Official firmware downloaded from the sites:

  • Official MIUI archive (select the version for your model by device code).
  • Xiaomi Firmware Updater (alternative source with current versions)

For custom firmware, use resources:

  • XDA Developers (the largest forum with firmware and instructions)
  • SourceForge (hosting for projects like LineageOS)

In the table below - a comparison of official and custom firmware:

CriteriaOfficial MIUICastom firmware (AOSP)
Stabilityโญโญโญโญโญ (tested by Xiaomi)โญโญโญ (build-dependent)
Security updatesRegular (1 time in 1-3 months)Monthly (if supported)
MIUI functionsAll available (themes, second space, etc.)Absent (Pure Android)
ProductivityOptimized for the mass userMaybe higher (no Bloatware available)
GuaranteeIt is saved (if the firmware is official)Lost.

๐Ÿ’ก

If you choose custom firmware, pay attention to user reviews of your model on XDA or 4PDA. Some builds may have critical bugs, such as a broken camera module or mobile network issues.

4. Firmware methods: from Fastboot to TWRP

There are three main methods of Xiaomi firmware:

  1. Through Fastboot (official method, suitable for installing MIUI).
  2. Through TWRP (unofficial recaveri, allows you to install custom firmware).
  3. EDL (Emergency mode if the phone is not turned on).

Method 1: Fastboot firmware (for official MIUI)

This method is suitable for installing official firmware and requires an unlocked bootloader.

  1. Download the firmware in.tgz or.zip format and unpack it into a folder.
  2. Connect your phone to your PC in Fastboot mode (clip Volume Down + Power when your phone is off).
  3. Run the file from the firmware folder flash_all.bat (for Windows or flash_all.sh (for Linux/Mac).
  4. Wait until the phone is finished (the phone will reboot automatically).

Method 2: Firmware via TWRP (for custom firmware)

This method requires first installing TWRP Recovery, an alternative recovery that supports.zip installation, which is more complex but provides more options:

  1. Download TWRP for your model from the official website.
  2. Install it via Fastboot command: fastboot flash recovery twrp-3.7.0-your model.img
  3. Boot to TWRP (click Volume Up + Power).
  4. Make a backup of the current firmware (Backup option in TWRP).
  5. Sweep through custom firmware by selecting the.zip file in the Install section.

โš ๏ธ Note: Some Xiaomi models (such as the Redmi Note 9 Pro on the Snapdragon processor) have Anti-Rollback protection. If you flash an older firmware version than the one originally installed, the phone can lock permanently!

What is Anti-Rollback?
This is a security mechanism that prevents you from rolling back on an older firmware version. For example, if your Xiaomi came out with a factory firmware based on Android 11, and you try to flash the Android 10 version, the phone will lock. Check the current version of Anti-Rollback in TWRP or through the fastboot getvar anti command.

5. Common Mistakes and How to Avoid Them

Even experienced users sometimes experience firmware problems, and here are the most common bugs and solutions:

  • ๐Ÿ”ด This package is for... but your device is..." โ†’ You didn't download the firmware for your model.
  • ๐Ÿ”ด The phone is stuck on the logo. MI post-fix โ†’ Probably an incompatible version. MIUI Or you've got a kernel that's wrong. Try flashing it back through Fastboot with a full reset. -w).
  • ๐Ÿ”ด Mobile network or Wi-Fi is not working โ†’ Modem is missing or incorrectly stitched. Set the file separately firmware.zip for your model.
  • ๐Ÿ”ด TWRP asks for a password when downloading โ†’ That means encryption is enabled. /data. You need to reset your settings via Wipe โ†’ Format Data (all data will be deleted!).

If the phone stopped turning on after a failed firmware, try to recover through EDL-The emergency mode (emergency firmware) will need to be:

  • USB cable with EDL support (not all cables are suitable!)
  • Mi Flash Tool or QFil (for Qualcomm devices)
  • Firmware in.mbn or.elf format.

Note: Firmware via EDL may require authorization of a Xiaomi account if the phone was linked to Mi Account.

๐Ÿ’ก

If the phone doesn't turn on after the firmware, don't panic. In 90% of cases, it can be restored via Fastboot or EDL. The main thing is not to try to stitch random files, but to use firmware strictly for your model.

6. Firmware for the advanced: custom cores and mods

If you've already stitched custom firmware and want to get the most out of your phone, you can install a custom core or additional mods.

  • ๐Ÿ”‹ Cores with improved battery management (e.g. FrancoKernel for Snapdragon).
  • ๐ŸŽฎ Gaming cores (overclocking) CPU/GPU, like Kiriskernel).
  • ๐Ÿ“ก Mods to improve communication (e.g. Network Signal Guru for manual antenna tuning).

The custom core is installed via TWRP or Magisk (if the kernel supports modules).

  • Before installing, check the compatibility of the kernel with your firmware and Android version.
  • Some cores require additional settings in Kernel Adiutor or EX Kernel Manager.
  • After installing the kernel, you may need to flash DTBO (for devices with Dynamic Partitions).

Example of a command to firmware the kernel through Fastboot:

fastboot flash boot magisk_patched.img


fastboot flash dtbo dtbo.img

โš ๏ธ Warning: An incompatible core can cause the processor to overheat, quickly discharge the battery, or even damage the hardware.Start with cores that have positive feedback on forums.

7.Recovery of IMEI and other critical data

After the firmware, some users face a loss IMEI, MAC-This is due to the incorrect firmware of the modem or nvram partition. IMEI several ways:

Method 1: Engineering Menu (for Qualcomm)

  1. Enter the dialer code: ##4636##.
  2. Go to Phone Information โ†’ Settings and select GSM/CDMA auto.
  3. If you do not have an IMEI, use the SN Write Tool (requires Mi Account authorization).

Method 2: TWRP (for MediaTek)

  1. Download the nvram backup for your model (look for 4PDA or XDA).
  2. Sweep it through TWRP to the nvram section.
  3. Reboot the phone.

If none of the methods did not help, contact the service center - self-restore IMEI without knowing the technical nuances can lead to complete loss of communication and modem lock.

๐Ÿ’ก

Before the firmware save the original IMEI. You can find it on a phone box or under a battery (if it's removable). IMEI It is displayed in the settings: About the phone โ†’ General information โ†’ Status.

FAQ: Answers to Frequent Questions

Can I use Xiaomi without unlocking the bootloader?
No, officially, it's impossible. All modern Xiaomi smartphones (since 2016) have a locked bootloader. The only exception is the firmware via EDL with Mi Account authorization, but this requires special hardware and is often only used in service centers.
How to return the official firmware after custom?
To do this, you need to flash the official MIUI through the Fastboot with a full reset (fastboot -w). If you have a TWRP installed, pre-delete it, as it may conflict with the official firmware. Once you return to MIUI, the bootloader will remain unlocked, but you can lock it again through the Mi Unlock Tool (the Lock Bootloader option).
Why does Google Pay not work after the firmware?
This is due to the SafetyNet trigger, the Android integrity check system. Custom firmware and unlocked bootloader automatically make the device "uncertified." Solutions: Install Magisk and activate Universal SafetyNet Fix and MagiskHide Props Config modules. Check the certification in settings: Settings โ†’ Google โ†’ If it doesn't work, go through the official MIUI and lock the loader.
Can I use Xiaomi on MacOS?
Yes, but with reservations. Fastboot firmware will require Android SDK drivers and fastboot utility (installed via Homebrew). However, Mi Unlock Tool does not officially support macOS - you will need to use a Windows virtual machine or Boot Camp to unlock the bootloader.
What to do if the phone overheats after the firmware?
Overheating after firmware is usually associated with: Incompatible custom core (go back to the drain), background processes (check Settings โ†’ Battery), GPU malfunction (update drivers through firmware firmware). If the temperature exceeds 50 ยฐ C in plain, go back to the official firmware and check the phone at the service center (possible hardware defect).