How to reflash Xiaomi smartphone via TWRP: a complete guide from unlocking to installing firmware

Reflashing a Xiaomi smartphone via TWRP (Team Win Recovery Project) is one of the most popular ways to install custom firmware, cores or modified versions of MIUI. This method gives the user complete control over the system, allowing you to bypass the limitations of stock software, install informal updates or even restore bricks after unsuccessful experiments.

Unlike the standard Settings β†’ About Phone β†’ System Upgrade, TWRP firmware involves working with an unlocked bootloader, installing a third-party backup and manually downloading files. This is not an official method, so Xiaomi is not responsible for the possible consequences, but this approach opens up access to functions that are not in stock firmware: from removing embedded software to installing Google Camera with full functionality.

In this article, we will go into detail about the entire process, from preparing the device to the final configuration after the firmware, and focus on the typical errors that beginners make and how to avoid them. If you have never worked with ADB, Fastboot or TWRP, don’t worry: the manual is adapted for users of all levels.

1. Preparation of the smartphone: unlocking the bootloader

The first and most critical step is to unlock the bootloader, without which installing TWRP or custom firmware is impossible. Xiaomi officially allows you to unlock the bootloader, but the process takes time and meets several conditions:

  • πŸ“± The device must be linked to your Mi Account (required to have a confirmed phone number).
  • πŸ”— On the smartphone should be included debugging on USB (Settings β†’ The phone. β†’ Version. MIUI β€” 7 times to tap, then additional settings β†’ For developers β†’ Debugging by USB).
  • πŸ”“ Unlocking is possible only through the official Mi Unlock Tool (you can download it on the Xiaomi website).
  • ⏳ After linking an account to a device, you need to wait 7 days (for new accounts) or 30 days (if the account was created less than 30 days ago).

The process of unlocking looks like this:

  1. Download and install Mi Unlock Tool on PC (Windows only).
  2. Launch the utility on behalf of the administrator and log in to your Mi Account.
  3. Connect your smartphone in Fastboot mode (turn off the device, then press Volume Down + Power).
  4. In the utility, press Unlock and wait for the process to complete (usually takes 1-2 minutes).

⚠️ Warning: Once the bootloader is unlocked, the smartphone will reset to factory settings. All data, including photos, contacts and apps, will be deleted without recovery. Backup in advance via Settings β†’ Additional settings β†’ Backup and Reset or Mi Cloud.

πŸ“Š What is your experience with custom firmware?
First time I've tried.
Xiaomi has already been stitched through TWRP
I only use official updates.
I prefer not to risk it.

2. Install TWRP Recovery on Xiaomi

Once the bootloader is unlocked, you can start installing TWRP. This custom recavery will replace the standard MIUI recovery and allow you to install firmware, make backups and manage memory partitions. It is important to choose the right version of TWRP for your Xiaomi model - there are no universal builds!

A list of officially supported devices and current versions of TWRP can be found at twrp.me. For example, the Redmi Note 10 Pro (sweet) and Poco X3 Pro (vayu) use different builds. If your model is not on the list, look for unofficial ports on the XDA Developers or 4PDA forums.

Installation instructions:

  1. Download the.img file from TWRP for your model.
  2. Connect your smartphone to your PC in Fastboot mode (as when unlocking the bootloader).
  3. Open the command line (CMD) In the folder from fastboot and type the command: fastboot flash recovery twrp-3.7.0_12-0-sweet.img (substitute twrp-3.7.0_12-0-sweet.img in the name of your file).
  4. After successful installation, restart to TWRP, holding Volume Up + Power.

⚠️ Note: Some Xiaomi models (e.g. Redmi Note 8 Pro on Mediatek) require additional manipulation of the preloader partition or the use of patches to bypass protection. TWRP The smartphone does not load, check the current discussions on the 4PDA β€” They often provide solutions for specific devices.

β˜‘οΈ Preparation for installation TWRP

Done: 0 / 4

3. Backup (backup) creation in TWRP

Before you run your firmware, make sure to make a full backup of your current system. This will save your data if something goes wrong. TWRP allows you to save images of all partitions, including boot, system, data and vendor. Backup takes up a lot of space (usually 4-8 GB), so make sure that there is enough free space on the memory card or outside the memory.

How to make a backup:

  1. In the main TWRP menu, select Backup.
  2. Check the boxes: Boot, System, Data, Vendor (the rest can be skipped).
  3. Select a place of preservation (better to save) SD-map, if there is one).
  4. Swipe to start building the backup. 10-20 minute.

The saved backup can be restored at any time through the same Restore section in TWRP. If the smartphone does not boot after firmware, the backup is your only chance to return to work without losing data.

What if the backup is not created?
If TWRP gives an error when creating a backup, try: SD-map FAT32 (Use internal memory (sometimes) TWRP I can't see the external drives. - Refresh the latest version TWRP (It is possible that your build contains bugs. - Check the integrity of the file system via Wipe β†’ Format Data (WARNING: This will delete all data!).

4. Selection and download of firmware for Xiaomi

Now you have to choose which firmware you want to install.

  • πŸ“¦ Official. MIUI (Xiaomi stock firmware – suitable if you want to return the smartphone to the β€œfactory” state or upgrade to the latest version without waiting OTA.
  • πŸ”§ Base-based castor firmware AOSP (LineageOS, Pixel Experience, Havoc-OS – give a β€œpure” Android without a shell MIUI.
  • ⚑ Modified MIUI (for example, MIUI EU, MIUI Pro) β€” stock firmware without Chinese applications and with additional features.
  • πŸ› οΈ Cores and patches (e.g. KernelSU for root rights) – installed on top of the main firmware.

Where to download:

Type of firmwareSourceExample of model
Official MIUIOfficial Xiaomi websiteRedmi Note 11 Pro+ 5G (veux)
MIUI EU (no bloat)Xiaomi.euPoco F4 GT (ingres)
LineageOSLineageOS DownloadsRedmi Note 10 (mojito)
Pixel ExperiencePixel ExperiencePoco X3 NFC (surya)

Before downloading, check:

  • πŸ” Compatibility of the firmware with the code name of your device (for example, Redmi Note 9 Pro is joyeuse, not curtana).
  • πŸ“… Build Date – Older versions may contain vulnerabilities.
  • πŸ“Œ Installation instructions (some firmware requires pre-cleaning of partitions).

πŸ’‘

If you are installing custom firmware for the first time, choose builds marked Stable or Official. Experimental versions (Beta, Nightly) may contain critical bugs.

5. The firmware process through TWRP: step-by-step instruction

When the firmware is downloaded and transferred to the smartphone (best for the SD-So, the map or the internal memory, you can start the installation:

  1. Boot to TWRP (hold Volume Up + Power when turned on).
  2. If the firmware is in.zip format, select Install, find the file and swipe for confirmation.
  3. For firmware in.img format (such as kernels), use Install β†’ Install Image and select the appropriate section (boot, vendor_boot etc.).
  4. Once installed, run Wipe β†’ Format Data (if required for your firmware) and restart.

Features for different types of firmware:

  • πŸ”„ Official. MIUI: It does not usually require Format Data, but may require cache cleaning (Wipe) β†’ Advanced Wipe β†’ Dalvik / ART Cache, Cache).
  • πŸ”§ Custom firmware (AOSP): Almost always need a complete data cleanup, otherwise there may be hang-ups and errors.
  • ⚑ MIUI EU: Sometimes you need to install before installation. fw_vendor (firmware file for the vendor section).

If you've got a smartphone stuck on the MI or Fastboot logo after you've run it, then something's gone wrong.

  1. Return to TWRP (Hold Volume Up + Power When Downloading).
  2. Try repeating the firmware or restoring the backup.
  3. If there is no backup, run the official MIUI through Fastboot (the instructions are on the Xiaomi website).

πŸ’‘

Never install firmware from other models, even if they are "similar." For example, the firmware for the Redmi Note 10 (mojito) will not work for the Redmi Note 10S (rosemary) - this is a guaranteed "brick".

6.Setting up the system after firmware

If the firmware is successful and the smartphone is loading, congratulations, but the work is not finished.

  1. Initial setup: Go through the initial setup process (selecting language, connecting to Wi-Fi, logging in to your Google/Mi Account).
  2. Functionality Check: Make sure the basic functions are working: πŸ“Ά Mobile network and calls. πŸ“· Camera (sometimes drivers need to be installed). πŸ”Š Sound and speakers. πŸ”‹ Charging and determining the level of the battery.

Installation of Magisk (optional):

Magisk

.zip

TWRP

Data recovery:

TWRP

Typical problems after firmware and their solution:

Problem.Possible causeDecision
The mobile network is not workingThere is no IMEI or incorrect APN settingsCheck it out. IMEI *#06#, if necessary, to re-establish QCN-file
Smartphone overheatingIncompatible core or background processesSwipe another core or reset the settings
Google Pay is not working.Installed by Magisk or modified bootHide the route via MagiskHide or flash Universal SafetyNet Fix

If you have installed custom firmware based on AOSP, note that some MIUI features may not be available, such as:

  • πŸ”‹ No built-in ultrafast charging mode (single modules must be installed).
  • πŸ“Έ There is no firmware for a wide-angle camera (solved by installing GCam with the correct config).
  • πŸ”Š No uniformity of the sound Mi Sound Enhancer (can be replaced by a new one) ViPER4Android).

7.Typical mistakes and how to avoid them

Even experienced users sometimes make firmware errors through TWRP, and here are the most common ones and ways to prevent them:

  • 🚫 Firmware of the wrong version: For example, an attempt to install MIUI 14 for Redmi Note 9 on Redmi Note 9S. Always check the code name of the device through fastboot getvar product.
  • πŸ”Œ Interrupting: If your smartphone shuts off your PC or dies during firmware, you run a high risk of getting a brick. Charge your device at least 80% and use the original one. USB-cable.
  • πŸ”„ Skip Format Data step: For custom firmware, this almost always leads to endless downloads. Always read the instructions for a specific build!
  • πŸ”’ Locking the bootloader after firmware: On some models (for example, Xiaomi 12) after installing the unofficial firmware, the bootloader can lock. MIUI via Fastboot and repeat the unlock.

If your smartphone stops turning on (the "brick"), don't panic. In 90% of cases, it can be restored:

  1. Try booting up to Fastboot (Loudness Down + Power) and flashing the official firmware through the Mi Flash Tool.
  2. If the Fastboot is not responding, check if the device is detected in EDL-mode (needs a special cable or testpoints).
  3. In extreme cases, contact the service center – many workshops restore Xiaomi even after a β€œhard” brick.

πŸ’‘

Before the firmware save the file persist.img backup TWRP. It contains unique device data (IMEI, MAC-Addresses, etc., which can be lost in case of a failed firmware.

FAQ: Frequent questions about Xiaomi’s firmware through TWRP

Can I flash Xiaomi through TWRP without unlocking the bootloader?
No, it's impossible. TWRP is installed in the recovery partition, which is blocked by the bootloader, and even if you can temporarily boot into TWRP (for example, through a fastboot boot), you won't get anything to flash it back, and the system will return the stock recavers the first time you restart.
How to find out the code name of your Xiaomi?
There are several ways: Enter the command in the ADB terminal: adb shell getprop ro.product.device Look at the settings: Settings β†’ About phone β†’ MIUI version β†’ Full specification (sometimes the code name is in the "Device Model" line). Use applications like Droid Hardware Info or AIDA64.
Why does the touchscreen not work after the firmware?
This is a problem for informal firmware, where sensor drivers are incorrectly spelled out. Solutions: Sweep through another firmware version (preferably official or verified by users of your model); install a patch for the sensor (search for 4PDA or XDA on the device model); If nothing helps, restore the backup or run the stock MIUI through Fastboot.
Can I revert to the old version of MIUI after the firmware?
Yes, but with reservations: To roll back to an older version of MIUI, you sometimes need to flash an anti-rollback patch, otherwise the device will lock. When you roll back from Android 13 to Android 12, you may have problems with the camera modules or network functions.
How to update TWRP to the latest version?
The TWRP update is done in the same way as the original installation: Download a new.img file from the TWRP site. Download to the current TWRP. Select Install β†’ Install Image and swipe the new file to the Recovery section. Reboot to the recovery to check the health. Some versions of TWRP support the update via the recovery itself (Advanced β†’ Update Recovery section).