Install custom firmware on Xiaomi Redmi 9: the full guide

Owners of Xiaomi Redmi 9 often face a situation where the official MIUI shell no longer meets the needs for speed or functionality.Installation of a custom operating system allows you to significantly extend the life of the device, free from system debris and access the latest versions of Android.

Changing the software gives you complete control over the hardware on your smartphone, so you can uninstall system applications, customize the processor for gaming, or save energy, but you have to remember that any manipulation of the bootloader carries certain risks.

In this article, we will go into detail every step from unlocking the bootloader to the first boot in a new system, and we will look at the tools, backups, and solutions to common bugs, and if you're ready to experiment, let's get started.

Preparation of the device and necessary tools

Before you start any manipulation, you need to assemble a complete set of tools. You need a Windows computer that is working. USB-A cable and a charged smartphone, and the absence of any of these components can interrupt the process at a critical stage.

It is also important to install all the necessary drivers and programs on the PC, the main tool will be ADB and Fastboot, without which communication with the bootloader is impossible, and you will need an archiver to unpack the firmware files.

  • πŸ“± Smartphone Redmi 9 (codenamed Lancelot) with a battery charge of at least 60%.
  • πŸ’» PC with installed Xiaomi drivers USB Driver and platform tools.
  • πŸ”Œ Original or qualitative USB-data-line.
  • πŸ“ Custom Recaveri files TWRP and a firmware image in.zip format.

⚠️ Attention: All actions you perform at your own risk.The author of the article is not responsible for possible malfunctions of the device that occurred during experiments with software.

Pay special attention to your processor. Redmi 9 came in different versions, but the global version is characterized by the MediaTek Helio G80 chip. Using files intended for other processors (for example, Snapdragon) is guaranteed to turn the device into a β€œbrick.” You can check the exact model in the About section of the phone or through special applications like CPU-Z.

Unlocking the bootloader (Unlock Bootloader)

The first and mandatory step is to unlock the bootloader. Xiaomi blocks this feature by default for security reasons. Without unlocking, you will not be able to install third-party recavators or obtain root rights.

The process of linking an account takes time, and you have to apply for it in the Mi Unlock app and wait 7 to 168 hours, which is a vendor server restriction that is virtually impossible to circumvent by legal means.

1. Enable the developer mode (7 times click on the build number in About Phone).


2. In the menu for developers, select "Factory Unblocking" and link the account.




3 Download the Mi Unlock Status Check utility on PC.

After waiting for the waiting period, repeat the procedure for entering Fastboot mode. To do this, turn off the phone and press the Volume Down + Power button. Connect the cable to the computer and press the Unlock button in the utility. If everything goes well, the phone will reset and boot with the loader open.

β˜‘οΈ Checking before unlocking

Done: 0 / 4

Installation of custom TWRP Recovery

The regular recovery menu doesn't allow you to install modified systems. We'll need a TWRP (Team Win Recovery Project), a powerful tool that runs at the lower end of the operating system and allows you to manage partitions of memory.

Download the current twrp.img image, which was assembled specifically for lancelot. Do not use the Redmi 9C or 9A versions, as they have different display markups and memory controllers.

Open the command line in the ADB tool folder and type in the command to firmware the image. It is important to prevent the phone from rebooting immediately after installation, otherwise the regular recovery will overrun TWRP.

fastboot flash recovery twrp-lancelot.img


fastboot boot twrp-lancelot.img

Once you execute the command, the phone should immediately go to the TWRP menu. If you see the command logo or memory card, then everything is done. Now you can move on to cleaning the partitions and installing the new OS. TWRP interface is touch-sensitive, but sometimes it may require a swipe to confirm the actions.

πŸ“Š What is the purpose of installing custom firmware?
Acceleration of work
New design
Last Android
Experiments
I don't know.

Clearing data and formatting partitions

Switching to custom firmware requires a complete cleanup of user data, which is necessary to prevent conflicts between old MIUI system files and the new operating system, and ignoring this step often leads to endless bootloops.

From the TWRP menu, select Wipe. You need to clear the Dalvik/ART Cache, Cache, Data, and System sections. Internal Storage section is not necessary if you plan to download the archive with firmware directly from your phone.

SectionNeed to be cleaned?Effects of cleaning
DataYes (required)Delete all photos, contacts and applications
SystemYes.Removing the old MIUI OS
CacheYes.Clearing temporary files
Internal StorageNo.Deletion of the user's personal files

Once cleaned, swipe to Wipe. The process takes a few seconds. If you plan to encrypt data, you can do this in the Settings section of the recovery menu, but first you should leave the encryption disabled to avoid file access problems.

The process of installing a custom operating system

Now the most important thing is to copy a firmware archive (like LineageOS, Pixel Experience or crDroid) to your phone's internal memory or microSD card. On the TWRP menu, click Install.

Navigating the file system in TWRP can be unusual. Find the folder where you saved the.zip archive. Select the file and confirm the swipe installation. The system will begin unpacking and writing files to the System partition.

During installation, the process log will be displayed on the screen. If you see red lines with errors, the process may be interrupted. Successful is completed. After that, you need to clean Dalvik / ART Cache again through the Wipe menu.

What to do if the installation is interrupted?
If the process is stuck on the logo or gives an error, try formatting the Data partition in a format. F2FS (Wipe section -> Format Data, then re-install. Use a different version will also help. TWRP.

Some firmware requires you to install additional GApps (Google Apps) if they are not built into the image. If you downloaded the version of "Vanilla", immediately after installing the OS, without restarting, install the archive with Google services.

First start and initial setup

After all the manipulations, go back to the main TWRP menu and select Reboot -> System. The first launch of the new system can take anywhere from 3 to 10 minutes. This is normal, as it is the optimization of applications and the creation of cache.

If the phone is stuck on the bootloader logo for more than 15 minutes, you may have missed the Data cleanup step or downloaded an incompatible firmware version, in which case you will have to go back to TWRP (clamping Volume Up + Power) and repeat the Wipe procedure.

A successful launch welcomes you with a language setting screen, the new system will run much faster than the stock one, and pay attention to the battery settings and resolutions, as they may differ from the usual ones in custom OSes.

πŸ’‘

After the first download, don’t install all the applications at once, let the system run for 15-20 minutes in the background to complete database optimization.

Typical errors and methods of their elimination

Even following the instructions, you can run into problems. Often users forget to unlock the bootloader or use TWRP from another model. Errors in TWRP logs usually indicate a damaged firmware archive or incompatible versions of Android.

If the phone goes into an endless bootloop, try logging into the recavator and making Wipe Dalvik/Cache. If that doesn't work, the only way out is to return to the official firmware via the Mi Flash Tool in Fastboot mode.

  • πŸ”‹ Black screen: Press the power button on 15-20 second-on-seconds.
  • πŸ“‰ Sensor not working: Most likely installed recovery from another version of the screen (BOE vs Tianma).
  • πŸ“Ά No network: You need to reflash the modem or use firmware with the correct regional base software.

⚠️ Note: If you plan to sell the phone, be sure to return the stock firmware and lock the bootloader back, otherwise the new owner will not be able to use the device fully.

Custom firmware is a great way to get the most out of Redmi 9. However, remember that with each flashing you lose the warranty (if it was still in effect) and risk data integrity. Always back up important information before you start work.

πŸ’‘

The main key to success is the use of files (TWRP and firmware) collected strictly for the code name lancelot.

Frequently Asked Questions (FAQ)

Will the boot loader unlock counter be reset when flashing?
No, Mi Unlock is tied to your account and device ID on the server. Re-blocking the bootloader is only possible through official tools, but this can lock the phone if the firmware is not global.
Will the banking applications work after installing custom firmware?
By default, Google Pay and banking apps will not work due to root rights or an unlocked bootloader.You will need to install the Magisk module and hide the root through Zygisk.
Can I return to MIUI after installing LineageOS?
You'll need the Mi Flash Tool and the official firmware image, and if you flash it, select "Clean all" mode to remove the custom system completely.
Will the quality of the photo deteriorate after changing the firmware?
Often, cameras in custom firmware run worse than runoff due to the lack of Xiaomi processing algorithms.We recommend installing a Google Camera (GCam) with the right config for your model.