Xiaomi Redmi Note 8 Pro (xiaomi-begonia)

Contributors

 * Michaelskyf
 * kittyle

Unlocking the bootloader
Sign up for a Mi Account, register your device in the settings, and wait for a week. More info

Before you go any further
Please read Redmi Note 8 Pro XDA Megathread

Entering recovery
+

Entering fastboot
+

Via zip

 * Transfer the zip to the device
 * Flash the zip
 * Reboot
 * Transfer the zip to the device
 * Flash the zip
 * Reboot
 * Reboot

Unbricking
If something went terribly wrong (eg. boot.img doesn't contain valid DTB) your device will hard-brick. Fortunately these days it's pretty easy to unbrick the device.

Requirements (GNU/Linux):
 * Kernel patched with this patch
 * Python3:
 * SP Flash Tool (tested with version 5.2208)
 * Mediatek Bypass utility
 * Known working partitions (from backup or Android ROM)
 * MT6785 scatter file

Steps:
 * 1) Run the exploit
 * 2) Connect the device via USB and hold Volume Up (+)
 * 3) When "Protection disabled" message appears, open SP Flash Tool
 * 4) Select partition images that you want to write and click Download
 * 5) After green checkmark image appears, restart your phone

Mainline kernel
To boot mainline kernel you need:
 * 1) Non-CFW based Android boot.img
 * 2) Non-CFW firmware
 * 3) osm0sis/mkbootimg
 * 4) Android kernel (For dtb)
 * 5) This simple script (Remember to modify it)

Remember to enable pstore console If you don't get current logs in /proc/last_kmsg, try building the output.img without ramdisk (that will force kernel panic) You also need to patch drivers/watchdog/mtk_wdt.c to support "mediatek,mt6785-toprgu", otherwise the phone will reboot after a while The goal is to enable framebuffer or usb, so we can progress with mainlining

Booting process
More info

1. BROM (Boot ROM)
Boots when power is applied to SoC. Initializes flash storage and starts preloader

2. PL (Preloader)
Initializes basic devices like usb, gpio, timers, etc. If Volume Up (+) is held, PL will hand controll back to BROM wth EDL (Emergency Download Mode).

3. LK (Little Kernel)
Displays logo and verifies some partitions (TODO: which partitions). If it fails to verify partition, it won't continue. !IMPORTANT! LK WILL USE DTB (Device Tree Blob) FOUND IN BOOT.IMG which means that if DTB is invalid, the device will be hard-bricked

Additional info

 * Xiaomi_Redmi_Note_7_(xiaomi-lavender)
 * Xiaomi_Redmi_Note_8T_(xiaomi-willow)