Reinstalling the operating system on smartphones Xiaomi is a procedure that may be required in case of critical failures, virus attacks, or the desire to install custom firmware. Unlike a regular factory reset, a full flashing affects system partitions, which allows you to eliminate deep software errors or update the device to the latest version of MIUI (or an alternative OS type LineageOS). However, the process is fraught with risks: from data loss to โ€œbrickingโ€ the phone if you break the sequence of actions.

In this article we will look at three main scenarios: recovery via official Mi Flash Tool, installation of global/stable firmware over Chinese and manual deployment of custom software via TWRP. We will pay special attention to preparation - unlocking the bootloader (bootloader), without which most operations are impossible. You will also find a firmware compatibility table for popular models Redmi, POCO and Mi, current at the time of publication.

Before you begin, answer the key question: why do you need to reinstall? If the goal is to eliminate lags or free up memory, a reset via Settings โ†’ About phone โ†’ Reset settingsmay be enough. Reflashing is justified when:

  • ๐Ÿ”„ The smartphone does not turn on or only boots into mode Fastboot/Recovery
  • ๐Ÿž System applications constantly crash, and updates via OTA are not available
  • ๐ŸŒ You need to change the regional firmware (for example, from Chinese to global)
  • ๐Ÿ› ๏ธ Requires root access or an alternative OS (like Pixel Experience)
๐Ÿ“Š Why do you reinstall Android on Xiaomi?
I eliminate critical errors
I want a custom one firmware
I change the regional version of MIUI
The phone does not turn on
Other

1. Preparation: backing up and unlocking the bootloader

The first stage - saving dataReinstalling Android erases the internal one. device memory, including photos, contacts and messages. Use:

  • ๐Ÿ“ฑ Mi Cloud (for contacts, notes, SMS) - check that synchronization is enabled in Settings โ†’ Xiaomi Account โ†’ Mi Cloud
  • ๐Ÿ–ฅ๏ธ PC and a USB cable - copy files from folders DCIM, Downloads, WhatsApp (if any)
  • ๐Ÿ”ง Applications like Swift Backup (requires root) to save the list of installed apps

Next - unlocking the bootloader. Xiaomi blocks it by default to protect against unauthorized changes. To unlock:

  1. Link your account Mi to the device in Settings โ†’ Xiaomi account.
  2. Activate option OEM Unlock in Settings โ†’ For developers (if there is no option, tap 7 times on MIUI version in the "About phone" section).
  3. Reboot into Fastboot (press Power + Volume down) and connect the phone to the PC.
  4. Download official tool Mi Unlock Tool, log in and follow the instructions.
โš ๏ธ Attention: After The smartphone will unlock the bootloader full data reseteven if you have not started flashing the firmware. Also Xiaomi can block unlocking for 7-30 days for new accounts (depending on the model and region).

If Mi Unlock Tool gives an error type "Couldnโ€™t unlock", check:

  • ๐Ÿ”Œ USB cable - use an original or certified one (cheap cables often do not transfer data to Fastboot)
  • ๐Ÿ–ฅ๏ธ Version of the tool - download the latest from the official website
  • ๐Ÿ“ฑ Account status - new devices may require linking the SIM card to the account Mi for 72 hours

Save all important data to PC/cloud|

Link the Mi account to the device|

Enable OEM Unlock in the developer settings|

Downloaded Mi Unlock Tool and drivers for Fastboot|

Prepared a USB cable (preferably original)-->

2. Selecting firmware: official vs custom

The functionality of the device after reinstallation depends on the type of firmware. options:

Firmware type Advantages Disadvantages Who is it suitable for
Official MIUI (Fastboot) Stability, support for OTA updates, maintaining the warranty* Limited customization, advertising in system applications Beginners, those who want to return the "factory" state
Official MIUI (Recovery) Easy installation via stock recovery, no need to unlock the bootloader** Not all versions are available in this format, risk of errors when updating To fix minor glitches without data loss
Custom (TWRP + ZIP) Without unnecessary water, advanced settings, current versions of Android Loss of warranty, possible bugs with hardware (camera, NFC) Advanced users who want an alternative to MIUI

* The warranty is valid only when using official firmware via Mi Flash Tool. Installing custom software will void the warranty.

** Firmware via Recovery without unlocking is only possible to update the current version of MIUI, and not to change the region or downgrade.

Where to download firmware:

  • ๐Ÿ”— Official: MIUI Downloads site (select the version for your model by code, for example davinci for Redmi K20)
  • ๐Ÿ”— Custom: XDA Developers (look for themes for your model with marked [ROM])
  • ๐Ÿ”— Alternative builds of MIUI: xiaomi.eu (firmware without unnecessary water, but with the risk of bootloader blocking)
โš ๏ธ Attention: Firmware from the site xiaomi.eu are not official and can lead to account blocking Mi when using some functions (for example, Mi Pay). For models with a processor MediaTek (for example, Redmi Note 11), additional authorization is required to unlock the bootloader.
How find out the code name of your Xiaomi model?

Open the "Phone" application and enter the code ##4636##. In the "Phone Information" menu, find the line "Device model" - this is the code name (for example, raphael for Redmi K20 Pro). Alternatively, check on the box or under the battery (for models with a removable cover).

3. Installing official firmware via Mi Flash Tool

This method is suitable for restoring the "factory" state or changing the regional version of MIUI. You will need:

  • ๐Ÿ–ฅ๏ธ Computer with Windows (7/10/11)
  • ๐Ÿ“‹ Unlocked bootloader (see section 1)
  • ๐Ÿ”Œ USB cable (preferably original)
  • ๐Ÿ“ฆ Firmware in format .tgz or .zip (downloaded from the official website)

Step-by-step guide:

  1. Unpack the archive with the firmware into a folder without Cyrillic characters (for example, C:\MIUI\).
  2. Install Mi Flash Tool and drivers for Fastboot.
  3. Switch the phone to Fastboot mode (press Power + Volume down with the device turned off).
  4. Connect your smartphone to the PC. Press Mi Flash Tool click Refresh - the device should be detected.
  5. In the field Select specify the path to the folder with firmware. Select the firmware method:
    • Clean all โ€” full cleaning (recommended in case of failures)
    • Clean all and lock โ€” cleaning + bootloader lock (for selling the phone)
    • Save user data โ€” saving user data (risky when switching between MIUI versions)
  • Press Flash and wait for completion (usually 5-15 minutes). The phone will reboot automatically.
  • If the process is frozen at the stage flashing..:

    • ๐Ÿ”„ Try another USB port (preferably USB 2.0 on the back panel PC).
    • ๐Ÿ”Œ Replace the cable - cheap cables may not provide a stable connection.
    • ๐Ÿ“ฅ Redownload the firmware - errors may occur when downloading the archive.
    ๐Ÿ’ก

    If after the firmware the phone is stuck on the logo Mi, press Power + Volume up for 10โ€“15 seconds to force a reboot. If this does not help, repeat the firmware by selecting the option Clean all.

    4. Installing custom firmware via TWRP

    To install alternative OSs (for example, LineageOS, Pixel Experience), you will need custom recovery - TWRP. The process is more complicated than with official firmware, and includes additional risks.

    What you need to prepare:

    • ๐Ÿ“ฑ Unlocked bootloader
    • ๐Ÿ“ฆ Firmware in format .zip (for example, lineage-20.0-20231210-nightly-davinci.zip)
    • ๐Ÿ› ๏ธ File TWRP for your model (download from official website)
    • ๐Ÿ”‹ Battery charge at least 60%

    Instructions:

    1. Download TWRP for your model (for example, twrp-3.7.0_9-0-davinci.img) and place the file in the folder with ADB (or use 15 Seconds ADB Installer).
    2. Move the phone to Fastboot and connect to PC.
    3. In the command line (in the folder with ADB) run:
      fastboot flash recovery twrp-3.7.0_9-0-davinci.img
      

      fastboot boot twrp-3.7.0_9-0-davinci.img

      This will flash TWRP and immediately load the phone into it.

    4. B TWRP execut Wipe โ†’ Format Data (enter yes to confirm). This will remove encryption and prevent errors.
    5. Transfer the firmware file to the phone via MTP (in TWRP is option Mount โ†’ Enable MTP).
    6. Click Install, select the firmware file and confirm installation. After completion, click Reboot System.
    โš ๏ธ Attention: Some custom firmware require additional steps:
    • ๐Ÿ”ง Installations GApps (Google Services) in a separate ZIP file (if they are not in the assembly).
    • ๐Ÿ”ง Patch for DM-Verity (otherwise the phone may not boot).
    • ๐Ÿ”ง Disablements Force Encryption (for older devices).

    These nuances are usually described in the instructions for the specific firmware on XDA.

    ๐Ÿ’ก

    Custom firmware often does not support proprietary functions Xiaomisuch as IR Blaster (remote control) or Game Turbo. Before installation, check the list of working/non-working hardware in the firmware thread on the forum.

    5. Common mistakes and their solutions

    Even if you follow the instructions, problems may arise. Let's consider typical situations:

    Error Cause Solution
    Fastboot: FAILED (remote: 'Flashing is not allowed in Lock State') Bootloader is not unlocked Use Mi Unlock Tool (section 1). option
    Phone stuck on logo Mi after flashing Incompatible firmware or error when writing the system partition Repeat the firmware with the option Clean all or return to the previous version
    TWRP: Unable to mount /data Encryption is enabled TWRP cannot decrypt the partition Run Format Data in TWRP (erases all data!)
    There is no network after the firmware The firmware does not contain modems for your region Install the correct one modem firmware via TWRP or return to stock MIUI

    If the phone stops turning on after unsuccessful firmware:

    1. Try to go to Fastboot (Power + Volume Down) and repeat the firmware.
    2. If the screen is black, but the PC recognizes the device as Qualcomm HS-USB QDLoader 9008, use EDL mode (requires an authorized account Xiaomi and a special cable).
    3. For models on MediaTek (for example, Redmi Note 8 Pro) firmware via SP Flash Toolcan help, but this is risky without experience.

    If nothing helps, contact a service center. In some cases (for example, if damaged EMMC), restoration is only possible using a soldering station.

    6. System optimization after reinstallation

    After successful firmware it is recommended:

    • ๐Ÿ”„ Reset to factory settings (even if the firmware was โ€œcleanโ€) through Settings โ†’ Advanced โ†’ Recovery and reset.
    • ๐Ÿ“ฑ Update all applications via Google Play or Mi App Store.
    • ๐Ÿ”’ Enable Find My Device (for Android) or Mi Cloud (for MIUI) in case you lose your phone.
    • ๐Ÿ›ก๏ธ Disable unnecessary system applications (for example, Mi Video, Mi Music) via ADB:
      adb shell pm uninstall -k --user 0 com.miui.video

    For custom firmware:

    • ๐Ÿ”ง Install a kernel with support GCam (if the camera works incorrect).
    • ๐Ÿ”‹ Configure Thermal Engine to reduce overheating (through applications like Kernel Auditor).
    • ๐Ÿ“ถ Check operation VoLTE i Wi-Fi Calling โ€”some assemblies require manual activation via ##4636##.
    โš ๏ธ Attention: The function Mi Account (including Mi Cloud and Find Device) will not work. Use alternatives like Google Find My Device.

    7. questions

    Is it possible to reinstall Android on Xiaomi without unlocking the bootloader?

    Yes, but with serious restrictions You can:

    • Update the current version of MIUI via Recovery (without changing the region or downgrading).
    • Reset to factory settings via Settings โ†’ Reset.

    For a complete reinstallation (changing firmware, region or installing a custom OS) unlocking is required.

    How to return the official MIUI after custom firmware?

    You can return to the stock firmware via Mi Flash Tool:

    1. Download the official firmware Fastboot for your model.
    2. Unlock the bootloader (if it was locked after custom firmware).
    3. Flash through Mi Flash Tool with the option Clean all and lock.

    If the bootloader is locked and Mi Unlock Tool does not work, you may need to wait (up to 30 days) or use EDL mode (only for experienced users).

    Why does the camera or NFC not work after the firmware?

    This is a typical problem with custom firmware due to the lack of proprietary drivers. Solutions:

    • Install a special patch for the camera (for example, ANX Camera for GCam).
    • Check whether your model supports NFC in the selected firmware (information is in the topic on XDA).
    • Return to the official MIUI if the functionality is critical.
    How long does it take to reinstall Android?

    Time depends on the method:

    • Official firmware in Mi Flash Tool: 5โ€“15 minutes + time to unlock the bootloader (up to 30 days for new accounts).
    • Custom firmware in TWRP: 20โ€“40 minutes (including setup and installation GApps).
    • Recovery in Recovery: 10โ€“20 minutes.

    The longest preparation usually takes: downloading firmware, backup and unlocking.

    Is it possible to reinstall Android on Xiaomi using a PC on Mac/Linux?

    Yes, but with reservations:

    • For Mi Flash Tool you will need Windows (you can use a virtual machine).
    • To work from ADB/Fastboot to Mac or Linux install packages via brew install android-platform-tools or sudo apt install adb fastboot.
    • TWRP and custom firmware is installed identically on all platforms, but manual configuration of access rights to /dev.