Install custom firmware on Xiaomi via TWRP: a complete guide from unlock to first download

Installing custom firmware on Xiaomi smartphones is one of the most popular ways to unlock the hidden potential of a device. With TWRP (Team Win Recovery Project), you can flash an alternative version of MIUI, LineageOS, Pixel Experience or other firmware, gaining access to new features, improved performance and current security updates. However, the process requires caution: error at any stage – from unlocking the bootloader to choosing the wrong firmware – can turn the smartphone into a brick.

In this guide, we will break through the whole process from A to Z: how to unlock a bootloader through the Mi Unlock Tool, install TWRP without errors, find a compatible firmware for your Xiaomi model (be it Redmi Note 10 Pro, POCO X3 or Mi 11), and successfully sew it through. We will focus on typical problems β€” for example, why Wi-Fi or NFC does not work after firmware, and how to fix them. If you are a beginner, don’t be afraid: each step is accompanied by screenshots (in text format) and explanations.

Warning: The procedure resets all data on the device, including photos, contacts and apps, and it can also take away the official warranty (if the device was purchased less than a year ago).

1.Preparation: What to do before installing TWRP

Before you start unlocking the bootloader and installing the custom recavator, you need to follow several critical steps, skipping at least one of which can lead to the inability to restore the device or loss of data.

First, check your Xiaomi model. To do this, go to Settings β†’ About Phone β†’ Device Model. Write down the exact name (e.g. Redmi Note 9 Pro is joyeuse, and POCO F3 is alioth). This information will be needed to download the correct version of TWRP and firmware.

  • πŸ“± Create a backup of all data (photos, videos, contacts, SMS) via Mi Cloud, Google Drive or locally on your PC. Once the bootloader is unlocked, the device will be completely reset.
  • πŸ”‹ Charge the battery to at least 70%. interruption of the process due to battery discharge can make the smartphone inoperable.
  • πŸ’» Install drivers for your Xiaomi on your PC. Download them from the official Xiaomi website or use the universal Mi package PC Suite.
  • πŸ”“ Put the debugging on. USB In the developer settings. Go to Settings for that. β†’ About the phone, tap 7 times on the version MIUI, Then go back to the settings. β†’ Additionally. β†’ For developers and activate debugging by USB.

Also make sure your PC has ADB and Fastboot installed. If not, download Platform Tools from Android Developers and unpack the archive at the root of the C:\ drive.

⚠️ Note: If your device was purchased in China (suffix version) CN), Unlocking the bootloader can take up to 360 hours (15 days) of waiting. (Global) versions typically take 72 hours.

2 Unlock the Xiaomi bootloader via Mi Unlock Tool

The bootloader on Xiaomi smartphones is blocked by default. To install TWRP and custom firmware, it must be unlocked using the official Mi Unlock Tool.

Download the utility from the Xiaomi website (select the version for your OS) and follow the following steps:

  1. Log in to Mi Account on your phone and link it to your device in Settings β†’ Xiaomi Account.
  2. Connect your smartphone to your PC in Fastboot mode (turn off the device, then press Volume down + Power until the hare appears in the eardress cap).
  3. Launch the Mi Unlock Tool on your PC, sign in under the same Mi Account and follow the program instructions.
  4. If you get a wait message (e.g., Wait 168 hours), wait until the deadline expires.

Once successfully unlocked, the device will automatically reset to factory settings, and you can now start installing TWRP.

πŸ“Š What kind of firmware do you plan to install?
MIUI (Castom Assembly)
LineageOS
Pixel Experience
Havoc OS
Another.

3. Installation of TWRP Recovery on Xiaomi

Now that the bootloader is unlocked, it's time to install a custom recaveri. TWRP It will allow you to create backups, to sew ZIP-files and manage memory partitions.

Download the current version of TWRP for your model from the official website twrp.me (see the code of the device, for example, raphael for Redmi K20 Pro).

Follow the commands in Fastboot:

fastboot flash recovery twrp-3.7.0_12-0-raphael.img


fastboot reboot recovery

If after rebooting the system in TWRP offers to enter a password (due to data encryption), execute Format Data (this will delete all data, but unlock access).

⚠️ Note: Some Xiaomi models (such as the Redmi Note 8 Pro with Mediatek chipset) require additional manipulations to unlock Anti-Rollback.Ignoring this step can lead to hard-brick (irreparable damage).

Download the correct.img file for your model|Device in Fastboot mode|ADB Fastboot is installed on PC|Battery charged. >70%|Data backup made.-->

4. Selection and downloading of custom firmware

The stability of the device depends on the choice of firmware. Here are the main options for Xiaomi:

Type of firmwareAdvantagesDeficienciesRecommended models
Castom MIUI (xiaomi.eu, MIUIMix)Maximum optimization for Xiaomi, no camera/NFC bugsClosed source code, limited customizationAll models.
LineageOSClean Android, Regular Security UpdatesBranded chips (IR-blaster, Game Turbo) may not workPOCO F1, Mi A2, Redmi Note 7
Pixel ExperienceGoogle Pixel interface, Google Camera supportSometimes lays on weak chipsetsRedmi Note 8 Pro, Mi 9T
Havoc OSMaximum customization (themes, gestures, statusbar)Less stability than LineageOSPOCO X3, Redmi K20

Download the firmware only from verified sources:

  • 🌍 xiaomi.eu - custom MIUI bloatless;
  • πŸ“± LineageOS - official builds;
  • πŸ“Έ Pixel Experience – firmware with Pixel interface;
  • πŸ”§ XDA Developers – firmware from the community (look for the theme of your model).

Note the firmware version of Android. For example, if your device officially supports Android 12, don’t install firmware on Android 13, which can cause problems with the Wi-Fi or Bluetooth module.

πŸ’‘

Before you run your firmware, check the reviews on the forums for your chosen build. If in the latest comments, users complain about a fast battery drain or overheating, you better look for another version.

5. Step-by-step installation of custom firmware through TWRP

Now, to the most important stage, firmware, follow the instructions carefully.

  1. Copy the firmware on your phone. Connect the device to your PC in mode. MTP (into TWRP Choose Mount β†’ Enable MTP) and move ZIP-firmware file into internal memory.
  2. Backup the current system. TWRP Go to Backup and select Boot, System, Data. Save backup to Backup. SD-card.
  3. Go to Wipe β†’ Advanced Wipe and mark Dalvik/ART Cache, System, Data, Cache. Swipe for confirmation.
  4. Install the firmware. Press Install, select. ZIP-For some firmware (for example, LineageOS) you will need to additionally flash GApps (Google services).
  5. If you want root access, download Magisk from GitHub and install it via TWRP after you have firmware.
  6. Reboot. Press Reboot System. It can take 10 to 15 minutes to boot first -- don't interrupt.

If after the reboot the device stuck on the logo or went into a bootloop (cyclic reboot), go back to TWRP (clip Volume Up + Power) and:

  • Repeat the firmware by pre-formatting the Data;
  • Try another firmware assembly;
  • Restore the backup (if you have).
What happens if TWRP is not installed?
If you try to sew TWRP If you see an error in the Invalid sparse file format at header magic, your model uses dynamic partitions: 1. Download the special version TWRP Support for dynamic partitions (see below) XDA). 2. Use the command fastboot flash recovery_twrp.img standard. 3. After installation, immediately reboot to reboot (fastboot reboot recovery), otherwise the stock recaverie will re-record TWRP.

6.Typical problems after firmware and their solution

Even if the firmware is successful, you may encounter bugs, and here are the most common ones and how to fix them:

Problem.Possible causeDecision
Wi-Fi/Bluetooth is not workingThere is no branded driver WCNSS_qcom.cfgSweat the patch for your model or go back to stock firmware
Camera makes a mistakeNo Libarcore or Google Camera incompatibleInstall. ANX Camera or patch the patch Fix_Camera.zip
Fast battery dischargeBackground processes of custom firmware or unoptimized coreCalibrate the battery in TWRP or run through another core
NFC's not workingThere is no proprietary NFC module in the firmwareSwitch stock vendor.img through TWRP

If Xiaomi's signature chips (like Game Turbo or Second Space) are no longer working after LineageOS or Pixel Experience firmware, this is normal. These functions depend on closed MIUI components, and they don't work in AOSP-based firmware.

⚠️ Warning: If the device doesn't turn on after the firmware is installed (black screen, no button response), don't panic. Connect it to your PC and check if it's detected by the fastboot device command in Fastboot. If so, try flashing the stock firmware through the Mi Flash Tool.

7 How to return the stock firmware if something went wrong

If custom firmware is unstable or you want to return the official MIUI, do the following:

  1. Download the stock firmware for your model from Xiaomi. Choose the Fastboot version (.tgz extension).
  2. Unpack the archive in a folder on your PC.
  3. Put the device in Fastboot mode (Loudness down + Power).
  4. Run the Mi Flash Tool, select the firmware folder, and press Refresh. The device must be determined.
  5. Select Clean All mode and press Flash.

After successful firmware, the device will reboot to the stock MIUI. The bootloader will remain unlocked, but you can lock it again via the Mi Unlock Tool (Lock option).

If the Mi Flash Tool is an anti-rollback error, you are trying to flash an older version of MIUI than the one you installed earlier, in which case you will have to look for firmware with the same or newer Anti-Rollback number.

πŸ’‘

Always check the Anti-Rollback version before running stockware MIUI. You can find it in the name of the firmware file (for example, V12.5.1.0.RJWMIXM_anti3 β€” here anti3).

FAQ: Frequent questions about installing custom firmware on Xiaomi

❓ Can I install custom firmware without unlocking the bootloader?
No. All modern Xiaomi smartphones (since 2016) require unlocking the bootloader to install TWRP and custom firmware. There are no bypasses - this is a security measure from Xiaomi.
❓ Why does the mobile network not work after firmware (no signal)?
This is a typical problem when installing firmware based on AOSP (LineageOS, Pixel Experience on a Mediatek model (e.g. Redmi Note) 8/9). Solution: Sweat the patch IMS_fix.zip (look XDA Check the settings for your model. APN In Settings β†’ Mobile network β†’ If it doesn't work, go back to the stock firmware.
❓ How to Update Custom Firmware Without Losing Data?
Most custom firmware (such as LineageOS) support air-to-air updates" (OTA). To upgrade without reset: Download the new firmware version (ZIP). Reboot to TWRP. Install. ZIP-file without a Wipe (do not format Data). Sweep Magisk (if you used root). Reboot. If you have lags after the update, do Wipe. Cache/Dalvik.
❓ Can I get it? OTA-customization MIUI from xiaomi.eu?
Yes, firmware from Xiaomi.eu supports OTA-They come every 1-2 weeks to get them: Do not delete the Updater app. Do not change the firmware region (for example, from the Internet). EEA Do not block Internet access for com.android.updater. Updates come automatically, but it is recommended to make a backup to the Internet before installation. TWRP.
❓ How to check if the bootloader is unlocked?
Turn off the device and press Volume Down + Power to enter the Fastboot. If you see UNLOCKED at the bottom of the screen and the unlocked lock, the bootloader is unlocked. If LOCKED, you have to use the Mi Unlock Tool.