Install custom firmware on Xiaomi through a computer: the full guide

Modifying Xiaomiโ€™s operating system is a powerful tool for those who want to gain full control of their device. Users often look for ways to bypass the limitations of the standard MIUI or HyperOS shell to introduce new features, improve autonomy, or simply install a pure Android. The process of flashing through a personal computer is considered the most reliable method, since it minimizes the risks of the phone hanging during critical operations.

However, interfering with the system partition requires high concentration and precise algorithm follow-up, and any error when working with the bootloader or partition recovery can turn the smartphone into a โ€œbrickโ€. In this material, we will discuss in detail how to safely prepare the gadget, unlock the bootloader and install custom software using only a PC and a computer. USB-cable.

Preparation of equipment and software

Before you start any manipulation, you need to make sure that your computer and smartphone are fully ready for work. You need a stable connection and a set of specialized slits, without which the process is impossible. USB-cable is not just an accessory, but a critical element of the chain; the use of cheap analogues often leads to a communication interruption at the most inopportune time, which is fraught with fatal consequences for the system.

The computer must have Windows installed (versions 10 or 11 provide better driver compatibility), and you will also need to download and install the ADB and Fastboot package, which serves as a bridge between the computer's OS and the phone bootloader mode, without these drivers, the computer simply will not see the device in the desired mode.

The battery charge should be at least 60-70% charged, because the firmware process is energy intensive, and if the phone turns off while it's being stored, it's going to be extremely difficult to recover it even through the engineering port.

โ˜‘๏ธ Firmware readiness

Done: 0 / 5

Make sure that there is enough free space on your PC hard drive and antivirus software does not block the system utilities. Sometimes Windows defenders mistakenly label tools for working with the bootloader as a threat, so it is better to temporarily disable them during the procedure.

Unlocking the Bootloader bootloader

The first and mandatory step is to unlock the bootloader. Xiaomi specifically restricts access to the system partition for security purposes, so standard custom recavator installation is impossible without this step. First, you need to link your Mi Account account to the device in the developer settings menu.

Once tied, youโ€™ll have to wait 7 to 168 hours (depending on your region and account status), which is the time it takes for the companyโ€™s servers to verify the request. After the wait period, you can run the Mi Unlock Tool on your computer, put your smartphone into Fastboot mode (clamp down volume and power buttons) and unlock it.

โš ๏ธ Warning: The bootloader unlock process automatically performs a full Wipe Data reset. All photos, contacts and apps will be deleted, so back up important information in advance.

It is important to understand that once unlocked, some security features, such as Google Pay or banking apps, may stop working as standard, and that restoring them will require additional root rights manipulation or concealment of system modifications.

Why is Xiaomi introducing wait?
The company has implemented a waiting timer to make life difficult for scammers who steal phones and try to quickly reflash them to bypass account locks, a measure to protect the owner's data in the event of a device being stolen.

Installation of custom TWRP Recovery

The Recovery Recovery Recovery Recovery Menu is a trimmed-down service that doesn't allow third-party firmware installations, and uses TWRP, the most popular custom environment, to make full partition backups, clear cache, and install zip archives with modifications.

The installation process is as follows: the downloaded image.img is renamed to twrp.img And it's put in a tool folder. ADB. The phone is then switched to Fastboot mode and a command is executed via the command line to fastboot flash recovery. twrp.img. Immediately after that, you need to pinch the button combination to enter the recovery menu to prevent the system from rebooting to standard mode.

๐Ÿ’ก

Use the fastboot boot twrp.img command to temporarily run the TWRP without writing to memory, which will allow you to check the performance of the Recovery before it is permanently installed.

Some new models with dynamic partitions may have different procedures, requiring both slots (A and B) to be installed at once, or special installer scripts that are tailored to a particular Snapdragon or MediaTek processor model.

Custom firmware installation process

Once a TWRP is successfully installed, you can move to the main part, the operating system installation. The firmware file (usually a.zip archive) must be copied to the phone's internal memory or to the connected microSD card. Launch the recovery menu, select Install, and specify the path to the file.

A critical step is Wipe Cleanup, which requires either Full Wipe or Format Data to be installed before installing a new system to remove the remnants of the old firmware and avoid file conflicts, and skipping this step often leads to an endless bootloop or unstable touchscreen.

Type of cleaningWhat's removedWhen to apply
Dalvik / ART CacheCash compilation applicationsWhen updating the firmware version
CacheSystem cacheWith each update
DataAll user dataWhen changing the firmware type (from MIUI to AOSP)
SystemOperating system filesWith complete flashing of the device

Once you have selected the firmware file, swipe it, confirm the action, take 2 to 10 minutes, depending on the memory rate and system size, and you will see progress in the installation log; Successful signifies successful completion.

๐Ÿ“Š What kind of firmware do you plan to put?
Official Global
Pixel Experience
LineageOS
Xiaomi.eu
The other custom

Don't interrupt the process or turn off the cable until the progress indicator reaches 100%. Even if it seems that the phone is getting stuck, wait a few minutes - writing large amounts of data can take time.

Install Google Apps and Root Rights

Many custom firmware, especially based on AOSP (Android Open Source Project, which comes without Google services preinstalled, requires you to install GApps immediately after you have installed the Play Market, YouTube and maps without restarting the system. Select the version that matches your firmwareโ€™s Android version (like Android 13 or 14) and processor architecture (usually). arm64).

For users who need full access to the system, setting superuser rights is relevant. Today, the de facto standard is Magisk. The Magisk installer file is also stitched through the Install menu in TWRP immediately after the main firmware and GApps.

โš ๏ธ Attention: Rootright installation can disrupt high-security applications (banks, government services) and be prepared for the additional root hiding configuration required to operate them.

The TWRP procedure must be strictly followed: first, the OS firmware, then GApps, then Magisk, and only at the very end, clearing the Dalvik/ART cache and restarting. Sequence disruption can lead to rights not being applied or Google services not working properly.

Possible errors and methods of their elimination

Even with the exact instructions, there can be unexpected situations. One of the most common problems is Bootloop. If the phone is constantly rebooting, try logging in to TWRP and running Wipe Data again, making sure the formatting was successful.

If your computer stopped seeing your phone in Fastboot mode, the problem could be in the drivers. USB-switch the device to another port (preferably) USB 2.0) or reinstall Qualcomm or MediaTek drivers manually through Device Manager.

๐Ÿ’ก

90% of problems with firmware are associated with poor quality USB-cable or battery failure, use only proven accessories.

In the case of critical errors, when TWRP does not start, you may need to return to the stock firmware through EDL (Emergency Download Mode) mode, which allows you to restore the phone even when the bootloader is damaged, but it often requires disassembling the device to close contacts on the board or having an authorized Mi Account.

Will the warranty fly after installing custom firmware?
Formally, software integrity breaches and bootloader unlocks are grounds for denial of warranty service. However, if you can return the device to a stock state (lock the bootloader and install official firmware), visually detecting interference will be difficult, but the risk of denial of warranty for software reasons remains high.
Can I update the custom firmware "over the air" (OTA)?
In most cases, automatic updates don't work on custom builds. You'll have to manually download a new firmware version and install it through TWRP every time. Some projects, like LineageOS, have an inbuilt update mechanism, but it requires separate customization and isn't always stable.
What if the camera doesnโ€™t work after the firmware?
The quality of the camera is directly dependent on drivers and image processing algorithms, which are often unique to stock MIUI. Custom firmware often uses universal drivers, which degrades the photo. The solution may be to install a ported GCam (Google Camera) or search for specific patches for your model.