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.
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:
- Link your Mi Account to your phone: Go to Settings β Xiaomi Account. Sign in or create a new account. Enable data sync.
- 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?
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 firmware | Advantages | Deficiencies | Who's right for? |
|---|---|---|---|
| Official MIUI (Stable) | Maximum stability Support for all functions (camera, NFC, IR-blaster) Regular security updates | Many preinstalled software Advertising in system applications Limited customization | Users 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 correctly | Enthusiasts 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 setup | Camera, NFC or other modules may not work No official support from Xiaomi | Advanced 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.
4. Install firmware via Fastboot (recommended method)
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:
- Unpack the firmware in a folder on your PC. Inside should be files with.img extensions (e.g. boot.img, system.img).
- 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 devicesIf 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:
- 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.
- 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?
β οΈ 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 unlocked | Unlock the bootloader through the Mi Unlock Tool (see Section 2) |
| E: Unknown command [log] in TWRP | Incompatible version of TWRP | Download the current version of TWRP for your model |
| The phone does not turn on after firmware (black screen) | Incorrect firmware or failure during installation | Try flashing again through Fastboot or restoring backup to TWRP |
| Anti-rollback check fail | Reverse to the old version of MIUI | Install a newer firmware or look for a patch on forums |
| No network after firmware | No modems (baseband) are installed | Select 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:
- 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:
- Switch the official MIUI through Fastboot.
- Lock the boot loader back (possibly not on all models).
- 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.