How I flashed my MiPad 4 to LineageOS1.7
Disclaimer: I'll not be responsible if my steps below got your MiPad 4 bricked.
Things you need, for those programs, u can use the name & download online:
Start below only you have prep all the above.
Unlock Bootloader on your MiPad4
1. Run miflash_unlock.exe from miflash_unlock-en-4.5.514.47, follow the instructions to unlock your MiPad4 bootloader, you need your Mi Account.
Booting into TWRP Recovery
1. Enter Developer Options and enable USB debugging
2. Connect MP4 to your PC/laptop
3. Power off your MP4
4. Press & hold volume down + power button on your MP4, release when you see the Mi logo, you should enter Fastboot.
5. On your PC/laptop, open CMD in the folder where you extract the ADB-Fasboot-And-Driver-v1.4.3
6. In the command, type
fastboot devices, you should be able to see your MP4 serial number listed.
7. Then type
fastboot flash recovery.img
8. After finish, type
fastboot boot recovery.img, this will reboot your MP4 into the TWRP Recovery main menu.
Nandroid Backup
1. You can follow the below link to perform a backup in TWRP, i did it anyway
https://android.gadgethacks.com/how-to/twrp-101-make-nandroid-backup-restore-your-entire-phone-0175300/
Flashing the new OS Ref:
http://theupgradeguide.com/2019/07/28/install-android-9-0-pie-on-xiaomi-mi-pad-4-lineageos-16-how-to-guide/
1. Still in TWRP, go to Wipe > Advanced Wipe > Select Cache, Dalvik/Art Cache, System, and Data. Then Swipe to Wipe.
2. Then go back to TWRP main menu.
3. Select Install, locate the LineageOS1.7 ROM zip file and Swipe to Confirm Flash.
4. Do the same for the GApp zip file.
5. After Gapps flashing completes, Select Wipe cache/dalvik from the bottom left side of the screen, Swipe to wipe.
6. After wipe completes, Click on Reboot System.
* In case, you have a problem with mounting your internal storage or your storage shows 0MB like what I encountered, you can refer to the below link. Then I did some adb commands to copy the ROM and GApp back into internal storage.
https://appuals.com/how-to-fix-twrp-unable-to-mount-storage-internal-storage-0mb/
Good Luck!