How to flash Xiaomi phone through ADB and Fastboot: a complete guide to unlocking the bootloader

Why is Fastboot the best way for Xiaomi?

Xiaomi Smartphone Firmware Through ADB And Fastboot remains the most reliable way to update or restore a system when the standard methods don't work. OTA-Updates that depend on the manufacturerโ€™s servers, or Recovery firmware limited to signature verification, Fastboot allows you to install any version of the software. MIUI โ€” This method is especially relevant for devices with a locked bootloader, a โ€œbrickโ€ after a failed update or when you need to roll back to the old version.

The main advantage is control of the process. You choose the firmware version (including the Developer ROM, Stable ROM or EU ROM), check its integrity and monitor each step of installation. However, there is also a major risk: error in the command or interruption of the process can turn the phone into a brick. So before you start, it is important to understand the key steps: unlock the bootloader, install drivers, select the right firmware and sequence of commands.

In this article, we will take a look at the whole process from A to Z, from PC preparation to the final phone reboot, and focus on common errors (e.g., fastboot: error: Cannot generate image or anti-rollback check fail) and how to solve them. If you've never worked with ADB/Fastboot, don't worry: the manual is adapted for beginners, but with nuances that are often ignored in simplified guides.

๐Ÿ“Š What type of firmware do you plan to install?
Official Global ROM (Global ROM)
Official Developer (Developer ROM)
LineageOS (Pixel Experience)
Other (specify in the comments)

Preparation for firmware: what to do before the start

Before you start firmware, make sure that all the preliminary steps are followed. skipping them can lead to the inability to unlock the bootloader or loss of data without the possibility of recovery.

1. Data backup

Fastboot firmware completely erases user data, including photos, contacts and apps. Use Mi Cloud or third-party utilities like Titanium Backup (requires root) to save:

  • ๐Ÿ“ฑ Contacts and messages โ€“ export to VCF-Sync the file or sync with Google.
  • ๐Ÿ“ท Photo/video โ€“ copy to PC or cloud (Google Photos, Yandex Drive).
  • ๐Ÿ”‘ Passwords and Tokens โ€“ Save Exports from Password Manager (e.g. Bitwarden).
  • ๐ŸŽฎ Game saves โ€“ use built-in game features or Helium (for Android).

2. Check the phone model and MIUI version

Not all firmware is compatible with your model.

  1. Go to Settings โ†’ About Phone โ†’ MIUI version.
  2. Click 7 times on the MIUI version to activate the Developer Mode.
  3. Back to Settings โ†’ Additionally. โ†’ For developers, find the device model line (e.g. Redmi Note 10 Pro โ€“ sweet, Poco) X3 Pro โ€” vayu).

Write down this value โ€“ youโ€™ll need it to choose the right firmware on Xiaomiโ€™s website or forums like XDA Developers.

๐Ÿ’ก

If you can't find the model code, use the Device Info HW app (available on the Play Market) to show the exact platform name, such as tucana for the Mi 9T Pro.

3. Installation of necessary tools on PC

To work with ADB/Fastboot you will need:

  • ๐Ÿ–ฅ๏ธ Windows PC 10/11 Linux (MacOS is also supported, but may require additional drivers).
  • ๐Ÿ”Œ Cable USB โ€” Original or certified (cheap cables can cause connection errors).
  • ๐Ÿ› ๏ธ Mi Unlock Tool โ€“ to unlock the bootloader (download only from the official website).
  • ๐Ÿ“ฆ Platform Tools โ€“ a package from Google with adb and fastboot utilities).
  • ๐Ÿ“ฑ Firmware in.tgz or.zip format โ€“ download from the official portal or proven sources (for example, Xiaomi Firmware Updater).

โ˜‘๏ธ Checklist before firmware

Done: 0 / 6

Unlocking the Xiaomi bootloader: step-by-step instructions

It is impossible to flash the phone through Fastboot without unlocking the bootloader. Xiaomi has introduced this security measure to prevent unofficial software installation.The process takes 3 to 15 days (due to the mandatory waiting for confirmation from Xiaomi servers) and requires the Mi Account to be linked to the device.

Step 1: Linking your Mi Account to your phone

If you haven't done it yet:

  1. Go to Settings โ†’ Xiaomi Account and log in.
  2. Turn on data synchronization.
  3. In Settings โ†’ Additional โ†’ For developers, activate options: OEM Unlocking (OEM Unlocking) Debugging over USB (USB Debugging)

Step 2: Request Unlocking through Mi Unlock Tool

Download the Mi Unlock Tool and run it on behalf of the administrator.

  1. Sign in with the same Mi Account as you do on your phone.
  2. Connect the phone in Fastboot mode (turn off the phone, then press Volume down + Power until the hare appears in the eardress cap).
  3. In the program, click Unlock. If you see a message to wait, monitor the status in the Mi Unlock app on your phone.

The wait is usually 168 hours (7 days), but for some models (such as the Poco F3 or Redmi Note 11), the wait can be reduced to 72 hours. Status is checked in Settings โ†’ Additional โ†’ Unlock Status.

What if the Mi Unlock Tool can't see the phone?
1. Check if the Fastboot drivers are installed (the phone should appear as "Android Bootloader Interface" in Device Manager). 2. Try another one. USB-port (preferably) USB 2.0). 3. Disable the antivirus - it can block the utility. 4. Use the original Xiaomi cable. 5. If the phone is not identified, try reinstalling the drivers manually through Zadig (instructions on the XDA).

Step 3: Final Unlocking

After the waiting period has expired:

  1. Reconnect your phone in Fastboot mode.
  2. Open the Mi Unlock Tool and press Unlock.
  3. Confirm the action on the phone (if necessary).
How to sew without flash_all.bat?
If the script doesn't work, you can type commands manually.Redmi Note 10 Pro (sweet): fastboot flash boot.img fastboot flash recovery.img fastboot flash system.img fastboot flash vendor vendor.img fastboot flash dtbo dtbo.img fastboot flash vbmeta vbmeta.img fastboot erase userdataboot fastboot reboot Attention: order of commands is important! Incorrect sequence can lead to a brick.

Firmware custom ROM (LineageOS, Pixel Experience) on Xiaomi

If you don't like the official MIUI, you can install custom Android firmware (like LineageOS or Pixel Experience) that is more complex and requires:

  1. Unlocked bootloader.
  2. Installed custom Recovery (TWRP or OrangeFox)
  3. A firmware compatible with your model.

Step 1: Installation of TWRP

Download the TWRP image for your model from the official website and run it through Fastboot:

fastboot flash recovery twrp-3.6.2_12-vayu.img


fastboot reboot recovery

Step 2: Firmware custom ROM

TWRP:

  1. Make a full backup (click Backup and select all sections).
  2. Click on Wipe โ†’ Advanced Wipe and tick Dalvik, Cache, System, Data.
  3. Go to Install and select the downloaded.zip with firmware.
  4. After installation, run GApps (if you need Google services) and Magisk (for root).

Step 3: First download

The first power-up can take up to 20 minutes. If the system does not load for more than 30 minutes, check:

  • Compatibility of the firmware with your model.
  • Integrity of the downloaded archive (check MD5).
  • Installation correctness (possibly missed step from format data in TWRP).

โš ๏ธ Note: Castom firmware may not support some features (e.g, NFC Poco X3 Or a wide-angle camera on the Redmi Note 9 Pro. Before installing, check the reviews on the forums. XDA or 4PDA.

How to return the official MIUI after custom firmware

If the custom ROM was unstable or you want to return the warranty, you can roll back to the official MIUI.

Download the official.tgz firmware for your model and run it through Fastboot, as described above, which will clean the phone completely and bring back stock Recovery.

Method 2: Using the Mi Flash Tool

The Mi Flash Tool automates the firmware process:

  1. Unpack the firmware.tgz in the folder.
  2. Open the Mi Flash Tool and select the firmware folder.
  3. Connect your phone in Fastboot mode.
  4. Press Refresh, then Flash.
  5. Choose Clean All (Full Cleaning) or Clean All and Lock (Locking bootloader).

The Clean all and lock option will block the bootloader back, but remember: you will have to wait 7-15 days to re-unblock.

Method 3: Through Recovery (if the bootloader is blocked)

If the bootloader is locked and the phone is turned on, you can try flashing.zip through stock Recovery:

  1. Rename the downloaded.zip to update.zip.
  2. Put it in the root of the phoneโ€™s memory.
  3. Press Volume Up + Power to enter Recovery.
  4. Select Install update.zip.

This method does not work on all models and may result in an error due to signature verification.

FAQ: Frequent questions about Xiaomiโ€™s firmware through Fastboot

Can I use Xiaomi without unlocking the bootloader?
No. All official and custom firmware via Fastboot requires an unlocked bootloader, except for an update via Recovery (if the firmware is signed by Xiaomi and compatible with the current version).
How do I know if my Xiaomi bootloader is unlocked?
Turn off the phone, then press Volume Down + Power. If Unlocked appears under the hare logo, the bootloader is unlocked. If Locked is locked.
What if the phone doesnโ€™t turn on after the firmware?
First, check if the phone is responding to the PC connection (connection sound) USB). If yes: Try flashing again through Fastboot. Use Mi Flash Tool with Clean all option. If anti-rollback error, download the special firmware for your model. If the phone doesn't respond (full break), you'll need to EDL-Mode and authorized Xiaomi account for firmware through Mi Flash Pro.
Can I flash Xiaomi via Fastboot on Mac or Linux?
Yes, but you will need: Install adb and fastboot via brew install android-platform-tools (Mac) or sudo apt install android-tools-adb android-tools-fastboot (Linux). +x flash_all.sh. Run commands on behalf of a superuser (sudo). Linux may also require adding rules to run commands. USB-devices (udev).
How to Implement Xiaomi if Mi Unlock Tool is Not Working?
Mi Unlock Tool problems are often associated with: ๐Ÿ”น Outdated version of the program (download only from the official website). ๐Ÿ”น Unbound Mi Account to phone (check Settings) โ†’ Xiaomi account). ๐Ÿ”น Antivirus Blocking (Add Mi Unlock Tool to Exceptions). ๐Ÿ”น Xiaomi server problems (try it through) VPN If nothing helps, try using alternative unlocking methods (e.g. via EDL, But it requires a special cable and a developer account).