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

Introduction: Why you need a full reflash Xiaomi

Reflashing Xiaomi’s smartphone isn’t just a system update, it’s a radical software change that can solve performance problems, remove preinstalled software, or even give access to new features. OTA-Updates, full firmware involves replacing the entire operating system, including the kernel, drivers and system applications.

The main reasons why users resort to this method are: freezes after updating MIUI, the need to install custom firmware (for example, LineageOS or Pixel Experience), removal of the bloat, restoration of the "brick" after a failed upgrade or unlocking additional features (for example, Camera2 API for manual photo settings).

This is the same as most Xiaomi, Redmi and POCO models (Redmi Note 4X to Xiaomi 14 Ultra), but it is important to consider the specifics of a particular device. For example, for devices on the MediaTek platform (for example, Redmi 9A), the process of unlocking the bootloader is different from the models on the Qualcomm Snapdragon (for example, POCO F5).

Preparation for Flashing: What to Do Before Starting

Before you start firmware, you need to follow a few critical steps: first, back up all your data: contacts, photos, messages and applications. Full firmware erases the internal memory of the device, and then you can't recover the information. Use Mi Cloud, Google Drive or local copy on your PC.

Second, check the device model and current version of MIUI. This can be done in the Settings β†’ About phone menu. Write down the exact data: for example, Redmi Note 11 Pro 5G (codename veux) with MIUI version 14.0.5.

  • πŸ“± Find out the code name of the device (e.g., raphael for Redmi) K20 Use services like Xiaomi Flash or XiaomiUI base.
  • πŸ”‹ Charge the battery to at least 60%. interruption of the process due to battery discharge can cause damage to the loader.
  • πŸ–₯️ Prepare a PC with Windows 10/11. Fastboot will require Qualcomm or MediaTek drivers, as well as Mi Flash Tool or utilities. SP Flash Tool.
  • πŸ”— Download the official firmware from the site MIUI Downloads or custom forum XDA Developers.

⚠️ Note: If your device was purchased in China (suffix version) CN), Global firmware can block the network due to differences in modem software. Check compatibility on forums before starting.

πŸ“Š What kind of firmware do you plan to install?
Official MIUI (Stable)
Official MIUI (Developer)
LineageOS (Pixel Experience)
Another.

Unlocking the bootloader: a step without which you can not do

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

  1. Link your Mi Account to your device. Go to Settings β†’ Xiaomi Account β†’ Mi Cloud and log in. Without this step, Xiaomi's server won't allow unlocking.
  2. Enable USB debugging. To do this, activate Developer Mode (7 times click on the MIUI version in About Phone), then in Additional Settings β†’ Developer Settings turn on USB debugging and OEM unlock.
  3. Download Mi Unlock Tool from the official website en.miui.com/unlock and install on PC.

Next, connect your phone to your computer in Fastboot mode (turn off the device, then press Volume Down + Power). Launch the Mi Unlock Tool, log in to the same Mi Account as the phone, and follow the instructions. The process can take anywhere from a few minutes to 72 hours - that's fine, as Xiaomi checks the request on the server.

⚠️ Note: Some models (e.g. Redmi Note 10 Pro) reset data, including internal memory, after unlocking the bootloader. Don't rely on local backups - use the cloud.

What to do if Mi Unlock Tool gives you a "Couldn't unlock" error

The error "Couldn't unlock" (or code 86006) means that the Xiaomi server rejected the request.

  • Mi Account is not tied to the device (check Settings β†’ Xiaomi account).
  • The device was purchased less than 7 days ago (Xiaomi's restriction for new devices).
  • You use the unofficial version of the Mi Unlock Tool (download only from the official website).
  • The phone has custom firmware installed (go back to stock MIUI).

Solution: wait 72 hours, re-link your account and try again. If the error persists, use alternative unlock methods via EDL (requires an authorized Xiaomi account for service centers).

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 OTA-Updates, all camera and sensor functions are workingLots of bloat, advertising in system applications, limited settingsUsers who need reliability and compatibility
Official MIUI (Developer)Early access to new features, fewer restrictions on modificationsPossible bugs, frequent updates, unstable operation of some modulesEnthusiasts willing to put up with bugs for the sake of new features
LineageOS (Pixel Experience)Clean Android without bloat, advanced settings, long-term supportThe camera may not work, NFC or sensors, no. OTA-Updates from XiaomiAdvanced users who are interested in controlling the system
Port from another device (e.g. MIUI from POCO to Redmi)Unique features from other modelsHigh risk of bricks, unstable work, lack of supportExperienced modifiers ready for experimentation

For beginners, it is recommended to start with an official stable MIUI. Custom firmware requires additional knowledge (for example, installing TWRP or dm-verity patching). If you choose a cast, make sure it supports your model - check themes on XDA or in developer telegram chats.

πŸ’‘

Before installing custom firmware, check if it supports GApps (Google services).Some builds (like Havoc-OS) require a separate setup of Open GApps or NikGApps.

Firmware through Fastboot: step-by-step instructions

The Fastboot method is the most reliable way to flash Xiaomi, as it works at a low level and is suitable even for bricks.

  • πŸ’» PCs with Qualcomm or MediaTek drivers installed (depending on the device processor).
  • πŸ“‚ Firmware in.tgz or.zip format (unpack it into a folder without Cyrillic characters).
  • πŸ› οΈ Mi Flash Tool (for official firmware) or Fastboot Enhance (for customized software).

Algorithm of action:

  1. Run the Mi Flash Tool, select the folder with the unpacked firmware and press Refresh.

Flash

and wait until it's finished (usually 5-15 minutes). USB-cable!

⚠️ Note: If the process is stuck in the waiting for device phase, check the cable (use the original one). USB Type-C and port USB (preferably USB 2.0 on the back of a PC. Some motherboards have ports. USB 3.0 (blue) can cause failures.

β˜‘οΈ Preparation for firmware through Fastboot

0

Make sure the battery is charged on 60%+|Download the firmware for your model (check the code name)|Install the drivers. Qualcomm/MediaTek PC-only|Unpack the firmware in a folder without spaces and Cyrillic|Disable the antivirus (it can block the Mi Flash Tool)

Firmware through Recovery (TWRP): for custom assemblies

If you install custom firmware (like LineageOS or ArrowOS), custom recovery is required – usually TWRP. This method is more flexible, but also more risky, as errors in TWRP can damage the data partition.

Steps to install via TWRP:

  1. Install. TWRP. Download the image for your model from twrp.me and run it through Fastboot: fastboot flash recovery. twrp-3.7.0_12-veux.img fastboot boot twrp-3.7.0_12-veux.img (Replace veux with your device’s code name).
  2. Make a backup in TWRP. In the main menu, select Backup and save the Boot, System, Data and Vendor sections to the SD-card.
  3. Clear the partitions. Go to Wipe β†’ Advanced Wipe and mark: Dalvik / ART Cache System Data Cache

Don't touch it.

Vendor

Persist

Modem

Install the firmware

Install

.zip

GApps

Squeeze Magisk (optional)

Magisk.zip

On dynamic partitions devices such as the Xiaomi 12T or POCO F4, the standard TWRP may not work, in which case use modified versions (such as the OrangeFox TWRP) or stitch through the Fastboot.

πŸ’‘

If the phone doesn’t boot after installing custom firmware (hangs on the logo), try flashing the kernel (boot.img) separately through Fastboot or repeat cleaning the cache in TWRP.

Solutions for Firmware Mistakes

Even with strict adherence to the instructions, errors can occur, and here are the most common ways to correct them:

Mistake.Reason.Decision
Invalid sparse file format at header magicA firmware file or incompatible version of the Mi Flash Tool is damagedDownload the firmware again, use the Mi Flash Tool version 2020.3.14.0
This package is for"veux" devices; this is a"vili".The firmware is not suitable for your model (name encoding error)Check the code name of the device and download the correct firmware
Anti-rollback check failTrying to roll back on an older version of MIUI (Xiaomi protection)Sweep through a newer version or use EDL to get around (risky!)
The phone does not turn on after firmware (black screen)The boot or dtbo section is damagedFlow the stock core through Fastboot or restore the backup to TWRP
E: Unknown command [log] in TWRPIncompatible version of TWRP with your deviceInstall the current version of TWRP or OrangeFox

If the device doesn't respond to buttons and is not detected in Fastboot, the bootloader may be damaged, and only the firmware through EDL (Emergency Mode) will help.

  • Authorized Xiaomi account (for service centers).
  • USB Type-C cable with EDL support (e.g., original from Xiaomi)
  • Mi Flash Pro or QFil (for Qualcomm)

⚠️ Attention: Firmware through EDL drop off IMEI and the serial number on some models (for example, Redmi Note 8 Pro), they can be restored only with the help of service utilities (SN Write Tool, which requires authorization from Xiaomi.

What to do after firmware: setup and optimization

Once the firmware is successful, the device will be clean, just like it was after purchase.

  1. Go through the initial setup, but don’t restore data from the backup right away – check the stability of the system first.
  2. Update all apps via Google Play or Mi App Store.
  3. Check the operation of key functions: πŸ“Ά Mobile network and calls (especially if you have been using an informal phone) MIUI). πŸ“· Camera (on custom firmware may not work) HDR or Night Mode). πŸ”‹ Charging and displaying battery level. πŸ”Š Sound in speakers and headphones.

Set up root rights (if you installed Magisk)

adb shell


su




magisk --install-module

Install modules to hide root from banking applications (e.g. MagiskHide Props Config).

If you have a custom firmware, it is recommended:

  • πŸ”„ Disable automatic updates MIUI (If there is one, to avoid conflict.
  • πŸ›‘οΈ Install an alternative core (e.g., FrancoKernel) to improve performance.
  • 🎯 Set up build.prop to unlock additional features (e.g, Camera2 API for GCam).

πŸ’‘

To return stock sounds and MIUI animations to custom firmware, copy files from the /system/media section of stock firmware (use Root Explorer).

FAQ: Answers to Frequent Questions

Can I use Xiaomi without unlocking the bootloader?
No, official and custom firmware requires an unlocked bootloader. The only exception is an upgrade via Recovery (for example, switching from MIUI 13 to MIUI 14 without resetting data), but this is not full firmware, but only an update on top of the existing system.
How to return the official MIUI after custom firmware?
To return to stock firmware: Download the official Fastboot firmware for your model. Run it through the Mi Flash Tool with the Clean all and lock option (this will lock the bootloader back). If the device does not boot, repeat the firmware with the Clean all option (no lock).
Why is the mobile network not working after the firmware?
This problem is typical for: Install firmware from another model (for example, POCO X3 firmware on the Redmi Note 9 Pro); damage to the modem or vendor partition; no files persist (on some custom firmware); Solution: run the stock firmware through the Fastboot with the vendor Flash modem tick or restore the partition from the TWRP backup.
How to Implement Xiaomi on Mac or Linux?
For macOS or Linux, use: Fastboot: install adb and fastboot via Homebrew (brew install android-platform-tools). Mi Flash Tool: run through Wine (but driver errors are possible). Heimdall (Odin alternative for Linux) - suitable for partitioning firmware separately. For firmware through TWRP On Linux, use the command: fastboot boot twrp.img (Fastboot flash recovery to avoid replacement TWRP stock recovery at loading).
Can I use Xiaomi without losing data?
Technically, but it's not recommended. When you run through Fastboot with Save user data or Dirty Flash option in TWRP, you can: Conflicts between old and new system files; Hangings and errors in application operation; loss of data due to incompatibility of the data partition structure. If you critically save data, backup through TWRP or Titanium Backup (requires root), and then restore them after a clean firmware.