This guide should work with any Xiaomi device, including the Redmi K20, Redmi K20 Pro, Xiaomi Mi 9T and Xiaomi Mi 9T Pro.
Install ADB on windows 10
Unlock bootloader
Install TWRP
Flash custom ROM
Remarks:
** It is not always necessary to wipe system, since most custom ROMs automatically wipe system. Wiping anyway should not do any harm. Furthermore, formatting data (wipe > format data > type yes) is unnecessary most of the time. It is useful for people who have an encrypted device. If your device is encrypted and TWRP fails to flash, format data to remove encryption. Note that if you disabled all lockscreen security, then encryption is disabled. Encryption is not possible without lockscreen security. To encrypt again after flashing, go to device settings in the new ROM. Be sure to setup lockscreen security first.
Install ADB on windows 10
- Go to developer.android.com and download SDK Platform-Tools for Windows as ZIP
- Unzip and save in a folder on the C drive. Remark: you do not have to install anything or run any program.
- Check installation: Shift+right click on an empty area in the folder and select open command prompt here and type adb. The result should be similar to this: Android Debug Bridge version 1.0.39 Revision 3db08f2c6889-android Installed as C:\ADB\platform-tools\adb.exe. If ADB is not correctly installed, you will probably see the following message: ‘adb’ is not recognized as an internal or external command, operable program or batch file.
Unlock bootloader
- Backup all your personal documents
- Turn off lockscreen security (fingerprint, code, face ID)
- Make sure you have sufficient battery.
- Make a Mi account: Settings > Mi account
- Activate developer options: Settings > about > MIUI version: Tap 5 times
- Enable OEM unlocking: Developer options > OEM unlocking
- Enter fastboot mode: Hold volume down + power
- Connect to PC and install drivers: Use device manager and select manually downloaded drivers
- Download unlock tool: Go to en.MIUI/unlock > Unlock now > Sign in > Download Mi Unlock as ZIP
- Unlock bootloader: Extract ZIP > Run miflash_unlock.exe > Sign in with your Mi account and follow instructions. The unlock tool will say unlocked successfully and the phone will reboot itself
Install TWRP
- Enable USB debugging: Settings > Developer Options > USB Debugging
- Download TWRP ZIP: Unzip
- Flash TWRP: Boot into bootloader. Connect to PC. Open folder where twrp.img is stored. Shift+right click on an empty area in the folder and select open command prompt here. Type fastboot devices to ensure your phone is recognized. Flash TWRP by typing fastboot flash recovery twrp.img.
Flash custom ROM
- Download files: Download the ROM (and other files like Gapps, Magisk) and move it to your internal storage
- Backup stock ROM: Select backup. Select system (not system image) & select boot. Select storage where the backup will be saved. Name the backup. Swipe to backup. When the backup is done, press reboot system for your phone to start up normally. Keep a copy of the backup on the internal storage and one on your PC
- Wipe old software: Boot into recovery. Select wipe. Select advanced wipe. Select data, cache, dalvik cache and system** and swipe to wipe. When the reset is done, press back (twice) to return to the TWRP homescreen.
- Flash ROM: Select install. Select the ROM (and add other files like Gapps, Magisk). Swipe to confirm flash. When flashing is done, press reboot system. The first boot will take a lot longer than usual.
Remarks:
** It is not always necessary to wipe system, since most custom ROMs automatically wipe system. Wiping anyway should not do any harm. Furthermore, formatting data (wipe > format data > type yes) is unnecessary most of the time. It is useful for people who have an encrypted device. If your device is encrypted and TWRP fails to flash, format data to remove encryption. Note that if you disabled all lockscreen security, then encryption is disabled. Encryption is not possible without lockscreen security. To encrypt again after flashing, go to device settings in the new ROM. Be sure to setup lockscreen security first.
Last edited: