Update Xiaomi firmware through TWRP: full guide from preparation to installation

Update the firmware through TWRP On Xiaomi smartphones, it's a process that opens up access to the advanced capabilities of the device, but requires accuracy and understanding of each step. OTA-Updates, installation through custom recavers allows you to flash both official and modified versions MIUI, But you can also use custom firmware like LineageOS or Pixel Experience, but you can make a device "brick" when you do something wrong, so it's important to follow the instructions you've tested.

This article will be suitable for owners of Xiaomi, Redmi and POCO, who have already been TWRP Recovery and unlocked bootloader. If you're a beginner, don't skip the preparation sections: here we'll take a look at what files are needed for firmware, how to avoid installation errors, and what to do if something goes wrong. For experienced users, nuances of working with different types of firmware (Fastboot, Recovery) and tips for optimizing the process will be useful.

1. Update Preparation: What to Do Before Firmware

Before starting to install a new firmware through TWRP, Several critical steps need to be taken, and neglecting them can lead to data loss, device failure, or even complete inoperability.

First, make sure your Xiaomi bootloader is unlocked. TWRP You can check the lock status by restarting the phone to Fastboot mode. + Volume down) and connect it to a PC. If the Device Manager displays Android Bootloader Interface, but it says Locked, the bootloader is locked. Unlocking takes up to 72 hours (according to Xiaomi rules) and requires an account to be linked to Mi.

Second, create a full backup of your current system. TWRP All partitions can be backed up, including Boot, System, Data and EFS (stored IMEI and other critical data:

  • πŸ“± Come in. TWRP (hold on to food + Volume up when switched on).
  • πŸ”„ Select the Backup option.
  • βœ… Check all sections except Cache and Android Secure.
  • πŸ’Ύ Specify the place of saving (preferably to an external memory card or PC via ADB).

⚠️ Note: If you are flashing firmware to another version of Android (for example, 12 to 13), the Data backup may not be compatible, in which case it is better to save only media files and contacts manually.

Also check the version TWRP β€” It needs to be compatible with your Xiaomi model, older versions of the recovery may not support new firmware or cause installation errors. TWRP For specific models, you can find it on the official website twrp.me or on the forum XDA Developers.

Make a backup of all sections in TWRP|Check the unlocking of the loader|Download the firmware for your model|Charge your phone at least 60%|Prepare. OTG-cable or memory card-->

2. firmware selection: official MIUI vs custom builds

Not only does the type of firmware affect the functionality of the device, but also the stability of its operation. Xiaomi offers several options:

  • πŸ“¦ Official. MIUI (Stable/Beta): Manufacturer firmware that is optimized for a specific model; stable versions are tested but may be behind in functionality; beta versions are updated more often, but contain bugs.
  • πŸ”§ Castom firmware (LineageOS, Pixel Experience, crDroid): Alternative builds based on AOSP or MIUI, often with advanced settings and no bloatware, requiring firmware experience and may be insecure.
  • πŸ”„ Ported firmware: MIUI Other Xiaomi models, adapted by enthusiasts, are risky, with camera, sensors or communication issues.

For beginners, it is recommended to start with official firmware in Recovery format (files with the.zip extension). TWRP Custom firmware often requires additional manipulation, such as Vendor or Firmware firmware, and manual installation of GApps (Google services).

Type of firmwarePlusesConsRecommendations
Official MIUI (Recovery)Stability, OTA support, all features workLots of Bloatware, Limited CustomizationFor daily use
Castomic (AOSP)Clean Android, high performance, no advertisingCamera, NFC or gestures may not workFor experienced users
Ported MIUINew features from flagships to old modelsHigh risk of bugs, possible brickOnly for experiments.

Before downloading the firmware, be sure to check its compatibility with your Xiaomi model. For example, the firmware for the Redmi Note 10 Pro (sweet) will not work for the Redmi Note 10 (mojito), even if the devices are similar in appearance. The code name of the model can be found in the Mi Check application or through the command:

adb shell getprop ro.product.device

Official. MIUI Stable|Official. MIUI Beta|LineageOS (Pixel Experience)|Ported MIUI|Don't do it yourself.-->

3. Step-by-step instruction: how to flash Xiaomi through TWRP

Once all the preparations are complete, you can start installing, and below is a general-purpose instruction that is suitable for most.zip firmware.

Step 1: Resetting to the TWRP

Turn off the phone. Press the power combination. + Loudness up before the logo appears TWRP. If the device is loaded into MI Recovery, means custom recovery is installed incorrectly - repeat the process of its firmware.

Step 2: Cleaning the sections

On the main menu. TWRP Choose the Wipe β†’ Advanced Wipe. Mark the following sections:

  • 🧹 Dalvik / ART Cache
  • πŸ—‘οΈ System
  • πŸ“‚ Data (if you switch to another version of Android or firmware)
  • πŸ’Ύ Cache

Do not erase the Internal Storage section if it contains firmware files! After selecting, click Swipe to Wipe.

Step 3: Installation of firmware

Go back to the main menu and select Install. Find the downloaded firmware file (usually in the Download folder or on an external map) before installing:

  • πŸ” Check the file name – it should match the code name of your model.
  • πŸ“‹ If you are running a custom build, make sure it includes Firmware and Vendor (otherwise download them separately).

Swipe to confirm Flash and wait until the process is complete. The installation time depends on the firmware size and can take anywhere from 5 to 20 minutes.

Step 4: Additional Actions

After installing the firmware:

  • πŸ”„ If you have been stitching custom assembly without GApps, install them separately (file) open_gapps-...-arm64-...-nano.zip).
  • πŸ”’ For MIUI may require firmware Disable_Dm-Verity_ForceEncrypt.zip (Disables data encryption if TWRP He doesn't support it).
  • πŸ“± Reboot to the system (Reboot) β†’ Systems. The first launch can take up to 10 minutes.

⚠️ Warning: If the device has been stuck on the Xiaomi logo for longer than 15 minutes after firmware, do not try to turn it off with the power button! TWRP Check the error logs in Advanced β†’ Copy Log.

πŸ’‘

If the firmware ended with an Error 7 error, it means the device model and firmware file mismatch. Check your Xiaomi codename and download the correct version.

4. Common mistakes and their solutions

Even with strict adherence to the instructions, there can be failures, and let's look at the typical problems and how to fix them.

Error: β€œUnable to mount /data"

Reason: The data partition is encrypted and TWRP Does not support decryption for your version of Android.

Decision:

  1. Back to the main menu TWRP.
  2. Choose Wipe. β†’ Format Data (this will delete all user data!).
  3. Enter yes to confirm.
  4. Reboot to TWRP and re-install the firmware.

Mistake: "E1001: Failed to update system image"

Reason: Incompatibility of the version TWRP with firmware or a corrupted.zip file.

Decision:

  • πŸ”„ Reinstall the current version TWRP for your model.
  • πŸ“₯ Download the firmware again (maybe the file was not fully downloaded).
  • πŸ”§ Check the checksum (MD5) firmware.

Loaded Loading (Bootloop)

Reason: Conflict between the kernel (Boot) and the system (System), or the lack of necessary files (Vendor, Firmware).

Decision:

  1. Download to TWRP.
  2. Install Firmware for your model (if you haven’t done it before).
  3. Squeeze the Boot separately (file) boot.img firmware-archive).
  4. Run the Wipe. β†’ Factory Reset (if the problem persists).

If none of the methods worked, try flashing Fastboot firmware through the Mi Flash Tool.

  1. Download the.tgz or.tar version of the firmware for your model.
  2. Unpack the archive in a folder without Cyrillic characters.
  3. Download the phone to Fastboot (Power + Volume Down) mode.
  4. Connect to your PC and start the Mi Flash Tool by selecting the firmware folder.
What if TWRP doesn’t see internal memory?
If TWRP does not display files in internal memory, this may be due to encryption or damage to the Data partition: 1. Connect your phone to your PC through ADB And copy the firmware command: adb push rom.zip /sdcard/ 2. Use it. OTG-cable and flash drive. 3. Format Data in TWRP (Note: Delete all data!).

5. Post-Firmware Optimization: Settings and Tests

Successful firmware installation is only half the battle, so to keep the device running smoothly, take a few extra steps.

Verification of essential functions

After the first run, make sure that:

  • πŸ“Ά Mobile communications and IMEI (dial *#06#).
  • πŸ“· Camera (check all modules).
  • πŸ”Š Speakers and microphone.
  • πŸ”‹ Charging and determining the level of the battery.
  • 🌐 Wi-Fi, Bluetooth and GPS.

If something is not working, go back to TWRP and re-flash Firmware or Vendor.

2. Performance adjustment

For custom firmware:

  • πŸ”§ Activate Developer Options (click 7 times on the Build Number in the settings).
  • ⚑ Turn on Force. GPU Rendering and disable animations to speed up the interface.
  • πŸ”„ Set up a task scheduler (Settings) β†’ Battery β†’ App battery saver).

For MIUI:

  • 🚫 Turn off Mi Cloud Sync and Automatic Updates if you don’t plan to use them.
  • πŸ—‘οΈ Remove Bloatware through ADB: adb shell pm uninstall --user 0 com.miui.analytics

3. Stability testing

In the first days after the firmware, watch out for:

  • πŸ”‹ Battery consumption (use AccuBattery or GSam Battery Monitor).
  • 🌑️ Overheating (norm: up to 40)Β°C under load).
  • πŸ“‰ Performance (run tests in AnTuTu or Geekbench).

If you notice anomalies (such as a quick discharge or lag), check the logs through the logs. ADB:

adb logcat > log.txt

Or use the MatLog app to analyze errors.

πŸ’‘

After you have installed custom firmware, be sure to check the sensors (gyroscope, compass, proximity sensor) and their incorrect operation may indicate the absence of the right drivers in the assembly.

6. How to roll back on the previous firmware

If the new firmware is unstable or you don't like the changes, you can return the previous version.

Method 1: Recovery from the backup TWRP

  1. Download to TWRP.
  2. Select Restore and specify the folder with backup.
  3. Check the Boot, System and Data sections.
  4. Swipe for recovery.

After restarting, the device will return to the state at the time of creation of the backup.

Method 2: Clean installation of old firmware

If there's no backup:

  1. Download the correct version of the firmware (preferably the one that worked exactly).
  2. In TWRP, run Wipe β†’ Advanced Wipe (select System, Data, Cache).
  3. Install the firmware through Install.

⚠️ Note: Reverse to an older version MIUI This can cause problems with Anti-Rollback Protection on some models (e.g. Xiaomi Mi 9 or Redmi). K20 Pro) this will cause a hard brick! Before rolling back, check the list of anti-rollback devices on XDA Developers.

If the device doesn't turn on after rolling back, try flashing the Fastboot firmware through the Mi Flash Tool with the clean all option, which will reset all data, but bring the phone back to life.

7.Safety Tips: How to Avoid Brick

Firmware through TWRP It is always associated with risks, but they can be minimized by following a few rules.

1. Check firmware sources

Download files only from official resources:

  • 🌐 Official firmware: en.miui.com.
  • πŸ”§ Castomic assemblies: XDA Developers (check out other users’ reviews).
  • πŸ”’ Avoid torrents and little-known sites – they may contain modified (and potentially dangerous) files.

2. Watch the battery charge

Make sure the charge level is at least 60 percent. If the phone runs out during firmware, it's almost guaranteed to lead to a brick. If you have to do long-term manipulations (like installing GApps and Magisk), connect the device to charge.

3. Don't miss footsteps

A common mistake for beginners is to ignore partition cleaning or Firmware firmware. For example, if you install only System without Vendor, the camera and sensors won't work. Always follow the instructions for the specific firmware.

4.Use the right tools

Different versions of utilities are needed for different tasks:

  • πŸ–₯️ For Fastboot firmware: Mi Flash Tool (Windows only).
  • 🐧 To work with ADB: Platform Tools by Google.
  • πŸ”§ For editing boot.img: Magisk Manager or AIK.

5. Test before daily use

Don't rush to recover data from the backup or install apps.

  • πŸ“ž Calls and SMS.
  • πŸ“Ά Switching between 4G/3G.
  • πŸ”‹ Charging from different sources (outlet, Power Bank, USB PC).

If no problems are detected within 24 hours, you can start full use.

πŸ’‘

Before the firmware, turn off all protections (PIN, In some cases, they may block access to Data after the update, even if you know the password.

FAQ: Answers to Frequent Questions

Can I flash Xiaomi through TWRP without unlocking the bootloader?
No. TWRP It's only installed on an unlocked bootloader, and if you try to flash a custom recavator on a locked device, the phone just won't boot into it, but will remain in the standard one. MI Recovery.
What to do if there is no network after the firmware (IMEI missing?summary?> This is a typical problem when running an incompatible Modem or Firmware. Solutions: Sweat down the right Firmware for your model. Restore the partition EFS Backup (if any) - use the tool QCN Rebuilder for Recovery IMEI (If nothing helps, contact the service center - self-intervention in the process. EFS may aggravate the problem.
How to upgrade TWRP to Xiaomi?
Update TWRP It is run in the same way as its installation: Download the current.img file for your model. TWRP. Choose Install. β†’ Install Image and specify the downloaded file. Select the Recovery partition and swipe for firmware. After the update, reboot to the new recovery and check its health.
Can I install Global firmware on the Chinese version of Xiaomi?
Technically yes, but there are nuances: πŸ“± On some models (such as the Redmi Note 9 Pro), the Chinese and global versions have different Firmware, and mixing them can lead to camera or communication problems. 🌐 Global firmware may not support some Chinese LTE-ranges. πŸ”’ On Anti-Rollback devices (such as Mi 11), the inappropriate firmware will trigger a brick. XDA or 4PDA.
Why does TWRP ask for a password when downloading?
This is due to the encryption of the data partition in MIUI. Solutions: Enter the password you used on the system (if you remember). If the password is unknown, format Data in the system. TWRP (Wipe β†’ Format Data. Turn off encryption in settings MIUI before the firmware (in the future) Data formatting will delete all user data!