Install custom firmware on Xiaomi via Fastboot: a complete guide with unlocking the bootloader

Installing custom firmware on Xiaomi smartphones via Fastboot mode is one of the most reliable ways to get advanced functionality, updates or get rid of preinstalled software. However, the process requires care: an error at any stage can turn a device into a β€œbrick.” Unlike the recovery method, firmware via Fastboot allows you to work with partitions directly, which is especially important for devices with a locked bootloader or damaged recovery partition.

This guide will be suitable for most Xiaomi, Redmi and POCO models released after 2018, including the Mi 11/12/13, Redmi Note 10/11/12 and POCO F3/4/5 lines. We will take all the steps from unlocking the bootloader to checking the system after the firmware. If you are a beginner, we recommend that you first familiarize yourself with frequent errors at the end of the article - this will save time and nerves.

Preparation of the device: unlocking the loader

The first and most critical step is to unlock the bootloader, which Xiaomi blocks by default to protect against unauthorized changes, without which custom firmware cannot be installed.

The unlocking process includes:

  • πŸ“± Linking the Mi Account to the device (required! without this, unlocking will not pass).
  • πŸ”“ Request permission via the official Mi Unlock Tool app (you can download it on Xiaomi website).
  • ⏳ Waiting 7–168 hours (depending on model and region) Xiaomi artificially delays unlocking to "cool" users.

Important: Once unlocked, all data on the device will be erased! back up via Settings β†’ Additional β†’ Backup or Mi Cloud. Also check if your model supports unlocking - some devices for the Chinese market (China ROM) may have restrictions.

⚠️ Warning: If you bought a smartphone with your hands, make sure the previous owner untie his Mi Account. otherwise unlocking will be impossible without his participation.

πŸ“Š What kind of firmware do you plan to install?
LineageOS
Pixel Experience
MIUI Pro/Global
Another custom
I don't know.

2. Selection of custom firmware: what to consider before installation

Not all firmware is equally useful.

  • πŸ”§ Compatible with your model (look for firmware by device code, such as raphael for Redmi) K20 Pro).
  • πŸ“… Update of build (firmware older than 6 months may contain vulnerabilities).
  • πŸ›‘οΈ Google Certificates (without them Google Pay, Netflix will not work) HD and other services).
  • πŸ”„ Type of firmware: GSI (Universal, suitable for many devices) or specific (optimized for a specific model).

Popular firmware for Xiaomi:

FirmwareFeaturesSupport for GSIReference
LineageOSClean Android, minimalist design, regular updatesYes.lineageos.org
Pixel ExperienceGoogle Pixel interface, optimized performanceYes.pixelexperience.org
MIUI ProModified MIUI without advertising, with additional featuresNo.miuipro.ru
ArrowOSBalance between customization and stability, support themesYes.arrowos.net

Critical: Unofficial firmware may contain bugs or unstable communication modules, and use them only if your model does not have an official build.

πŸ’‘

Before downloading the firmware, check the reviews on the XDA Developers forum – there are often discussed the hidden problems of specific builds.

Installation of drivers and preparation of PC

To work with Fastboot you will need:

  • πŸ–₯️ Computer running Windows 10/11 (on macOS/Linux Possible problems with drivers).
  • πŸ”Œ Cable USB Type-C (preferably original – cheap cables can cause data transmission errors).
  • πŸ› οΈ Tools: Mi Flash Tool, ADB & Fastboot, drivers Qualcomm/QUSB.

Step-by-step training:

  1. Download and install Android SDK Platform Tools (includes adb and fastboot).
  2. Install drivers for your model through the Mi Flash Tool (you can download it on the official website).
  3. Disable the driver signature in Windows (instruction below).

To disable the driver signature verification:

  1. Open the Command Prompt (Administrator).
  2. Enter the command: bcdedit /set nointegritychecks on
  3. Restart the PC.

⚠️ Note: If the device is β€œUnidentified Device” displayed in Device Manager after connecting the device, manually update the driver by specifying the folder with the Mi Flash Tool.

4. Transfer the device to Fastboot mode and check the connection

To put Xiaomi into Fastboot mode:

  1. Turn off your smartphone.
  2. Press the buttons Loud down + Power for 10-15 seconds until the Fastboot logo appears.
  3. Connect the device to the PC.

Check the connection via the command line:

  1. Open the terminal in the folder with the platform-tools.
  2. Enter the command: fastboot devices
  3. If the device is determined (the serial number will appear), you can continue. If not, check the drivers or cable.

Device in Fastboot | Drivers installed | Cable original | Data backup created | Firmware downloaded and unpacked-->

5. Fastboot Firmware Process: Step-by-step instruction

For firmware, we use the Mi Flash Tool (for official firmware) or the manual fastboot (for custom ones).

Method 1: Mi Flash Tool (for official and modified MIUI)

  1. Unpack the downloaded firmware (.tgz or.zip format) into a folder without Cyrillic.
  2. Open the Mi Flash Tool, press Select and point the path to the firmware folder.
  3. Select firmware mode: Clean all - complete cleaning (recommended for custom firmware); Clean all and lock - cleaning + lock bootloader (only for official firmware!); Save user data - data storage (not always working correctly).

Flash

Method 2: Fastboot manual commands (for AOSP-firmware)

If the firmware is in.img or.zip format for Fastboot, use the commands:

fastboot flash boot boot.img


fastboot flash system system.img




fastboot flash vendor vendor.img




fastboot flash dtbo dtbo.img




fastboot reboot

For firmware with support for dynamic partitions (for example, Android 12+), use:

fastboot update name firmware.zip

⚠️ Warning: If the process has been stuck in the flashing phase for longer than 20 minutes, do not turn off the device! USB-port or start the command.

What to do if the Mi Flash Tool gives you a "can't find" error 'flash_all.bat'?
This error occurs if you downloaded firmware not for your model or unpacked it incorrectly. Solution: 1. Check the device code (for example, raphael for Redmi K20 Pro). 2. Download the firmware for your code from the official website or Xiaomi Firmware Updater. 3. Unpack the archive in a folder with a short way (for example, C:\firmware\).

6. First start and setup after firmware

After a successful firmware:

  1. The device will automatically restart. The first start can take 10 to 20 minutes β€” don't interrupt the process.
  2. If the system does not load for more than 30 minutes, try resetting your settings via Fastboot: fastboot -w.
  3. After downloading, check: πŸ“Ά Mobile network and Wi-Fi. πŸ”Š Sound and microphone. πŸ“· Camera (some custom firmware requires separate modes for the camera).

If you're dealing with bugs:

  • πŸ”„ Go back to another assembly.
  • πŸ“₯ Install additional fixes (e.g. GCam for camera or Magisk for root rights).
  • πŸ’¬ Contact the forum. XDA or 4PDA fault-logged.

πŸ’‘

Once you have custom firmware installed, update Magisk (if you need a root) and check SafetyNet certificates through the SafetyNet Checker app.

7. Frequent errors and their solutions

Even with the exact following of the instructions, there can be problems.

Mistake.Reason.Decision
fastboot: error: Failed to boot into fastbootdIncompatible version of fastboot or driversUpdate Platform Tools and reinstall drivers
Mi Flash: "This package is for "xxx" devices"The firmware is not suitable for your model.Download the firmware with the correct device code
The device does not turn on after firmwareBoot or system partition damagedRepeat the firmware with full cleaning (fastboot -w)
Invalid sparse file format at headerFirmware file damagedDownload the firmware again, check the checksum (MD5)

If the device does not respond to buttons and is not detected by the PC:

  1. Try to pinch Volume up + Volume down + Power for 30 seconds (emergency reboot).
  2. Connect to the other one. USB-port (preferably) USB 2.0).
  3. Use a different cable and PC.
Can I get my MIUI back after a custom firmware?
Yes, but it does: Download the official firmware for your model from the Xiaomi website, flash it through the Mi Flash Tool in Clean all and lock mode (this will block the bootloader back), after the firmware is unlocked you will have to do again (wait 7-168 hours).
Why is the mobile network not working after the firmware?
This is a typical problem for AOSP-Firmware (LineageOS, Pixel Experience) Solutions: Check the settings APN (You can usually just choose the automatic setting. Set the mod. IMS For your model (see for your model) XDA). If nothing helps, try another firmware with VoLTE support.
How to check if the bootloader is unlocked?
Turn off the device, press Volume Down + Power and look at the screen: If you see Unlocked, the bootloader is unlocked. If Locked, you need to unlock. You can also check through the command: fastboot oem device-info Look for Device unlocked: true.
Do I need to install Magisk after custom firmware?
Not necessarily, but Magisk is required if: You want root rights (su). You need to hide the root from banking applications (via Magisk Hide). You need to install modules (for example, ViPER4Android for sound). Install via Fastboot or Custom Recovery (for example, TWRP).
Can I use Xiaomi without unlocking the bootloader?
No, it's impossible. All modern Xiaomi devices (after 2016) require unlocking to install custom firmware, the only exception being an OTA or Recovery update to the official firmware of the same version.