Xiaomi Redmi Note 10 Pro (xiaomi-sweet)

Contributors

 * Zephyr1112
 * Etn40ff

Port status
Downstream kernel compiles with pmOS's build system but the resulting artifact does not boot. The same source code compiles also using android's build system and the resulting artifact boots. (See below for the required steps.)

Flash modes

 * Fastboot mode: +
 * Fastbootd mode:
 * Recovery mode: +

Unlock Bootloader (if not done)

 * First unlock your device (if not done yet). Use MiUnlock to unlock (Windows only). // If MiUnlock doesn't detect your device, follow this: Google USB Drivers install guide'
 * Follow the Instructions on the selected site
 * Note: After that do not log off your Mi Account on your phone or it won't work! It may take 7 days or more to be able to unlock your device!

Install TWRP on Redmi Note 10 Pro

 * Follow these Instructions.
 * Turn the device off (or restart also works)
 * Note: You may need to connect your device to a computer with a USB cord or the phone will skip boot to recovery.
 * Hold and  button
 * Keep holding until you see the TWRP recovery Logo.

Install pmOS
For some reason, even though the downstream kernel compiles without errors with pmOS's build system, the phone is unable to boot the resulting boot.img. Specifically if one tries to run  (or the equivalent  ) the phone's screen turns black, there is no vibration and the phone remains in fastboot mode (albeit a crippled one in which subsequent boot commands fail). Suggestions are appreciated on how to fix this issue!

Due to this issue, booting pmOS is not straightforward; here is a rough outline of how to do so.

source build/envsetup.sh lunch aosp_sweet-userdebug mka kernel mka bootimage fastboot boot \                                                                                                           :( --dtb $PMOS/cache_git/pmaports/device/testing/linux-xiaomi-sweet/prebuilt/sweet.dtb \ --header-version 2 \ --cmdline "androidboot.hardware=qcom androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 androidboot.usbcontroller=a600000.dwc3 androidboot.selinux=permissive buildvariant=eng" \ $TMP/android_boot.img-kernel \ $TMP/pmos_boot.img-ramdisk.gz
 * assumption:,    and   are some directories of your choice.
 * install
 * add  as a remote to   and switch to the branch
 * initialize  to build for   in
 * install pmOS on an SD-card and move it to the phone:
 * build pmOS's boot.img:
 * export pmOS's boot.img:
 * extract pmOS's ramdisk ( from https://github.com/sweesineng/extract_tool worked well for me, YMMV):
 * install android's
 * clone PixelExperience's sources:
 * make sure that the git repository at  is at the same commit as the one specified in
 * apply patches:
 * copy over the kernel configuration:
 * build kernel:
 * extract android's kernel:
 * put your phone in fastboot mode and boot:
 * profit

Tips and tricks
If pmOS is installed on a removable SD card android will continuously want mount and to reformat it. Unfortunately it does not look like it is possible to prevent this within android. A somewhat heavy duty workaround is to unbind the device, this requires root:


 * First find out which is the driver responsible for the sdcard:
 * then unbind it

Mainlining
NOT VERIFIED: sourced from deviceinfohw, status from sm7150-xiaomi-sweet DTS

Sources and links

 * GitLab repo: https://gitlab.com/etn40ff/pmaports (branch xiaomi-sweet)
 * Kernel used: https://github.com/PixelExperience-Devices/kernel_xiaomi_sweet

Other

 * Mainline kernel fork (WIP - currently only supports basic functions for sweet): https://github.com/sm7150-mainline/linux
 * EDK II Port: https://github.com/dopaemon/edk2-sweet