How to Reflash Xiaomi: From Unlocking to First Launch

The procedure for replacing the operating system on Xiaomi smartphones is often a necessary step for those who have experienced software failures or want to access advanced features. Unlike many other manufacturers, the Chinese brand ecosystem provides users with powerful tools for deep intervention in code, which opens up wide opportunities but also requires strict adherence to algorithms. Wrong actions can lead to the loss of warranty or turn the device into a β€œbrick”, so preparing a theoretical framework is no less important than having technical skills.

There are several methods of updating software: from the standard OTA-Updating through settings to forced installation of archives through Recovery mode or low-level Fastboot mode. The choice of the specific method depends on the current state of the gadget and the user's goals - whether it is a change of region, a rollback to a more stable version or a complete cleanup of the system. In this article, we will discuss all the stages of the process in detail, paying special attention to the nuances of unlocking the bootloader, since this step is fundamental for most advanced manipulations.

Before you start to practice, you need to understand that flashing is not just a copy of files, but a complex procedure that affects the boot sectors of memory. Errors during the preparation of drivers or the choice of a firmware version can have irreversible consequences. It is critical to understand that unlocking the bootloader on modern Xiaomi devices irrevocably erases all user data, so creating a backup is a must before starting any work.

Preparation of equipment and software

The success of the operation depends on the quality of the workplace and the availability of all the necessary components, you will need not only the smartphone itself, but also a quality smartphone. USB-A cable, preferably original or certified, capable of transmitting data at high speeds without interference. Using cheap "charging only" cables often leads to a connection breakdown at the most critical moment, which can cause errors in the recording of system partitions.

On the computer side, you need to install up-to-date ADB and Fastboot drivers, as well as specialized software from developers. Firmware archives often require unpacking utilities that support.zip and.tgz formats. It is also worth taking care of a stable power source for the PC, since a sudden power outage during data writing to the phone’s memory can fatally damage the structure of the file system.

  • πŸ“± Xiaomi smartphone with a battery charge of at least 60% to prevent sudden shutdown.
  • πŸ’» Computer or laptop with Windows operating system (most compatible with Xiaomi utilities).
  • πŸ”Œ Original. USB-Data Transfer (Data Transfer).
  • πŸ“‚ Downloaded firmware archive corresponding to the exact model of your device.

β˜‘οΈ Ready to flash

Done: 0 / 5

Special attention should be paid to the Mi Account. To unlock the bootloader, the account must be linked to the device, and from the moment of binding, a certain time must pass (usually from 7 to 168 hours, depending on the region and status of the account), You can check the binding status in the developer settings menu, where you can display the relevant information about the status of MIUI Unlock Status.

Unlocking the bootloader (Bootloader)

A bootloader is a small program that runs in front of the operating system and checks the integrity of its components. By default, it is blocked on Xiaomi devices, which prevents the installation of unofficial software and modified software_recovery_. Unlock Bootloader is a mandatory first step for any custom firmware or deep system modification.

To start, you need to activate the developer mode. Go to Settings β†’ About Phone and click 7 times in a row on the field MIUI Version (or HyperOS Version). After the notification of activation of the developer mode, go back to the main settings menu, select Additional β†’ For developers and find the Factory Unlock Status. Here you need to link the device to the account, previously turning on mobile Internet (Wi-Fi is not suitable for this operation).

⚠️ Warning: The process of unlocking the bootloader will result in the complete removal of all data from the internal storage of the smartphone, including photos, contacts and applications. Be sure to back up to the cloud service or computer before starting the procedure.

After waiting for the mandatory timer (from 7 days), you can start unlocking. Download the official Mi Unlock Tool utility from the developer's website and install it on your PC. Turn off your smartphone and enter Fastboot mode, holding the Volume Down and Power buttons simultaneously. Connect the phone to your computer with a cable and press the Unlock button in the program. The process takes a few minutes, after which the device will restart and reset to the factory settings.

πŸ“Š Have you encountered problems when unlocking the bootloader?
Yeah, waited 168 hours.
No, it unlocked right away.
There was an account link error
I'm afraid to try.

Finding and Choosing the Right Firmware

Choosing the right version of the operating system is a critical moment, as installing firmware from another model or region can bring the device down. Firmware for Xiaomi is divided into several types: Global (Global), China (Chinese), EU (European, custom) and Recovery (update without losing data) or Fastboot (full cleanup).

It is important to distinguish between archive formats..zip files are designed to be installed via the Recovery menu or regular update, while.tgz archives contain partition images and are used to run through Fastboot with full memory cleanup. When searching official resources or verified forums, always check the codename of the device, which is often different from the marketing name.

Type of firmwareFile formatMethod of installationData retention
Recovery (Stable).zipThrough the update menuYeah (usually)
Fastboot.tgzThrough the Mi Flash ToolNo (full reset)
EU (Castom).zipThrough TWRP RecoveryDepends on choice.
Weekly (Beta).zipThrough the update menuYes.

When choosing between stable (Stable) and weekly (Weekly/Developer) versions, be guided by your needs. Stable versions are less error-free and optimized for everyday use, whereas weekly builds offer the latest features and experimental changes, but may work less predictably. For most users, installing a global stable version that matches the region of residence is recommended.

Instructions for firmware through Fastboot

Fastboot firmware is the most reliable method and allows you to fully restore the system even in the event of serious software failures. This is used by the official Xiaomi Mi Flash Tool. First, unpack the downloaded firmware archive (.tgz format) into the root of the disk or a short-path folder that does not contain Cyrillic characters to avoid path reading errors.

Launch the Mi Flash Tool on behalf of the administrator. Put the smartphone in Fastboot mode (clamping Volume Down + Power) and connect it to your PC. In the program, press the Refresh button to let the utility detect the device. In the lower right corner, select firmware mode: Clean all (full cleaning and installation) or Clean all and lock (cleaning, installing and re-locking the bootloader).

fastboot flash recovery recovery.img


fastboot flash boot boot.img




fastboot flash system system.img

Once you select Flash, you start writing partitions, you show progress as a percentage, you are strictly prohibited from turning off the cable or interrupting the computer during this process, and when you complete the status, you will see the word "success" and the phone will automatically restart. The first run can take up to 10-15 minutes, as the system performs the initial setup and optimization of applications.

πŸ’‘

If the firmware process hangs on a percentage, try replacing it. USB-cable or switch the device to another USB-port, preferably located directly on the motherboard (back of the PC).

Installation of custom Recovery (TWRP)

For those who want to install custom firmware (e.g. Xiaomi.eu) or get extended rights, standard Recovery isn’t enough. TWRP (Team Win Recovery Project is a modified recovery menu that allows you to create full partition backups, install ZIP-archives with modifications and obtain root rights. TWRP requires an unlocked bootloader and an image file twrp.img, specific to your model.

The installation process is done via the Windows command line. Open the terminal in the folder with ADB-driver and image TWRP. Enter adb reboot bootloader to go to Fastboot mode. Make sure the computer sees the device by running the command fastboot devices. Next, the command to write the image to the recovery: fastboot flash recovery section. twrp.img (Replace the file name with the current one).

⚠️ Attention: After the firmware TWRP You can not immediately boot the system in normal mode, otherwise the standard Recovery Xiaomi will overwrite TWRP Immediately after the flash command, you need to press the button combination to log into Recovery or execute the command fastboot boot. twrp.img first-launch.

On the menu. TWRP The interface is controlled by a sensor or volume buttons, and you can access the Wipe (clean up), Install (install) partitions. ZIP-Backup (backup) and Advanced (extended settings) are used by users through Install. ROM-You, patches to unlock Verizon or Google services on Chinese versions of devices.

Possible mistakes and ways to solve them

Even with careful preparation, there can be unexpected situations. One of the most common problems is the Mi Flash Tool's "Missmatching image and device" error, which means you're trying to flash a device with firmware not intended for its code name. The solution is one: download the correct archive corresponding to the exact model (for example, cepheus for Mi 9 or ursa for Mi 8 Explorer).

Another common problem is the indefinite bootloop after installing the firmware, which can happen if data from the old system conflicts with the new one, in which case you need to perform a full reset (Wipe Data/Factory Reset) via the Recovery menu. If the phone does not respond to buttons, try a forced reboot by holding Power and Volume Up for 15-20 seconds.

  • ❌ Anti-rollback: trying to roll back to an older version of software than the manufacturer allows. Solution: stitching only current or newer versions.
  • ❌ Driver error: the device is defined as "Unknown Device." Solution: reinstall Xiaomi drivers USB Driver via Device Manager.
  • ❌ Blocking Mi Account: if after flashing the phone requires a password from the previous owner, it is impossible to get around this without account data due to the protection of Mi Cloud.
What is Anti-Rollback Protection?
This is a security mechanism implemented by Xiaomi that prevents older versions of the bootloader and system from being installed. If the version counter in the new firmware is lower than in the current one, the device will refuse to update or may lock. Always check the Anti-rollback version before downgrading.

If a red status bar appears in the Mi Flash Tool with an error code, you can decrypt it from the log file that is created in the folder with the utility. Often the problem lies in the incompatibility of the Windows version (try compatibility mode for Windows 7) or in the antivirus that blocks the recording in memory of the device. Disabling the security software during firmware often solves the problem.

πŸ’‘

The main key to successful flashing is the exact matching of the device codename and firmware version, as well as the use of the original cable and USB 2.0 port.

Frequently Asked Questions (FAQ)

Will the warranty be reset after unlocking the bootloader?
Officially unlocking the bootloader is a violation of the user agreement and can be a reason for denial of warranty service, especially if the problem is related to software. However, if you lock the bootloader back (Clean all and lock) and install the stock firmware, visually detect the interference will be difficult, but traces in the system logs may remain.
Can I send Global ROM to the Chinese version of Xiaomi?
Technically, this is possible, but requires unlocking the bootloader and using the Fastboot method with full cleaning. However, since MIUI 11/12, Xiaomi has introduced strict regional restrictions. When trying to flash the Global ROM on a Chinese device (or vice versa), you may experience a β€œMi Account isn’t bound” error or the phone will go to the bootloop. It is safer to use custom builds (for example, Xiaomi.eu), which adapt the Chinese version to global standards.
How to return to the factory firmware after custom?
To return, you need to unlock the bootloader again (if it was blocked by custom Recovery), download the Fastboot stock firmware for your model and use the Mi Flash Tool utility in Clear All mode. This will completely remove the custom environment and return the phone to the β€œout of the box” state.
Is it safe to use automatic unlocking software?
Using third-party paid services and programs to bypass the wait of 7 days or unlock without linking the account carries high risks. Such methods often exploit vulnerabilities that can be closed at any time, and the programs themselves can contain malicious code.