How to change firmware on Xiaomi: from MIUI to custom assemblies

Xiaomi’s smartphone firmware is a process that can both return a device to a β€œsecond life” and turn it into a β€œbrick” if you approach it without preparation. Unlike a regular update via Settings β†’ About Phone β†’ Updating the system, a complete firmware change involves deep software interference. This may be necessary to install a fresh version of MIUI, switch to custom firmware (for example, LineageOS or Pixel Experience), or even restore health after a failure.

In this article, we will look at all the steps from unlocking the bootloader (without it you can not install unofficial software) to choosing the right firmware and installing it through Fastboot or Recovery. Particular attention will be paid to the risks of loss of warranty and potential problems with data encryption on new models (for example, Xiaomi 13/14 series or Redmi Note 12). If you have never done firmware before, do not worry: we will give checklists and warnings to help avoid errors.

1. Firmware Preparation: What to Do Before Starting

Before you start changing your firmware, make sure you follow all the preliminary steps, and neglecting them can lead to data loss, device lockdown, or even inability to restore.

First, check your Xiaomi model. This is critical, because the firmware is strictly device-specific. You can find out the model in Settings β†’ Phone β†’ Model or box. For example, the Redmi Note 11 Pro 5G has the code name veux, and the Xiaomi 12T is diting. A mistake in choosing a firmware is fraught with brick.

  • πŸ”‹ Charge the battery to at least 60%. The firmware can take up to 30 minutes, and discharging in the process will cause a failure.
  • πŸ“± Back up all the data. Use Mi Cloud, Google Drive, or local copying on your PC. The firmware erases internal memory!
  • πŸ” Find out the status of the bootloader. If it is blocked (by default on all new Xiaomi), it will have to be unlocked through the Mi Unlock Tool.
  • πŸ’» Prepare a PC with Windows 7/10/11 (Mi Unlock Tool requires Windows. Install drivers ADB and Fastboot.

Also check if your device is on the anti-rollback list. This is Xiaomi's protection that blocks rollbacks to older versions of MIUI. For example, if you upgrade from MIUI 13 to MIUI 14, you can't go back without the risk of bricking. You can find a list of anti-rollback devices on the XDA Developers or 4PDA forums.

πŸ“Š What kind of firmware do you plan to install?
Official MIUI (Stable/Beta)
Custom (LineageOS, Pixel Experience, etc.)
Stock Android (without MIUI)
I don't know, looking for information.

2. Unlock the bootloader on Xiaomi: step-by-step instructions

The bootloader on all Xiaomi smartphones is locked by default, a security measure that prevents unofficial software from being installed. To unlock it, you need to get permission from Xiaomi through the linking of your Mi Account account to the device.

The process takes anywhere from 72 hours to 30 days (depending on the model and region) and this is what you need to do:

  1. Link your Mi Account to your phone: Go to Settings β†’ Xiaomi Account. Sign in or create a new account. Enable data sync.
  2. Activate USB debugging and OEM unlocking: In Settings β†’ About Phone, click 7 times on the MIUI version to turn on Developer Mode. Return to Settings β†’ Additional β†’ For Developers. Enable USB Debugging and OEM Unlock.

Connect your phone to your PC and start the Mi Unlock Tool

  • Download the official tool from the Xiaomi website.
  • Start the program, log in under the same Mi Account as on your phone.
  • Follow the instructions on the screen. If you receive a message about the need to wait, wait for an SMS or notification in your account.

Once successfully unlocked, the phone will automatically reset to factory settings. All data will be deleted!

Linked to the Mi Account to the device|Debugging is on. USB|Unlocking enabled OEM|Drivers installed ADB/Fastboot PC-only|The phone is charged at least to 60%-->

What if the Mi Unlock Tool can’t see the device?
If the program does not recognize the connected phone, check the following: 1. Drivers: Install the latest driver versions for the device. ADB Fastboot (can be downloaded via Minimal) ADB and Fastboot). 2. Cable: Use the original USB-cable (cheap cables may not support data transmission). 3. USB: Try to connect to another port (preferably) USB Fastboot Mode: Reboot your phone in Fastboot manually (press Power) + Vol Down with your phone turned off). 5 Antivirus: Disable antivirus – it can block Mi Unlock Tool.

3. firmware selection: official MIUI vs custom builds

Once you unlock the bootloader, you need to decide on the type of firmware. Each option has pros and cons:

Type of firmwareAdvantagesDeficienciesWho's right for?
Official MIUI (Stable)Maximum stability Support for all functions (camera, NFC, IR-blaster) Regular security updatesMany preinstalled software Advertising in system applications Limited customizationUsers who need reliability and all the features out of the box
Official MIUI (beta)Early access to new features Less advertising (in recent versions)Possible bugs and unstable work Not all functions can work correctlyEnthusiasts willing to put up with bugs for the sake of new features
LineageOS (Pixel Experience)Clean Android without ads Long-term support (even for older models) Flexible interface setupCamera, NFC or other modules may not work No official support from XiaomiAdvanced users who need a β€œclean” Android

Where to download firmware:

  • 🌍 Official. MIUI: Official website (select the Global Region, EEA China, depending on the model).
  • πŸ› οΈ Custom firmware: XDA Developers or 4PDA (Look for topics for your model).
  • πŸ”„ Stock Android: Projects like Pixel Experience or Havoc-OS (require unlocked bootloader).

πŸ’‘

Before downloading the firmware, check its compatibility with your model by codename (for example, alioth for Poco F3). Installing firmware from another model will lead to the device failure.

Fastboot is considered the most reliable method for installing an official MIUI, it is suitable for restoring the device after a failure or switching to another version of the firmware.

  • PC with ADB and Fastboot installed.
  • Firmware in.tgz or.zip format (unpacked in a folder).
  • USB cable (preferably original).

Step-by-step:

  1. Unpack the firmware in a folder on your PC. Inside should be files with.img extensions (e.g. boot.img, system.img).
  2. Turn your phone into Fastboot mode: Turn off the device. Press Power + Vol Down before the Fastboot logo appears.

Connect your phone to your PC

fastboot devices

If the device is displayed, you can continue.

Run the firmware script.

  • For Windows: Launch the file flash_all.bat (double-click).
  • For Linux/macOS: use flash_all.sh terminal.
  • Wait until it's done. The phone will reboot automatically. The first launch can take up to 10 minutes.

πŸ’‘

If an anti-rollback error appears during firmware through Fastboot, it means you are trying to install an older version of MIUI. In this case, go back to a newer firmware or look for special patches on forums.

5. Install custom firmware through Recovery (TWRP)

Unofficial firmware (like LineageOS or Pixel Experience) requires custom Recovery, usually TWRP, which is more flexible but also more risky because it requires manual intervention.

Here's what we need to do:

  1. Install. TWRP: Download the image TWRP Transfer your phone to Fastboot and execute the command: fastboot flash recovery twrp-3.7.0_9-0-alioth.img (replace alioth with the code name of your model. TWRP, Otherwise, the system will overwrite it to stock Recovery. To do this, select Recovery Mode from the volume buttons in Fastboot.
  2. Backup in TWRP: Select Backup from the main menu. Swipe to confirm. Backup to memory card or internal memory.

Install custom firmware

  • Copy the firmware file (.zip) to your phone.
  • In TWRP, select Install, find the file and swipe to install.
  • After installing the firmware, be sure to flash Gapps (if they are not included in the firmware).
  • Clear the cache: Wipe β†’ Format Data β†’ enter β€œyes” (this step will delete all data, but is necessary to avoid errors).
  • Reboot to the system. The first launch can take up to 15 minutes.
What are Gapps and why do they need them?
Gapps (Google Apps) are Google’s Play Market, Gmail, YouTube, and other apps and services that are not included in custom firmware for licensing reasons, without which you will not be able to use most of Google’s services.

⚠️ Note: On new Xiaomi devices (e.g. Xiaomi) 13/14, Redmi Note 12) Installation of custom firmware can lead to problems with data encryption. If after firmware the phone requires a password that you did not set, try to reset the data through the TWRP (Wipe β†’ Format Data).

Possible errors and their solution

Even with strict adherence to the instructions, problems can arise, and here are the most common mistakes and ways to correct them:

Mistake.Reason.Decision
Fastboot: FAILED (remote: 'Flashing is not allowed in Lock State')The bootloader is not unlockedUnlock the bootloader through the Mi Unlock Tool (see Section 2)
E: Unknown command [log] in TWRPIncompatible version of TWRPDownload the current version of TWRP for your model
The phone does not turn on after firmware (black screen)Incorrect firmware or failure during installationTry flashing again through Fastboot or restoring backup to TWRP
Anti-rollback check failReverse to the old version of MIUIInstall a newer firmware or look for a patch on forums
No network after firmwareNo modems (baseband) are installedSelect modem.img and vendor.img files via Fastboot

If your device is no longer on (brick), don't panic. In most cases, it can be restored:

  • πŸ”Œ Soft-brick (phone turned on but not booted): try reflashing via Fastboot or TWRP.
  • 🧱 Hard-brick (no reaction at all): EDL-The mode (emergency firmware via special cable or box) is complex and requires experience.

⚠️ Note: If you have a device through EDL If the chip is not turned on, check to see if the eMMC chip is burned (a common problem with misuse of the Mi Flash Tool), in which case only repairs at the service center will help.

7. How to return the official firmware and warranty

If you want to return to the official MIUI after experimenting with custom firmware, you can do this in two ways:

  1. Through Fastboot (recommended): Download stable global firmware for your model from the official website. Unpack it and launch it. flash_all.bat (see section 4). After firmware, the phone will automatically block the bootloader, but the warranty will not be restored.

Through the Mi Flash Tool

  • Download Mi Flash Tool and firmware in.tgz format.
  • Connect your phone in EDL mode (a special cable or test points are required).
  • Select the Clean All option and start the firmware.

It is important to understand that the Xiaomi warranty is canceled when:

  • Unlock the loader.
  • Install custom firmware or Recovery.
  • Interference with system partitions (e.g. root rights).

To return the guarantee, you need:

  1. Switch the official MIUI through Fastboot.
  2. Lock the boot loader back (possibly not on all models).
  3. Reset the unlock counter (requires an appeal to the Xiaomi service center).

Even after that, though, the service center can detect traces of firmware interference, and if the warranty is critical, it's best not to experiment with custom firmware.

8.Security and optimization tips after firmware

After successfully installing a new firmware, follow these guidelines to avoid problems:

  • πŸ”’ Set up a lock on the screen immediately after the first run. On custom firmware, without this, data encryption may not work.
  • πŸ“± Update all apps through the Play Market (if you have installed Gapps).
  • πŸ”„ Check the main features: Camera (including night mode and video) 4K). Mobile network and Wi-Fi. NFC and IR-blaster (if any) Fingerprint sensor.
  • πŸ“Š Optimize Performance: Turn Off Animations in Settings β†’ For developers, use Greenify to freeze unnecessary apps. On custom firmware, turn on ZRAM augmentation.

If you have custom firmware installed, keep an eye out for updates on the developer forum. Many firmware (like LineageOS) are updated weekly, and skipping updates can lead to security vulnerabilities.

πŸ’‘

To check if the camera is working properly after the firmware, install the Manual Camera Compatibility app from the Play Market, which will show you whether all shooting modes (HDR, night mode, 4K) are supported.

FAQ: Frequent questions about Xiaomi firmware

❓ Can I flash Xiaomi without unlocking the bootloader?
No, installing any unofficial firmware or modified Recovery requires an unlocked bootloader. The exception is an update via Settings β†’ System Update, but this is not a complete firmware reflash, but only an update of the current version of MIUI.
❓ Why does the mobile network not work after the firmware?
This is a typical problem when installing custom firmware. The reasons may be: Do not embroidery the files modem.img and vendor.img. Incompatibility of firmware with your model (for example, firmware for Global on the China version of the phone); Lack of IMEI (check through the code *#06#). Solution: Sweak the correct modem files or restore IMEI via TWRP (instructions are on 4PDA).
❓ How to know if the bootloader is unlocked on my Xiaomi?
Turn off the phone, then press Power + Vol Up. If Unlocked appears at the bottom of the screen, the bootloader is unlocked. If Locked is locked. You can also check through the command in ADB: adb shell getprop ro.boot.bootloader If the answer is unlocked, the bootloader is unlocked.
❓ Which firmware is better to choose for maximum performance?
It depends on your goals: For games and performance: Official MIUI with disabled animations or custom firmware based on Android 13/14 with a core optimized for your model (see for a XDA). For long-term autonomy: KernelSU core firmware or modified versions MIUI For pure Android: Pixel Experience or LineageOS (but some features, such as, IR-blaster).
❓ Can I use Xiaomi to help you? OTG-cable?
Technically, yes, but it's extremely inconvenient and risky. TWRP on OTG-- Install the storage device. TWRP via Fastboot from another phone (using the OTG-adapter. ZIP-file-through TWRP. However, without a PC, you will not be able to unlock the bootloader or restore the device in the event of a failure.