Full Firmware Xiaomi: from unlocking the bootloader to installing custom software

Why you need a full reflashing and when to do it

Xiaomi flashing is not just a system update through the settings menu, but a deep change in the device’s software. The procedure can be required in several cases: if the smartphone started to slow down due to accumulated errors in the system, if you want to install custom firmware (for example, LineageOS or Pixel Experience), or if the device was in a bootloop state (infinite boot) after a failed update.

It is important to understand the difference between firmware types: official (from Xiaomi via the slate). MIUI), Global (for the international market), custom (developed by enthusiasts) and stock (clean versions of Android without a shell). MIUI It's a global one, to get rid of all the Chinese services that are unnecessary, but without the right preparation, it could lead to a lockdown. IMEI or loss of data on the internal storage.

Another popular scenario is downgrade (a rollback to an older version). MIUI). This is true if the new update has brought a critical error, such as a camera problem on Poco. F3 post-exit MIUI 14.However, downgrade requires special care: some firmware versions block the possibility of rollback, and improper actions can turn a smartphone into a β€œbrickΒ».

Preparation for Flashing: What to Do Before Starting

Before you start the procedure, make sure that all the preliminary steps are followed, which will save you from data loss and unforeseen errors.

  • πŸ“± Save all data: firmware erases internal memory. Use Mi Cloud, Google Drive or physical backup on PC via adb backup.
  • πŸ”‹ Charge the battery to at least 60%. interruption of the process due to discharge can damage the boot partition.
  • πŸ–₯️ Install drivers: Windows will require Mi Flash Tool and Qualcomm drivers (if the chipset supports the device). EDL-regime).
  • πŸ”“ Unlock the bootloader (unless done earlier) without it, you can't install unofficial software.

Pay special attention to the choice of firmware. For Xiaomi, there are three types of files:

  • πŸ“¦.Zip is installed via Recovery (e.g, TWRP). Suitable for custom firmware.
  • πŸ“‚.tgz or.img are full images for Fastboot.
  • πŸ”„ OTA β€” Incremental updates. Not suitable for full flashing.
πŸ“Š What type of firmware do you plan to install?
Official MIUI
LineageOS (Pixel Experience)
Global version instead of Chinese
Another option

If you're re-flashing Poco X3 Pro or another device with MediaTek, check for the auth.ini file in the firmware archive. SP The Flash Tool will not be able to log in to write data. Snapdragon devices (such as Mi 11) do not require this file, but may need to unlock. OEM Unlock in the Developer Settings.

πŸ’‘

Before downloading the firmware, check its hash sum (MD5 or SHA-256) This will protect you from fake files with viruses.

Unlocking the bootloader: a mandatory step for custom firmware

The bootloader on all Xiaomi smartphones is locked by default, a security measure that prevents uncertified software from being installed.

  1. Activate OEM Unlock in the menu settings β†’ The phone. β†’ Version. MIUI (Press 7 times to create a developer section).
  2. Link your Mi Account to your device in Settings β†’ Additionally. β†’ Special facilities β†’ Mi Unlock Status.
  3. Download the Mi Unlock Tool from the official Xiaomi website (only for Windows).
  4. Connect your smartphone in Fastboot mode (clamp Volume down) + Food) and follow the instructions of the program.

Important: Xiaomi has introduced a restriction on unlocking – after linking the account, you need to wait 7 days (on some models – up to 30 days), this rule has been in effect since 2022 and is aimed at combating device theft. If you bought a smartphone from hand, make sure that the previous owner untie his Mi Account, otherwise unlocking will be impossible.

What if the Mi Unlock Tool gives you a "Couldn't unlock" error?
This error often occurs due to: - Utility and firmware version mismatch (update Mi Unlock Tool). - Incorrect account binding (check that the device is connected to the Internet via the Internet via the device. SIM-map, not Wi-Fi. - Blocking by IMEI (If the smartphone is blacklisted by Xiaomi, try alternative methods of unlocking through the phone. EDL, But it requires soldering.

Once the bootloader is successfully unlocked, the smartphone will reset to factory settings. All data will be erased, so transfer the photos and contacts to an external medium in advance. Also note that unlocking will void the warranty (if it is still valid) and may cause problems with Google Pay or Widevine. L1 (downgrade DRM streaming).

Firmware selection: official MIUI vs custom builds

Official firmware MIUI subdivided:

Type of firmwareRegionFeaturesSuitable for
China StableChinaWithout Google, many Chinese appsUsers who do not need GMS
China DeveloperChinaWeekly updates, possible bugsTesters and enthusiasts
Global StableInternationalGoogle Services, Without Chinese AppsMost users
EEA (Europe)EuropeCorresponding. GDPR, without Chinese servicesEU residents

For most users, Global Stable is the best choice. However, if you need weekly updates with new features, you can install the Developer version. K40 post-update MIUI 14.0.4.

Custom firmware like LineageOS, Pixel Experience or ArrowOS offer β€œclean” Android without shells MIUI. Their pluses:

  • βœ… Lack of advertising and unnecessary applications.
  • βœ… Longer support for older devices (for example, Redmi Note 7 gets Android 13 updates in custom builds).
  • βœ… Ability to fine-tune the interface.

Cons:

  • ❌ No official support from Xiaomi.
  • ❌ Possible camera problems (e.g. 48MP on Poco) X3 NFC).
  • ❌ Banking applications (e.g. Sberbank Online) may not work due to the lack of SafetyNet.

Before installing custom firmware, check its compatibility with your model on the forum XDA Developers or a developer's telegram chat, like a firmware for Mi. 9T (Davinci is not suitable for Mi 9T Pro (raphael), despite the similarity of the devices.

Download firmware from an official source (mi.com, xiaomifirmwareupdater.com or XDA)

Verify the device code name (e.g., "surya" for Poco) X3)

Check out the Android version (not all custom firmware supports Android 13)

Make sure you have installation instructions for your model

Download additional files (for example, Gapps for custom firmware)

-->

Fastboot Flashing: Step-by-step instructions

Fastboot Method Suitable for Installing Official Firmware MIUI It involves completely rewriting all the parts of the device, so all the data will be erased.

You will need to:

  • πŸ’» Windows computer (or Linux/macOS with fastboot and adb installed).
  • πŸ“± Cable USB Type-C (preferably original to avoid connection issues).
  • πŸ“ Firmware in.tgz or.img format (for example, surya_global_images_V12.5.3.0.RJGMIXM_20211020.0000.00_11.0_global_1d1a1a1a1a.tgz).
  • πŸ› οΈ Mi Flash Tool (for Windows) or fastboot in the terminal.

Flashing steps:

  1. Unpack the firmware archive into a folder without Cyrillic characters (e.g., C:\MIUI\rom).
  2. Launch the Mi Flash Tool, press Select and specify the path to the firmware folder.
  3. Connect your smartphone in Fastboot mode (clamp Volume down) + Food before the appearance of a bunny with the inscription Fastboot).
  4. In the Mi Flash Tool, select Clean All (Full Clean) or Clean All and Lock (Clean + Lock bootloader).
  5. Press Flash and wait until it is completed (usually 5-10 minutes).

πŸ’‘

Clean all and lock will block the bootloader after you have firmware, and only use it if you are sure you won't install custom software.

If the Mi Flash Tool is a flash not done error, check:

  • πŸ”Œ Connecting the cable (try another port) USB cable).
  • πŸ”„ The firmware version (it must match your device code).
  • πŸ” Is the bootloader unlocked (if not, return to the unlock step).

For Linux/macOS Use commands in the terminal:

fastboot flash boot boot.img


fastboot flash system system.img




fastboot flash vendor vendor.img




fastboot reboot

But note that manual firmware via fastboot requires knowing the exact partition structure of your device. A command error (e.g., fastboot flash userdata instead of fastboot erase userdata) can lead to data loss.

Flashing through Recovery (TWRP): custom-fix

If you install custom firmware (like LineageOS), custom recovery will be required – usually TWRP (Team Win Recovery Project, which allows you to install zip files and backups.

Instructions:

  1. Download. TWRP for your model from twrp.me (for example, twrp-3.7.0_9-0-surya.img POCO X3).
  2. Install it with fastboot: fastboot flash recovery twrp.img fastboot reboot recovery
  3. In TWRP, make a backup of the current firmware (Boot, System, Data sections).
  4. Wipe the Dalvik, Cache, System, Data (via Wipe) sections β†’ Advanced Wipe).
  5. Install the firmware (Install) β†’ Select.zip and, if necessary, Gapps (Google services).
How to avoid the Error 7 error in TWRP?
Error 7 is caused by a firmware/device mismatch.Solution: - Check the code name of the device (e.g. "surya" for Poco) X3, not "karna"). - Delete the assert string in the updater-script file inside the firmware.zip archive (requires archive editing). - Use firmware collected specifically for your model.

After installing the first download, it can take up to 15 minutes. Don't interrupt the process, even if the screen stays black for a long time. If the smartphone has got stuck on the Xiaomi logo for more than 30 minutes, try:

  • πŸ”„ Reboot to TWRP repeat.
  • πŸ“± Wipe the cache. β†’ Cache).
  • πŸ”§ Install another firmware version (possibly the current build contains bugs).

Some devices (such as the Mi 11 Ultra) may require additional dm-verity and forceencrypt setup to avoid data encryption issues. TWRP.

Solving common mistakes after flashing

Even if you install firmware properly, you can have problems, and here are the most common ones and how to fix them:

Problem.Possible causeDecision
The smartphone is not turned on (black screen)Incorrect firmware or interrupted processRepeat the firmware through Fastboot with a full clean (Clean all)
Hanging on the MI logoConflict of the kernel or modulesWipe Cache and Dalvik in TWRP
The sensor or display is not working.Incompatible firmware (for example, for Mi 9 installed firmware from Mi 9) SE)Install the correct firmware version for your model
No network (IMEI disabled)The modem or nvram partition is damagedRestore the nvram backup or re-flash modem separately
Google services are not workingGapps or the incorrect version are not installedInstall Open Gapps (select the option) arm64 Android version)

If it's gone after the firmware. IMEI, This is a critical error that needs to be addressed immediately:

  • πŸ“‘ Nvram partition damage (often occurs when firmware is run through) SP Flash Tool on MediaTek devices).
  • πŸ”§ Incorrect modem firmware (for example, the Note 8 modem was used for the Redmi Note 8 Pro).

To restore the IMEI:

  1. Find the backup nvram (if you did it before the firmware) and restore it through TWRP.
  2. Use the engineering menu (#4636##) and manually write IMEI (requires root rights).
  3. Only reflash the modem partition via fastboot flash modem modem.img.

πŸ’‘

If IMEI Lost, do not attempt to recover it through third-party programs (such as ChimeraTool or Maui). META). This can lead to hardware modem locking.

For Snapdragon devices (e.g. Poco) F3) sometimes helps QCN-file-through QPST. But this method requires a lot of knowledge and can permanently disable the modem.

Safety and Risks: What to Fear

Flashing is always a risk, and even experienced users face challenges, so it's important to understand the potential consequences:

  • 🚨 Brick: The device stops turning on, most often due to interrupted firmware or incompatible software.
  • πŸ”’ Blocking Mi Account: if the smartphone was linked to another account, after reset, you may need to enter the username / password of the previous owner.
  • πŸ“΅ Loss of loss IMEI Serial number: This makes the device unsuitable for calls and may require repairs at the soldering level.

To minimize the risks:

  • πŸ“Œ Use only verified firmware sources (official Xiaomi website, XDA Developers, xiaomifirmwareupdater.com).
  • πŸ”„ Make backups through TWRP before any manipulation.
  • πŸ”‹ Check with at least 80% battery charge and network adapter (not through the battery) USB port).
  • πŸ“‘ Check firmware compatibility with your model (e.g. Mi). 10T mi 10T Pros have different code names: apollo and apollopro).

If you are flashing a device with MediaTek (like the Redmi Note 9 Pro), be especially careful: a firmware error through the device. SP Flash Tool can damage the preloader, making it impossible to repair the device without a programmer. EDL-firmware.

πŸ’‘

Before the firmware check whether your model supports the mode EDL (Emergency Download Mode. To do this, connect the device turned off to a PC with the Volume Up button pressed. + Volume down. If a Qualcomm port appears in the Device Manager HS-USB QDLoader 9008, then, EDL available.

FAQ: Answers to Frequent Questions

Can I re-flash Xiaomi without unlocking the bootloader?
No, any unofficial firmware (including custom recovery) requires unlocking, but official updates via Updater or Fastboot with a locked bootloader are possible if the firmware is signed by Xiaomi.
How to return the official MIUI after custom firmware?
You can download the official firmware in.tgz format and flash it through the Clear all Fastboot, and if the bootloader is unlocked, you can lock it again by selecting the Clean all and lock option in the Mi Flash Tool.
Why is the camera or fingerprint sensor not working after the firmware?
This is a typical custom firmware problem, where proprietary drivers from Xiaomi are missing.Solutions: Install firmware that supports your model (for example, AncientOS for Poco). X3 Manually run the vendor and firmware files from stock firmware. Use alternative camera applications (e.g. GCam).
How to Switch Xiaomi if it is not turned on (brick)?
If the device does not respond to buttons, but is defined by the computer as Qualcomm HS-USB QDLoader 9008, you can try the firmware in the EDL-Mode via Mi Flash Tool or QFil. for this: Download the firmware for EDL (Usually has a.mbn extension. Connect the device to a PC with the buttons pressed Volume up. + Volume down. In the Mi Flash Tool, select firmware and press Flash. If the device is not detected even in the EDL, You will need a programmer (such as a UFi Box) or a service request.
Can I use Xiaomi to help you? OTG-computer-free?
Theoretically, yes, but in practice, it's extremely uncomfortable and risky: OTG-cable and flash drive with firmware. Castom recovery (for example, TWRP), It's already installed on the device, it's possible to boot into recovery (if the smartphone doesn't turn on, it won't work.