These are the instructions to install Cynogenmod 12.1 (lollipop) on Xiaomi Mi4 using the TWRP recovery.
Note: The following method and files can also be used to install Cynogenmod 12.1 (lollipop) on Xiaomi Mi3 smartphone.
Step 1: Download and install Xiaomi Mi4 usb driver on your computer.
Step 2: Connect your Xiaomi Mi4 smartphone to the computer.
Step 3: Download and install Minimal ADB and Fastboot tools on your computer.
Step 4: Download TWRP recovery (v188.8.131.52 tested working) on your computer.
Step 5: Now, move the TWRP recovery file to the minimal ADB and Fastboot folder (i.e c:program filesminimal adb and fastboot).
Step 6: Now, open py_cmd.exe or MAF32.exe from the Minimal ADB and Fastboot folder.
Step 7: Now give the following command: adb reboot bootloader
The above command will boot your Xiaomi Mi4 smartphone into the flastboot mode (where you will be able to see the xiaomi fastboot logo).
Step 8: Once you have successfully booted into fastboot mode, give another command: fastboot flash recovery twrp-184.108.40.206-cancro.img
The above command will flash the twrp recovery on your smartphone.
Step 9: Congratulations, you have successfully installed the TWRP recovery on your Xiaomi Mi4. Now, Lets boot into TWRP recovery mode: Being in the fastboot mode, Hold Volume Up and Power button until the “MI” logo appear on screen, then release all the buttons.
Step 10: Now, You have successfully booted into TWRP recovery mode. Tap on the Wipe > Swipe to Factory Reset.
Step 11: Now, download (link removed) latest cynogenmod firmware on your computer (latest firmware is always on the top of the list).
Step 12: Now, move the Cynogenmod firmware to your Device (TWRP allows you to copy-paste files to the device in recovery mode).
Step 13: Once you have successfully moved the Cynogenmod firmware on your device, Tap on the Install > Select the firmware file > Swipe to confirm flash.
Step 14: Now, it will hardly take 2-5 minutes to complete the flashing process. Once, flashing process is completed, Tap on Restart > System.
Congratulations, your Xiaomi Mi4 is now running on the latest Android firmware.
[*] Always download the latest Cynogenmod firmware (you can find the latest built on the top of the list).
[*] How to root: Move the flashable SuperSU to the phone SD memory > boot into twrp recovery > install > select the supersu file > swipe to install.
[*] Xiaomi Stock ROM: If you are looking for the Original Stock Firmware then head over to the Xiaomi Stock ROM page.
[*] Xiaomi USB Driver: If you are looking for the Original USB Driver then head over to the Xiaomi USB Driver page.
[*] Xiaomi Flash Tool: If you are looking for the Official Xiaomi Flash Tool then head over to the Download Xiaomi Flash Tool page.
[*] Credits: The Cynogenmod firmware shared on this page is created by Cynogenmod Inc. So, full credit goes to them for the firmware.