• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[ULTIMATE GUIDE] Root Mi 9 Lite / Mi CC9 (with Magisk)

Search This thread

Hallohannes123

New member
Dec 7, 2021
1
0
A bit of context: The guide on the magisk page does not fully apply to this phone. I had various issues on the way, so this is a guide avoiding every issue I had along the way.
I took the guide from the magisk website, modified it and added notes.




BEFORE YOU START:

If ramdisk shows "yes" only patch and flash boot.img, not recovery.img
You will need to have platform tools/adb installed
To execute adb/fastboot commands open cmd in administrator mode, enter "cd <path to the folder with adb.exe>"

create and run a .bat file with the following code:

Code:
@echo off
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "osvc" /t REG_BINARY /d "0000" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "SkipContainerIdQuery" /t REG_BINARY /d "01000000" /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\18D1D00D0100" /v "SkipBOSDescriptorQuery" /t REG_BINARY /d "01000000" /f
pause

!!! FASTBOOT ONLY WORKS PROPERLY WHEN CONNECTING THE PHONE TO USB 2.0 PORTS !!! no idea why...

Disclaimer: Root will break each time you update


Patching Images​


You need the recovery.img and boot.img of your phone:

extracting recovery.img:
Code:
boot to recovery (adb reboot recovery or key combo)
In TWRP go to advanced > Terminal and Enter the following commands:
Code:
adb shell
su
#(Don't worry if this shows an error it should work anyways)
Code:
dd if=/dev/block/bootdevice/by-name/recovery of=/sdcard/recovery.img
This extracts the image to INTERNAL STORAGE

extracting boot.img:
Download the Rom file (from xiaomi.eu), unzip and copy boot.img

Patching:
Copy the boot.img and recovery.img to the internal storage of your phone
Boot back into system
Open the Magisk App
Press the Install button
Make sure "Recovery Mode" option is checked
Choose “Select and Patch a File” in method, and select the stock recovery.img
The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.
Rename the file to "magisk_patched_recovery.img"

Open the Magisk App again
Press the Install button
This time make sure "Recovery Mode" option is NOT checked
Choose “Select and Patch a File” in method, and select the stock boot.img
The Magisk app will patch the image to [Internal Storage]/Download/magisk_patched_[random_strings].img.
Rename the file to "magisk_patched_boot.img"

Copy the patched images your PC with ADB
Code:
adb pull /sdcard/Download/magisk_patched_[random_strings].img
Or just move them via USB
Move them into the directory with the adb.exe and fastboot.exe file

Flash patched (rooted) images:
reboot into fastboot mode:
Code:
adb reboot bootloader
or power+ volume down on startup

Flash the patched boot and recovery image to your device.
Code:
fastboot flash recovery magisk_patched_recovery.img
fastboot flash boot magisk_patched_boot.img

Reboot and voila!

You might need to reinstall the magisk manager app if it doesn't show as rooted in the app
 
Last edited: