Smartphones from the company Xiaomi have earned popularity due to their excellent price-performance ratio, but the standard MIUI or HyperOS shell does not always meet the needs of advanced users. System limitations, pre-installed advertising and intrusive services force many to look for alternative ways to develop their device. Flashing a smartphone opens access to a clean Android, allowing you to unlock the potential of the hardware and get rid of unnecessary software garbage.
This process, of course, is associated with certain risks, but if technology is followed, it becomes completely manageable. You have to go from unlocking the bootloader to installing a new operating system. It is important to understand that any manipulations with the system partition require care and the availability of backup copies of data, since an error can turn the phone into a “brick.”
In this article we will analyze in detail all the stages of preparation, the necessary tools and the process of installing custom software. We will look at both official recovery methods and advanced scenarios using Fastboot and Custom Recovery. Whether you want to get the latest version of Android or install a lightweight system for an old device, this guide will help you achieve your goal.
Preparatory stage and firmware selection
Before starting any actions, you need to clearly define the purpose of flashing. Do you want to return the device to its factory state after an unsuccessful experiment or install a third-party assembly such as LineageOS or Pixel Experience? The set of tools and the procedure of action depend on this choice. For official firmware, Mi Flash Tool utilities are usually used, while custom ones will require an unlocked bootloader and a special recovery menu.
⚠️ Attention: Unlocking the bootloader on Xiaomi devices leads to the complete deletion of all data from the internal memory of the smartphone. Be sure to back up your photos, contacts, and documents before starting the procedure.
Selecting a specific software version is a critical step. Don’t blindly trust the first links you come across on the Internet. Official builds can be found on the w3bsit3-dns.com forum or in the community XDA Developers, where moderators check files for malicious code. When choosing custom firmware, pay attention to the date of the last update and the status of the project: active support means that you will receive security fixes.
You also need to make sure that the selected version is compatible with the code name of your device. Smartphones of the same model range, but from different regions, may have different hardware components. Installing firmware from the global version to the Chinese one (or vice versa) without prior conversion often leads to problems with communication or the camera. Use specialized applications or websites to check the exact model of your gadget.
You will need a high-quality USB cable, preferably original or certified, since cheap analogues often do not provide stable data transfer. The computer must be equipped with the latest ADB and Fastboot drivers. Without these components, interaction with the phone in service mode will be impossible.
Download firmware files only from trusted resources, such as the official Xiaomi website or authoritative threads on XDA Developers. Avoid suspicious file hosting services where the archive may be damaged or contain viruses.
Unlocking the Bootloader
The unlocking process Bootloader is a prerequisite for installing any unverified software. Xiaomi has deliberately complicated this procedure by introducing a mandatory wait and linking to a Mi account. This is done for security purposes to prevent devices from being stolen and reprogrammed by attackers.
First, you need to go into your phone settings and activate developer mode. This is done by repeatedly clicking on the build number in the About the phonesection. After the corresponding notification appears, go to the menu For developers and enable the option Factory unlocking (OEM Unlocking). The system will warn you about the risks - confirm the action.
Next you should link the device to your account. In the same developer menu, find the item Mi Unlock status and click the add account button. Make sure that the phone has a SIM card with active mobile data, since Wi-Fi in this process may not be enough for authorization on the company servers.
⚠️ Attention: After linking the account, the system can set a waiting timer from 7 to 168 hours. During this period, repeated unlocking attempts will be blocked by a message about the need to wait.
After the waiting time has expired, connect the phone to the computer in Fastbootmode. To do this, turn off your smartphone and press the volume down and power buttons at the same time. An image of a hare in a hat with earflaps, repairing an android, will appear on the screen. Run the utility Mi Unlock Tool on your PC, log into the same Mi account and press the unlock button. The process will take a few minutes and will end with the device rebooting with cleared memory.
Installing drivers and setting up ADB
Stable operation of the firmware tools directly depends on the correctness of the installed drivers in the computer's operating system. Windows 10 and 11 often automatically find basic drivers, but for Fastboot i ADB y mode this may not be enough. It is recommended to download the official package Xiaomi USB Drivers or the universal Google USB Driver.
After installing the drivers, you need to check the connection with the device. Open Command Prompt or PowerShell in the platform tools folder and enter the command to test the connection. If the drivers are installed correctly, the terminal will display the serial number of your device.
adb devices
If the list shows a device with status unauthorized, look at the smartphone screen. A window should appear asking you to allow USB debugging. Check the box “Always allow” and click “OK”. After re-entering the command, the status should change to device.
To work in bootloader mode, another command is used. Put your phone into Fastboot mode and enter:
fastboot devices
Successful output of the serial number means that the computer is ready to send low-level commands. If the device is not detected, try changing the USB port (it is advisable to use the USB 2.0 port on the rear panel of the system unit) or replace the cable. Often the problem lies precisely in the physical connection.
☑️ Checking the readiness of the tools
Installing Custom Recovery (TWRP)
The standard Xiaomi recovery menu has limited functionality and does not allow installing packages that are not signed with the company’s digital keys. To fully work with custom firmware, you need to install a third-party recovery, the most popular of which is TWRP (Team Win Recovery Project).
The recovery image (.img file) must be downloaded strictly for your device model. There are no universal versions, as the memory partition layout and display drivers are unique to each chipset. Find the current file on the official TWRP website or thematic forums.
The installation process is carried out through Fastboot mode. Connect the phone to the PC, make sure it is detected, and run the command to flash the image to the recovery partition. It is important to use the flag --no-slot for some devices with dynamic partitions, but for most older and medium-sized models the standard command is suitable:
fastboot flash recovery twrp_image_name.img
Immediately after executing the command, you cannot boot in normal mode, otherwise the standard system will overwrite the installed recovery. You must immediately hold down the combination of buttons to enter recovery mode (usually Volume Up + Power). If you see the TWRP menu with touch controls, then the installation was successful.
What to do if TWRP asks for a password?
If after installing TWRP, the system requires a screen unlock password, but you did not enter it, data encryption may be preventing access. Try executing the format data command in the Wipe menu, but this will delete all files.
Flashing process and cleaning partitions
Before installing a new operating system, you must completely clear old data. This prevents file conflicts, application errors and cyclic reboots (bootloop). In the TWRP menu, go to section Wipe and select Advanced Wipe.
You need to mark sections Dalvik / ART Cache, System, Data and Cache. The section Internal Storage does not need to be touched if you store the archive with the firmware there. Swipe to confirm cleaning. This step is critical for the stability of the future system.
Next go to the menu Install and select the previously downloaded ZIP archive with the firmware. If you also plan to install Google services (GApps) or a patch for root access (Magisk), you can add them to the installation queue using the Add more Zipsbutton. The installation order is important: first the firmware, then the add-ons.
| Section | Purpose | Do you need to clean it? |
|---|---|---|
System |
Operating system files | Yes, definitely |
Data |
User data and applications | Yes, required |
Cache |
Temporary system files | Yes, recommended |
Boot |
System kernel | No (replaceable firmware) |
After selecting all files, swipe to start installation. The process may take from 5 to 15 minutes depending on the speed of the flash memory and the size of the firmware. Do not interrupt the process or disconnect the cable. Upon completion, a button will appear Reboot System.
The first startup after flashing can last up to 10 minutes. Don’t panic if your smartphone hangs on the logo for a long time - the system optimizes applications and sets up the execution environment.
Possible problems and their solutions
Even if you strictly follow the instructions, unforeseen situations may arise. One of the most common problems is the “bootlap”, when the phone endlessly reboots at the logo. Most often, this is due to incompatibility between the version of Android and the installed kernel or data remnants from the old firmware.
If the device does not turn on at all and the screen is black, but the computer makes a USB connection sound, you may have “bricked” the phone. In this case, the EDL (Emergency Download Mode) mode will help. Entering it often requires disassembling the phone and closing special contacts on the board, or using an authorized Mi account to flash firmware via Mi Flash.
⚠️ Attention: The EDL mode on new Xiaomi models is password protected. To enter it, paid services from service centers or authorized accounts may be required, since free access to this mode was closed by the manufacturer.
Problems with the camera or lack of sound are often solved by flashing the corresponding sections Modem or Vendor from the stock firmware. Custom builds sometimes do not fully include proprietary drivers. In such cases, it is recommended to find and install the package Firmware for your model before installing the main system.
It is also worth considering that banking applications may not work on devices with an unlocked bootloader due to SafetyNet protection. To bypass this limitation, a utility Magisk with modules for hiding root access is used, but this is a constant battle of “shield and sword” between developers and Google.
app interfaces and security requirements are constantly changing. What worked on one version of Android may require different settings on a new one. Always check the comments for a specific firmware version for known bugs and ways to fix them.
Frequently asked questions
Will the warranty expire after unlocking the bootloader?
In most countries, including Russia and the CIS countries, unlocking the bootloader in itself is not grounds for refusal warranty repair if the failure is not directly related to the software. However, if you bring a phone with obvious signs of unsuccessful firmware (for example, a non-functional communication module due to an incorrect version), the service center may refuse free service. Before visiting the service, it is recommended to return the stock firmware and block the bootloader back.
Is it possible to update custom firmware over the air (OTA)?
It depends on the type of assembly. Official LineageOS nightly builds often support OTA updates directly from the settings menu. However, if you have made changes to the system partition (for example, installing Magisk or uninstalling system apps), the automatic update may fail or result in you losing root privileges. In such cases, it is safer to download the new version manually and install it via Recovery.
What to do if you forgot the pattern key after flashing the firmware?
If the device does not have a Google account configured for recovery, the only way to reset the lock is to re-enter Recovery mode and wipe the partition Data (Wipe Data/Factory Reset). This will delete all user files, but will restore access to the system. On modern versions of Android with encryption, this is the only working solution.
Is it safe to use banking applications on a flashed Xiaomi?
Without an unlocked bootloader and root access - yes, it is safe. If the bootloader is unlocked, some applications may refuse to work. To return functionality, you must use Magisk Hide or Zygisk to hide the fact of system modification from bank applications. However, no one gives a 100% guarantee, since detection methods are constantly being improved.
How to return everything back if you don’t like the new firmware?
To return to the factory state, just download the official Fastboot firmware for your model (it has a .tgz extension) and install it through the Mi Flash Tool app in Clean All. This will completely remove the custom recovery, unlock the bootloader (in some cases, re-locking with the fastboot command is required) and return the phone to the “as from the store” state.