Xiaomi Redmi 9 9 Prime - phhusson/treble_experimentations GitHub Wiki

Xiaomi Redmi 9 (lancelot)

Recovery ROM: there is no official TWRP, there's a PitchBlackRecovery beta that boots (but lacks fastbootd). As of writing (May 26th 2021, the best option is an official version of Skyhawk Recovery SHRP that can be built from source and has working decryption and fastbootd (see references for links to binaries).

Background info

The device uses dynamic partitioning, you need to enter "User Mode fastboot (fastbootd)" to be able to flash the system partition. On my device, I could not go from "Bootloader fastboot" to "User Mode fastboot" with the command fastboot boot fastboot. Instead, I got an error message along the lines "unknown boot target".

What worked was: booting into system, enabling ADB and then using adb reboot fastboot to enter "User Mode fastboot (fastbootd)" or adb reboot bootloader to enter "Bootloader fastboot".

Because of this, the "normal" order of first flashing vbmeta and then flashing system is reversed in the steps below.

Steps to install

On the phone:

  • Open Settings → About phone. Tap several times MIUI Version to enable Developer options.
  • Open Settings → Additional settings → Developer options. Check that MI Unlock status is set to Unlocked, and enable USB debugging.
  • Unlock the bootloader of the Redmi 9, e.g. with XiaoMiTool V2 on Linux. Proceed only once this is done. (I had to register the device to my account and wait 7 days to achieve this milestone).

On the PC:

  • Download Stock Rom (I used EEA V11.0.9)

  • Extract vbmeta tar -xzvf lancelot_eea_global_images_V11.0.9.0.QJCEUXM_20201201.0000.00_10.0_eea_3f4b4c4909.tgz

  • Download and extract GSI image (I used v305-arm64-ab-vanilla)

  • Enter user mode fastboot (fastbootd) to flash system

    # enter user mode fastboot (fastbootd)
    adb reboot fastboot
    # wait until in fastbootd
    fastboot flash system system-roar-arm64-ab-vanilla.img
    # leave fastbootd
    fastboot reboot
    
  • The device will now be in a boot loop, because it cannot verify the new system image. You will need to disable the dmverity firmware verification (see next steps)

  • Enter Bootloader fastboot (Press Volume Down+Power together until reboot, then let go of power, keep holding Volume Down)

  • When in Bootloader fastboot, flash vbmeta

    # flash vbmeta with verity & verification disabled
    fastboot --disable-verity --disable-verification flash lancelot_eea_global_images_V11.0.9.0.QJCEUXM_20201201.0000.00_10.0_eea_3f4b4c4909/images/vbmeta     
    # reboot
    fastboot reboot
    

You only disable verified boot for one time only! So when you want to flash GSI, you don't have to disable it again

Hardware support

  • I had a problems with headphones, but this workaround fixed it.
  • Brightness had a problem, that could be fixed by "setprop persist.sys.qcom-brightness 2047" in adb (as root)
Component Comment
Camera Working
Speaker / Mic Working
Headphones Workaround required
Bluetooth Working
WiFi Working
SIM / Mobile Data / Voice Working
VoLTE Not tested
Fingerprint Not tested
NFC N/A
Offline Charging Not tested

References

Tested By: 2021/04/20 sebastianapel - Template created by @zguithues and @hackintosh5