How to reflash Xiaomi device: official and alternative ways

Xiaomiโ€™s firmware is a process that can dramatically change the functionality of your gadget. Whether you want to upgrade to the latest MIUI, install custom firmware like LineageOS, or return the device to factory settings, the right approach guarantees success. But mistakes here can lead to the โ€œbrickingโ€ of the device โ€” turning it into a useless โ€œbrickโ€.

In this article, weโ€™ll look at all the current firmware methods, from official updates via Settings โ†’ About phone to manual installation via fastboot and recovery. Weโ€™ll focus on preparation, because 80% of the problems are due to missed steps at this stage. If youโ€™re a beginner, donโ€™t skip the bootloader unlock section, which is the basis for any unofficial firmware.

Itโ€™s important to understand that Xiaomiโ€™s smartphone firmware (whether itโ€™s Redmi Note 12, POCO X5 or Mi 11 Ultra) is different from that on other brands, and it uses a unique bootloader lock system, its own tools like the Mi Flash Tool, and even official firmware is unpacked in.tgz or.zip with a signature, and without these nuances, the risk of errors increases dramatically.

1. Preparation of the device for firmware: what to do before the beginning

The first and most critical stage is preparation. Here, many users make mistakes that lead to failures. Let's start with the basic one: check your device model. To do this, go to Settings โ†’ About Phone โ†’ Model or type in ##4636##. Write down the exact name (for example, Redmi Note 10 Pro has the code name sweet, and POCO F3 is alioth).

Then backup. The firmware erases all data if you choose the clean all option in the Mi Flash Tool. Use Mi Cloud, Google Drive, or local copy on your PC.

  • ๐Ÿ“ฑ Contacts (export to.vcf)
  • ๐Ÿ“ธ Photos and videos (check folders) DCIM and Pictures)
  • ๐Ÿ”‘ Passwords from applications (save in the Bitwarden type manager)
  • ๐ŸŽฎ Save games (use Helium or root backup if there is root)

It's just as important to check the battery power. 60%, Or better yet, on 80-100%. Interrupting the process due to battery discharge is almost guaranteed to result in loss. IMEI or damage to the modem partition, which will make the smartphone unsuitable for calls. USB-Cable: It is better to use the original one from Xiaomi, as cheap cables may not provide stable fastboot connection.

The last step is to install the necessary tools on the PC:

  • ๐Ÿ–ฅ๏ธ Mi Flash Tool (official firmware utility via fastboot)
  • ๐Ÿ”ง ADB Fastboot (part of Googleโ€™s Platform Tools)
  • ๐Ÿ“ฆ Xiaomi drivers (downloaded from en.miui.com)
  • ๐Ÿ”’ Unlock Tool (if you plan to unlock the bootloader)
๐Ÿ“Š What kind of firmware do you plan to install?
Official MIUI
LineageOS (Pixel Experience)
Stock without bloat
Another.

2. Unlock the bootloader: why it is necessary and how to do it correctly

The bootloader on all Xiaomi devices is locked by default, which is a security measure, but it also limits the user's ability.

  • ๐Ÿ”„ Install custom software (for example, LineageOS or HavocOS)
  • ๐Ÿ”ง Get root rights through Magisk
  • โšก Switch modified cores or recovery (TWRP)

The unlocking process is officially supported by Xiaomi, but has limitations. First, you will need a Mi Account tied to the device. Second, after unlocking, all data (including internal memory!) will be reset. Third, some models (for example, Redmi Note 9 Pro or Mi 10T) have a 72-hour wait after the account is tied.

Step-by-step:

  1. Activate OEM Unlock in Settings โ†’ Additional โ†’ For developers.
  2. Attach Mi Account to your device in Settings โ†’ Xiaomi Account.
  3. Download Mi Unlock Tool from the official website and run it on PC.
  4. Turn the phone into fastboot mode (turn off, then press Power + Volโˆ’).
  5. Connect to your PC and follow the instructions in the program (it may take several attempts).
What happens if you break the unlock?
Interrupting the boot boot boot unlocking process (e.g., disabling the cable) will cause the system to crash, at best, the device will boot into fastboot mode and require a second try, at worst, the boot partition will be damaged and the phone will stop turning on at all. Recovery is possible only through an authorized Xiaomi service center using special equipment (for example, the companyโ€™s service center, EDL-cable).

After successful unlocking, check the status of the team:

fastboot oem device-info

The answer should be Device unlocked: true. If you see false, repeat the process.

Linked Mi Account to the device|On. OEM Unlock in the Developer Settings|Download the official Mi Unlock Tool|Device charged to 80%+|There's original. USB-cable-->

3. Official firmware through Mi Flash Tool: step-by-step guide

If you need clean official firmware (for example, to recover from a crash or remove custom software), Mi Flash Tool is the most reliable method. This method is suitable for devices with unlocked and locked bootloader, but in the latter case you will only be able to flash a stable version of MIUI for your model.

Download the firmware from official sources:

  • ๐ŸŒ Official website MIUI (Choose a Global Region, EEA china)
  • ๐Ÿ”— Xiaomi Firmware Updater (alternative source with archived versions)

Note the version: Stable (stable), Developer (developer) or Beta (test). Stable is recommended for most users.

Firmware instructions:

  1. Unpack the downloaded.tgz or.zip archive into a folder without Cyrillic characters.
  2. Run the Mi Flash Tool on behalf of the administrator.
  3. Connect the device to fastboot (press Power + Volโˆ’).
  4. In the program, click Select and specify the path to the folder with the firmware.
  5. Select firmware mode: Clean all โ€“ complete cleaning (recommended in case of failures) Clean all and lock โ€“ cleaning + lock Save user data bootloader โ€“ data storage (not always stable)

Flash

1. Reinstall drivers manually through Device Manager.

2. Use another USB-Port (preferably 2.0, not 3.0).

3. Run the program in compatibility mode with Windows 7.-->

Once the firmware is successful, the device will automatically restart. It can take up to 10 minutes to start the first run โ€” don't interrupt the process. If the phone is stuck on the MI logo after the firmware is installed, try resetting the settings via recovery (Power + Vol+).

4. Install custom firmware: TWRP and alternative OS

Custom firmware like LineageOS, Pixel Experience or ArrowOS gives you access to pure Xiaomi-free Android, regular security updates and additional features, but they require an unlocked bootloader and custom recovery (usually TWRP).

Before you start, check the support for your model in the forums:

  • ๐Ÿ”— XDA Developers (search for model code, for example, surya for the POCO X3)
  • ๐Ÿค– Telegram chats on specific devices

The TWRP installation process:

  1. Download the image TWRP for your model (for example, twrp-3.7.0_12-surya.img).
  2. Transfer the device to fastboot and connect to the PC.
  3. Select the recovery team: fastboot flash recovery twrp.img fastboot boot twrp.img
  4. After downloading to TWRP, backup the Boot, System and Data partitions (in case of rollback).

Installation of custom firmware:

  1. Download firmware (e.g. lineage-20.0-20231010-nightly-surya-signed.zip) and, if necessary, Gapps (Google services).
  2. Transfer the files to the device or flash drive.
  3. In TWRP, run Wipe โ†’ Advanced Wipe and mark Dalvik, Cache, System, Data.
  4. Install the firmware through Install, then Gapps (if needed).
  5. Reboot. The first launch can take up to 20 minutes.

๐Ÿ’ก

Custom firmware often does not support data encryption on some Xiaomi devices. If after installation, the system asks for a password, but does not accept it, try formatting Data into TWRP (and all data will be deleted).

5. Firmware through EDL: Recovery of Bricks

EDL (Emergency Download Mode) is the last chance to bring back to life a device that does not turn on, is not detected in fastboot or produces errors such as Qualcomm HS-USB QDLoader 9008. This method requires a special cable or lintel on the board, as well as an authorized Xiaomi account (for new models).

Pre-launch warnings:

โš ๏ธ Attention: Firmware through EDL erase IMEI, MAC-Addresses and serial numbers of modules (camera, Wi-Fi) will have to be restored separately using tools like SN Writer or QFil.

Tools required:

  • ๐Ÿ”Œ EDL-cable (or a jumper for closing contacts test point)
  • ๐Ÿ–ฅ๏ธ Mi Flash Pro (paid version with support) EDL)
  • ๐Ÿ“ฆ Firmware in.mbn or.elf format (see for 4PDA or XDA)
  • ๐Ÿ”‘ Authorized Xiaomi account (for models after 2020)

Firmware process:

  1. Connect the device in EDL mode (via cable or contact closure).
  2. In Mi Flash Pro, select firmware and press Refresh โ€“ the device should be defined as COM-port.
  3. Press Flash and wait until it is completed (it can take up to 30 minutes).
  4. After the reboot, restore the IMEI with SN Writer or Maui META.

If the device is not identified in the EDL, check:

  • Cable (must be original or with a bar)
  • Drivers (Qualcomm HS-USB QDLoader 9008 in Device Manager)
  • Bar (on some models you need to close the contacts on the board)

6. Frequent errors and their solutions

Even if you follow the instructions accurately, you can get errors, and let's look at the most common ones and how to fix them:

Mistake.Reason.Decision
Fastboot: unknown commandThe Wrong Path to Fastboot or DriversCheck the environment variables or point the full path to fastboot.exe
This package is for "surya" devices; this is a "haydn".The firmware is not suitable for the modelDownload the firmware for the correct device code (e.g. haydn instead of surya)
Hanging on the MI logoA boot partition or incompatible kernel is damagedSelect boot.img separately via fastboot flash boot.img
Mi Flash: flash_write failureProblems with USB-junction or damaged firmwareTry another cable/port or download the firmware again
No network after firmwareLost IMEI or damaged modemRestore IMEI via SN Writer or run modem separately

If the device doesnโ€™t turn on after a failed firmware, try the following steps:

  1. Press the Power + Vol+ for 20-30 seconds (sometimes helps with a soft brick).
  2. Connect to charging for 1-2 hours - it is possible that the battery is completely discharged.
  3. Try flashing through fastboot or EDL (if the device is defined).

โš ๏ธ Note: On devices with MediaTek processor (e.g. Redmi) 9A or POCO C31) Firmware through fastboot can lead to hardware locking of the bootloader, in which case recovery is possible only through SP Flash Tool with an Authorized Account.

7.Optimization after firmware: what to do first

Once the firmware is successful, the device requires additional customization. Start by checking the basic features:

  • ๐Ÿ“ž Telephony: Make a test call and check IMEI (Enter *#06#).
  • ๐ŸŒ Internet: Connect to Wi-Fi and Mobile Network.
  • ๐Ÿ”‹ Battery: Calibrate (discharge to 0% and charge to 100% without interruptions).
  • ๐ŸŽต Sound: Check the speakers and microphone.

For official MIUI, it is recommended:

  • ๐Ÿ”„ Update all apps through Google Play.
  • ๐Ÿšซ Disable unnecessary system services (such as msa or analytics) ADB: adb shell pm uninstall -k --user 0 com.miui.analytics
  • ๐Ÿ”’ Install Magisk for root rights (if necessary).

For custom firmware:

  • ๐Ÿ”ง Set up SELinux in Enforcing mode (for security).
  • ๐Ÿ“ฑ Install a GCam-enabled kernel (if the camera is not working properly).
  • ๐Ÿ”„ Check for updates via Settings โ†’ System โ†’ Updater.

If the device warms up or discharges quickly after firmware, reset via recovery (Wipe โ†’ Factory Reset) to help clear the cache and residual files of the previous system.

FAQ: Answers to Frequent Questions

โ“ Can I flash Xiaomi without unlocking the bootloader?
Yes, but only official firmware via the Mi Flash Tool in Save user data or Clean all and lock mode. Custom firmware and modifications (such as TWRP or Magisk) require unlocking.
โ“ How to return the official firmware after custom?
Download the official firmware for your model in.tgz format and run through the Mi Flash Tool in Clean all mode. If the bootloader was unlocked, it can be blocked back by the fastboot oem lock command, but this erases all data.
โ“ Why there is no network signal after the firmware?
This is due to loss of IMEI or damage to the modem partition.Restore IMEI using SN Writer or thread modem separately via fastboot flash modem modem.img.
โ“ Can I use Xiaomi on Mac or Linux?
Yes, but you'll need to install ADB/Fastboot via brew install android-platform-tools (Mac) or sudo apt install android-tools-adb (Linux). Mi Flash Tool only works on Windows, but you can use scripts or TWRP to run your firmware through fastboot.
โ“ How to know if the bootloader is unlocked?
Turn off the device, then press Power + Vol+. If you see Unlocked with an open lock, the bootloader is unlocked. You can also check the fastboot oem device-info command (Device unlocked: true).