Xiaomi’s firmware through TWRP: from unlock to install

Why would you want to use Xiaomi on TWRP?

The firmware of Xiaomi’s smartphone via TWRP (Team Win Recovery Project) provides access to custom firmware, cores and mods that are not in the official MIUI updates. This is the only way to install LineageOS, Pixel Experience or Havoc-OS on devices with a locked bootloader from the manufacturer. But the process requires care: a mistake at any stage can turn the phone into a β€œbrick”.

Unlike the standard upgrade via Settings β†’ About Phone β†’ System Update, TWRP firmware gives you full control over system partitions. You can remove Xiaomi's built-in apps (bloat), change the CPU frequency, or even install Google Camera with full support for all camera modules, but you have to unlock the bootloader, which resets the phone to factory settings and voids the warranty.

This instruction will be suitable for most Xiaomi, Redmi and POCO models released after 2018 (for example, Redmi Note 10 Pro, Xiaomi 12T, POCO F4). For older devices (before Xiaomi Mi 8), the process may be different – they have a different mechanism for unlocking the bootloader.

Preparation: What is needed before the firmware?

Before you start, make sure you have:

  • πŸ”‹ Charged smartphone (at least 70% battery) firmware can take up to 30 minutes, and discharging in the process will lead to failure.
  • πŸ’» Windows computer 10/11 Linux (MacOS will require additional drivers).
  • πŸ”Œ Cable USB Type-C (original or certified) Cheap cables may not transmit data to fastboot.
  • πŸ“ Backup data. Firmware through TWRP format /data and /system.

Also check your device model in Settings β†’ About Phone β†’ Model. For example, the Redmi Note 11 Pro+ 5G has the code name veux, and the Xiaomi 13 is fuxi. This is necessary for downloading the correct version of TWRP and firmware.

πŸ“Š What kind of firmware do you plan to install?
Official MIUI (via TWRP)
LineageOS (Pixel Experience)
Stock firmware with removed bloat
Other

⚠️ Note: If your device is purchased in China (suffix version) CN in the model), firmware global version MIUI It can block the network. Check compatibility on the forum. XDA Developers.

Step 1: Unlocking the Xiaomi bootloader

The Xiaomi bootloader is locked by default. To unlock it, you need to get permission from the manufacturer through the official Mi Unlock Tool tool.

  1. Download Mi Unlock Tool from the official Xiaomi website (Windows version).
  2. Turn on the phone Developer Mode: go to Settings β†’ About Phone and 7 times click on the MIUI version.
  3. Back to Settings β†’ Additionally. β†’ For developers and activate: πŸ”“ Unlocking OEM (may be required PIN-code). πŸ”Œ Debugging by USB.

Connect your phone to your PC, launch the Mi Unlock Tool, and log in to your Mi Account (it should be linked to the device).

Follow the instructions of the program. Unlocking will take 72-168 hours (depending on Xiaomi policy).

Once successfully unlocked, the phone will automatically reset to factory settings.Do not disconnect the device from the PC during the process - this can lead to a permanent lockdown of the bootloader.

Linked to Mi Account |

USB| debugging enabled

Installed drivers ADB/Fastboot|

Data backup |

Battery charge > 70%-->

Step 2: Installation of TWRP Recovery

Once you unlock the bootloader, you can install TWRP. This customized Recovery will allow you to sew informal firmware and make backups.

Download the current version of TWRP for your model from twrp.me (see device code, for example, alioth for POCO F3).

  1. Move the downloaded file twrp-3.7.0_12-0-alioth.img To the folder with platform-tools (from Android) SDK).
  2. Open the command line (Win + R β†’ cmd) and go to the folder with platform-tools: cd C:\platform-tools
  3. Turn off the phone and press Volume Down + Power to log into the Fastboot.
  4. Connect the phone to your PC and check the connection with the command: fastboot devices If the device is determined (the serial number will appear), continue.
  5. Please. TWRP Team: Fastboot Flash Recovery twrp-3.7.0_12-0-alioth.img
  6. After successful firmware reboot to recavator: fastboot boot twrp-3.7.0_12-0-alioth.img

⚠️ Note: On some models (Xiaomi) 12/13 series, Redmi K50) post-fix TWRP The system can automatically restore the stock Recovery, so to avoid this, immediately after entering the receptacle. TWRP Go to Advanced. β†’ Flash Current TWRP.

πŸ’‘

If the fastboot device command doesn’t show your device, install Google USB Driver drivers or use the Mi Flash Tool to install it automatically.

Step 3: Creating a backup in TWRP

Before you run the firmware, make sure to back up your current system, which will save your data if something goes wrong.

  1. In TWRP, go to the Backup section.
  2. Select the backup sections: πŸ“ Boot (Boot section). πŸ“ System (system partition). πŸ“ Data (user data). πŸ“ Vendor (firmware of the supplier).

Press Select Storage and select Micro SD Card or USB OTG (if the backup on internal memory, it will disappear after formatting).

Swipe to start the backup. It can take 10 to 30 minutes.

Backup files will be saved in the TWRP/BACKUPS folder. Copy them to the PC or cloud - they will come in handy if the firmware ends in an error.

SectionWhat it keeps.Should I backup?
BootThe kernel and boot filesβœ… Yes.
SystemOS and pre-installed annexesβœ… Yes.
DataPhotos, messages, settingsβœ… Yes.
VendorModule drivers and firmware⚠️ Only if you're casting a caste.
EFSIMEI and network settingsβœ… I'll be sure!

Step 4: Firmware through TWRP

Now you can install firmware. To do this, download the appropriate.zip file:

  • πŸ“± Official. MIUI (for example, MIUI 14) β€” from en.miui.com.
  • πŸ› οΈ Brush firmware (LineageOS, ArrowOS) – from the forum XDA Developers.
  • 🧹 Firmware without bloat - look for xiaomi.eu (version) MIUI EU).

Installation instructions:

  1. Copy the firmware file (miui_VEUX_14.0.5.0.zip) phone-drive.
  2. V TWRP press Wipe β†’ Advanced Wipe and mark: 🧹 Dalvik / ART Cache 🧹 System 🧹 Data (if you need a clean installation) 🧹 Cache

Swipe for confirmation.

Go back to the main menu and select Install. Specify the path to the firmware file.

In addition:

  • πŸ”§ If you do. MIUI, Check the Zip file signature verification box).
  • πŸ”§ Custom firmware may need to flash GApps (Google services) separately.
  • Swipe to start the installation. It'll take 5-15 minutes.
  • After completion, press Reboot System.
What to do if the firmware is hung on the logo?
If after the reboot the phone hangs on the MI or Fastboot logo for more than 10 minutes: 1. Press Volume Up + Power to log in to TWRP. 2. Run Wipe β†’ Format Data (enter yes for confirmation). 3. Re-sweep the firmware. 4. If it doesn't work, restore the backup from the Restore section.

Step 5: Solving Common Mistakes

Firmware through TWRP doesn't always go smoothly. Here are the most common problems and solutions:

Mistake.Reason.Decision
Error 7 when installedIncompatible firmware or the wrong modelCheck the code name of the device and download the correct version.
Hanging on to Mi LogoIncorrect vendor or no firmwareRun a stock vendor or run a Format Data
Failed to mount /dataEncrypted data sectionIn TWRP, select Wipe β†’ Format Data β†’ Yes
Fastboot mode after rebootingBoot or recovery damagedRe-flash the TWRP and re-install

If the IMEI is missing after the firmware or the network is not working, then the EFS partition is damaged. Restore it from the backup or use the QCN Rebuilder tool (requires root).

πŸ’‘

90% of firmware errors are due to the wrong firmware version or the missing Format Data step. Always check the compatibility of files with your model!

Step 6: Optimization after firmware

After successful installation of the firmware:

  • ⚑ Restart your phone and wait for full app optimization (can take up to 10 minutes).
  • πŸ”„ If you have been flashing custom OS (LineageOS), install Magisk for root rights: 1. Download. Magisk.zip GitHub 2. V TWRP Choose Install β†’ Magisk.zip 3. Reboot.
  • πŸ“‘ To improve autonomy, disable unnecessary Xiaomi services:
  • πŸ”’ If you use MIUI, Turn off the adverts: Settings β†’ Memory. β†’ Cleanup β†’ Settings (cogs) β†’ Delete "Recommendations"

To check the stability of the firmware, use the tests:

  • πŸ“Š AnTuTu Benchmark – for performance assessment.
  • πŸ”‹ AccuBattery – to monitor battery consumption.
  • πŸ“Ά Network Signal Guru – for checking the connection.

FAQ: Frequent questions about Xiaomi’s firmware through TWRP

Can I flash Xiaomi through TWRP without unlocking the bootloader?
No. Without unlocking the TWRP bootloader, you can't install it, it'll go back to the drain recavator the first time it restarts, except for some older models (Xiaomi Mi A1, Mi A2), where the bootloader is unlocked by default.
How to return the stock firmware if something went wrong?
Download the official firmware for your model from MIUI Downloads. In TWRP, run: Wipe β†’ Advanced Wipe β†’ System/Data/Cache Install β†’ select the downloaded Reboot System file If the phone doesn't turn on, use the Mi Flash Tool in Fastboot mode.
Why is the camera or fingerprint sensor not working after the firmware?
This is a typical problem when installing custom firmware on new models (Xiaomi 12/13, Redmi K60). Causes: No firmware vendor or firmware. Incompatible version of MIUI (for example, flashed Android 13 on a device with Android 12). Solution: run the correct version of firmware (look for XDA or Xiaomi Firmware Updater).
Can I run Xiaomi through TWRP without a computer?
Technically yes, but with reservations: βœ… If TWRP already installed, you can download firmware directly to the phone and sew them through the Recovery. ❌ Without unlocked bootloader (and this requires a PC to flash) TWRP You can't download files directly to your phone. FX File Explorer or Solid Explorer with support FTP.
How to update TWRP to the latest version?
The TWRP update is done in the same way as the original installation: Download the current.img file from twrp.me. Move it to your phone. In TWRP, select Install β†’ Install Image β†’ select file β†’ Recovery. Reboot β†’ Recovery. Don't update TWRP through the official TWRP App - it often installs unstable builds.