How to flash Xiaomi Mi 9 through PC: a detailed guide to unlock the bootloader

Xiaomi Mi 9 is the flagship of 2019, which is still relevant thanks to the powerful hardware and active support of the development community. MIUI They stop coming out, and users are faced with brakes, bugs, or the desire to install custom firmware. OTA-update.

In this article, you will find step-by-step instructions on how to run the Mi 9 through your computer, from unlocking the bootloader to installing the firmware via MiFlash or Fastboot. We will break down errors that 90% of users encounter (such as anti-rollback or invalid image), and give recommendations on how to choose the version of MIUI - Global Stable, China Stable, EEA or custom (such as Pixel Experience), you will learn how to restore IMEI after the firmware has reset, and why you can not install the firmware with a downgrade version without special patches.

Preparation for firmware: what to do before the start

Firmware through a PC is a process that requires preparation, and without it, you risk getting a brick or losing data. Here are the steps before you start:

  • πŸ“± Save all data: firmware erases internal memory. Use Mi Mover, Google Photos or manual copying on PC.
  • πŸ”‹ Charge your smartphone to at least 60%. interruption of the process due to battery discharge can damage the boot partition.
  • πŸ–₯️ Install drivers: download Mi PC Suite or Qualcomm Drivers to recognize your device in Fastboot mode.
  • πŸ”— Unlock the bootloader (unlocked). Without it, you can't flash the Mi 9 through your PC.

Pay special attention to the firmware version. Xiaomi Mi 9 (codename cepheus) has anti-rollback protection. This means that you can not install firmware older than the one already on the device. For example, if you have MIUI 12.5 and you are trying to put MIUI 11, the smartphone will lock. Check the current version in Settings β†’ About Phone β†’ MIUI version.

⚠️ Note: If you have been stitching Mi 9 before and installing custom recavers (for example, TWRP), The backup of the stock recavers before the firmware is used through MiFlash, otherwise the process will end with the error remote: partition table does not exist.

πŸ“Š What firmware you plan to install on Xiaomi Mi 9?
Official Global Stable
Official China Stable
Castomic (AOSP, LineageOS, etc.)
EEA (European)
I don't know, I need help.

Unlocking the bootloader on Xiaomi Mi 9: Step-by-step

The bootloader on all Xiaomi smartphones is locked by default. Unlocking requires a device-based Mi Account and waiting (usually 7-15 days).

  1. Link your Mi Account to your phone: Go to Settings β†’ Xiaomi Account. Log in to your account (or create a new one). Activate Find Device and Sync.

Mi Unlock Tool

  • Download the official utility.
  • Launch it on your PC, log in to the same Mi Account as on your phone.
  • Connect the Mi 9 in Fastboot mode (clip Power + Volume down when the phone is off).
  • Press Unlock and wait until it is completed (may take a few days).

If the utility gives you an error, Cann't unlock or Current account is different from the account info on the device, check:

  • πŸ”„ Does the Mi Account match on PC and phone.
  • πŸ“Ά Is the phone connected to the Internet (via mobile network or Wi-Fi).
  • ⏳ 168 hours (7 days) have passed since the first account was linked.

πŸ’‘

If you are slow to unlock, try using the Mi Unlock Tool version 5.5.224.24, which is often more stable than newer versions.

Choosing a firmware for Xiaomi Mi 9: which one to download?

The firmware choice is crucial for the smartphone’s stability, and the following types of firmware are available for the Mi 9 (cepheus):

Type of firmwareAdvantagesDeficienciesDownload link
Global StableOfficial, optimized for the international market, support for Google servicesUpdates are less common than in the China versionOfficial website
China StableMore frequent updates, new features earlierNo Google services, localization bugs are possibleOfficial website
EEA (Europe)GDPR Compliance, No Chinese ServicesFewer functions than in the GlobalOfficial website
Castomic (AOSP)Pure Android, no MIUI, better performanceNo official support, camera or NFC bugs are possibleXDA Developers

For most users, Global Stable is the best choice. If you want the latest MIUI features, take China Stable, but be prepared to install Google Installer manually. Custom firmware (like Pixel Experience or LineageOS) will suit advanced users who want to get rid of MIUI.

⚠️ Note: Firmware for Mi 9 SE (grus or Mi 9T (Davinci is incompatible with Mi 9 (cepheus) and installing the wrong firmware will damage the modem partition and cause network loss.

β˜‘οΈ Preparation of firmware files

Done: 0 / 4

Xiaomi Mi 9 firmware via MiFlash: step-by-step instructions

MiFlash is Xiaomi's official Fastboot firmware utility, suitable for installing stock firmware (Global, China, EEA).

  1. Download and install MiFlash: Official version: link. Install the utility and Qualcomm drivers (come with the package).
  2. Prepare the firmware: Unpack the downloaded.tgz or.zip archive into a short-track folder (for example, C:\Mi9\). Make sure there is a file in the folder flash_all.bat.
  3. Connect your phone in Fastboot mode: Turn off Mi 9. Press Power + Volume down until the hare in the eardress cap appears.

Run the firmware.

  • Open MiFlash, press Select and select the firmware folder.
  • Press Refresh – the list of devices should appear COM-port.
  • Select Clean All or Clean All and Lock (if you want to lock the bootloader after you have been firmware).
  • Press Flash and wait until it is completed (5-10 minutes).

If the process is successful, the phone will restart. It can take up to 15 minutes to turn on the first one, which is normal. If MiFlash is a bug, check:

  • πŸ”Œ Is the phone connected to the back? USB-port (on the front panel of the PC may not have enough power).
  • 🚫 Is the antivirus disabled (it can block fastboot commands).
  • πŸ“ Is the firmware properly unpacked (the path to the folder should not contain Cyrillic or spaces).
What if MiFlash can’t see the phone?
1. Check if Qualcomm drivers are installed (download them separately if Mi is installed). PC The suite didn't help). 2. Try another one. USB-cable (preferably original). 3. Run MiFlash on behalf of the administrator. 4. In Device Manager, check if the phone is identified as Qualcomm HS-USB QDLoader 9008 (if yes, drivers are installed correctly).

Fastboot Firmware Manual: MiFlash Alternative

If MiFlash doesn't work or you want more control over the process, you can manually flash the Mi 9 through Fastboot commands, which is also useful for custom firmware installation.

You'll need:

  • πŸ–₯️ ADB Fastboot (download Platform Tools from Google).
  • πŸ“ Firmware in.tgz or.zip format (unpacked).
  • πŸ”Œ USB-data-couple.

Instructions:

  1. Open the command line (Win + R β†’ cmd) in the folder with the platform-tools.
  2. Connect your phone in Fastboot mode (as described above).
  3. Check the connection command: fastboot devices should appear serial number of the device.
  4. Run the firmware (for stock MIUI): fastboot flash boot.img fastboot flash recovery.img fastboot flash system.img fastboot flash vendor.img fastboot flash vendor.img fastboot flash dtbo.img fastboot flash vbmeta vbmeta.img fastboot erase userdata fastboot reboot For custom firmware, commands may differ - see the instructions for a specific build.

⚠️ Note: If you are using a custom recycler (TWRP), Do not reboot immediately after the fastboot flash recovery command. First boot to the recaveri (Power) + Volume upwards, otherwise stock MIUI rewrite it.

πŸ’‘

Fastboot firmware manually gives you more control, but requires command knowledge, and a sequence error can result in loss of IMEI or damage to the modem partition.

Mistakes in Xiaomi Mi 9 and how to fix them

Even with the correct following of the instructions, errors can occur, and here are the most common ways to solve them:

Mistake.Reason.Decision
anti-rollback check failTrying to install firmware older than the current oneUse the same or newer firmware, and if you want to downgrade it, look for a patch to bypass the anti-rollback.
invalid sparse file format at headerA firmware file or an incorrect version of MiFlash is damagedDownload the firmware again and use MiFlash 2020.3.14.0 or later.
remote: partition table doesn't existInstalled Custom Recavery (TWRP)Return stock recavities via Fastboot with the fastboot flash recovery.img command.
This package is for "cepheus" devices; this is a ""Wrong firmware (not for Mi 9)Download the firmware specifically for the cepheus model.
The phone does not turn on after the firmwareBoot or system partition damagedRepeat the firmware in Clean All mode or use it EDL-Regime (requires an authorized account).

If the IMEI is missing after the firmware or the mobile network is not working, use the recovery instructions:

  1. Download the utility to restore IMEI.
  2. Connect your phone in Fastboot mode.
  3. Enter the commands: fastboot flash modem NON-HLOS.bin fastboot erase modemst1 fastboot erase modemst2 fastboot reboot
  4. After the reboot, check the IMEI in *#06#.

What to do after firmware: setup and optimization

After successful firmware Xiaomi Mi 9 requires initial configuration.

  • πŸ”„ Reset your network settings (if there is no mobile internet): Settings β†’ SIM-maps and mobile networks β†’ Resetting network settings.
  • πŸ”’ Enable encryption (if you have stitched custom firmware): Settings β†’ Security β†’ Encryption of the telephone.
  • πŸ“± Update Google Services (if you have flashed China Stable): Install Google Installer from APKPure.
  • 🎯 Turn off unnecessary services MIUI: Advertising: Settings β†’ Memory. β†’ Cleanup β†’ Settings β†’ Disable recommendations. Analytics: Settings β†’ Additionally. β†’ Confidentiality β†’ Disable data sending.

If you have stitched custom firmware (like Pixel Experience), check:

  • πŸ“Έ Is the camera working (may require GCam installation).
  • πŸ”‹ Optimized battery (in Settings) β†’ Battery turn on adaptive charging).
  • πŸ”Š Does it work? NFC (Some assemblies require a patch).

πŸ’‘

After China Stable firmware, be sure to install Google Installer, otherwise Play Market, Gmail and other services will not work.

FAQ: Frequent questions about the firmware Xiaomi Mi 9

Can I use Mi 9 without unlocking the bootloader?
No. Without unlocking the bootloader, you can't flash the Mi 9 through your PC, the only exception being an update via OTA (if the phone turns on) or Recovery (if the stock receivers are installed).
How do I know if my Mi 9 is unlocked?
Turn off the phone and turn it on by holding Power + Volume up. If you see Unlocked under the Mi logo, the bootloader is unlocked. If not, locked.
Which version of MIUI is best installed for maximum stability?
For most users, the most popular version is Global Stable, the latest version available, and if you need new features, China Stable, but with Google Installer installed, and Custom firmware (like LineageOS) will be suitable for those who want to get rid of MIUI, but they may have camera or NFC bugs.
What to do if the phone does not turn on after the firmware?
If the screen is black and there is no response to the buttons: Connect the phone to charge for 30 minutes - maybe the battery is dead. + Volume down) and repeat the firmware. If it doesn't work, run through it. EDL-Mode (requires an authorized Xiaomi account or help from a service center).
Can I return the official firmware after the custom?
Yes, but there are nuances: If you've installed custom recavator (TWRP), return stock first. Use MiFlash in Clean all mode. Once you've run the official MIUI, the bootloader can be blocked back (but not necessarily). Note: switching from custom to official firmware can reset IMEI or modem data. Be prepared to restore it.