[Redmi K30 5G  ROMs, Kernels, Recoveries, & Other D] PeterCxy:
Introduction

This is a LineageOS Recovery compiled from the source tree of LineageOS 17.1 for Redmi K30 5G. This is part of my ongoing work to port LineageOS 17.1 to this device. Work on the actual LineageOS 17.1 ROM is still under way (but it should be available very soon), while the recovery has been usable for quite some time now. Since it is not possible for TWRP to support any device launched with Android 10 for now, I figured that this might be useful even before I release the LineageOS custom ROM (e.g. people may want to flash Magisk on official ROMs).

I am aware that there is a TWRP port for this device, but since the source code is not accessible (as for as I can tell, maybe I just did not look hard enough for the source code), I can only advice against using it. The official TWRP open-sourced under GPLv3 does not even support devices launched with Android 10 yet, so there's clearly something going on here. I do not fix compatibility issues between my ROM and that TWRP port.

Instructions (Installing Recovery)

This recovery ONLY works on MIUI firmware version v11.0.11.0 (stable firmware before May 2020). Xiaomi hasn't released kernel source update for later firmware versions and you may experience blank screen and similar issues if you are on a newer firmware.

1. Download vbmeta.img, recovery-XXXX.zip (extract to get recovery.img)

2. Reboot to bootloader (`adb reboot bootloader`)

3. Run `fastboot --disable-verification --disable-verity flash vbmeta vbmeta.img`

4. Run `fastboot flash recovery recovery.img`

5. Run `fastboot reboot recovery` to enter LineageOS Recovery

Instructions (Installing Magisk)

You have to use the official Magisk, version 20.4 or later. Installing an older Magisk will make the system unbootable.

1. Download Magisk >= 20.4, put onto computer

2. Reboot to LineageOS recovery, select `Mount /system` (you may see some errors, but they can be safely ignored)

3. Select `Apply update from ADB`

4. Run `adb sideload Magisk-xxx.zip`

5. You will see a signature verification error, select `Yes` to bypass the check

6. Reboot to system to enjoy your Magisk installation.

Caveats

1. Since it's not TWRP, you cannot decrypt your /data in recovery for now, which means no data backup or recovery, and you cannot install on-device flashable zips through this recovery.

2. Since it's not TWRP, it cannot prevent your OS from overwriting recovery automatically. If you use official ROM, you may need to manually re-flash the recovery every time. I'm not sure whether this can be bypassed with some Magisk module.

3. Don't expect to be able to flash anything into /system (e.g. OpenGAPPS) on stock ROMs; you might be able to do so once my LineageOS ROM is released

4. When trying to install OpenGAPPS on LineageOS 17.1 (not released yet as of 2020-03-06), it will get stuck at the end of the flashing process. This does not affect the functionality of the installed system and gapps, and a force-reboot into system will work just fine. Use my patched OpenGAPPS in the LineageOS thread.

5. You need to always click "Mount /system" before flashing any mods into the system (i.e. Magisk, OpenGapps, etc., ROMs themselves are not affected), otherwise they will fail to install. (Clicking the option does not actually mount /system; it just sets up necessary mappings from the super partition to each of the dynamic partitions so that the installation scripts will work)

Downloads

LineageOS Recovery (17.1, 2020-03-06): https://mega.nz/#!PZRCBaiA!L-c3Tn6E295xcAIZCSt9ribpGsutX3QJRt04uyQGg_k

Changelog: Improved compatibility with OpenGAPPS (won't work with MIUI; this change is solely for the soon-to-be-released LineageOS 17.1 port)

LineageOS Recovery (17.1, 2020-03-01): https://mega.nz/#!XI4BGDQS!CPH2kIUdqaTtU_Zdzx8bUiL7FcU-G51RwmdH0MGbSRk

vbmeta.img: https://mega.nz/#!vQohmJgJ!IWAjbxGIxxxQ4OScQH8YT8oKJMx8Q-2pV83zqxbItD4

Source Code

Device Tree (including LineageOS 17.1 port): https://github.com/PeterCxy/android_device_xiaomi_picasso

Kernel: https://github.com/PeterCxy/android_kernel_xiaomi_sm7250