[Xiaomi Redmi 5A Questions & Answers] edizz0:
Well, I will be straightforward... I'm probably pretty much f**ked.

I have a Xiaomi Redmi 5A which was never tampered with, ever. It had Android Oreo 8.1, MUIU 10, never rooted, never unlocked. It was my wife's. She bought a new phone and now I wanted to use this Redmi 5A.

So I intended to flash a custom ROM on it. I did my research and picked Ancient OS for the custom ROM (https://xdaforums.com/t/rom-10-0-0_r39-official-ancientrom-civilization.4113993/).

I started all the work. First, unlock bootloader. I used MIFlash unlock provided by Xiaomi itself. Followed all the steps and unlocked the bootloader. After this it was time to flash a custom recovery. I chose TWRP. Tried to use their own TWRP riva image (twrp-3.5.0_9-0-riva.img) but it didn't worked. Whenever I flashed, after rebooting, the stock recovery would overwrite TWRP. This was supposedly because this version of TWRP was based on Nougat and my phone was on Oreo, so I searched a bit more and found a guy who has modified TWRP to work with Oreo. I flash his version and flashed lazyflasher afterwards et voilà! The TWRP installed correctly and was no long overwritten by stock recovery.

After this I made a FULL backup of the stock ROM using TWRP (System, Cust Vendor, Data, Boot, Bootloader, EFS, Persist, Logo) and stored the backup on my computer.

Then I proceed to flash the Ancient OS ROM. First I went to wipe on TWRP > format data > yes. After this I went to wipe again > advanced and selected to wipe Dalvik, Data, System, Cust Vendor, Cache. And finally then, to install and flash the ROM. Things were a bit weird here because when I tried to flash TWRP threw Error 7 which is related to a script protection to determine if the ROM is compatible to your phone. The thing is... the ROM was compatible. I checked the "updater-script" inside the ROM file the code lines to check for the device were correct, it displayed riva as the model, which is my phone. One of the solutions to Error 7 was to eliminate these lines from the script, which I did and so I was able to flash the ROM. Everything went well and reboot to system.

System boot up, splash screen, main screen. All were good. Device timed-out and the screen locked. After the screen lock the only thing appearing were bizarre vertical red lines. Phone was still responsive, but screen was not being rendered properly. Forced reboot, splash screen... and main screen again, all normal. Tested to lock to notice the screen error again, and there it was: red lines just after I locked. Rebooted once again... only this time I went stuck on bootloop (on logo). Decided to boot to recovery to restore things, but, for my astonishment TWRP didn't started. The TWRP logo appeared as if it was loading, but nothing happened and if I leave it like this for some minutes, it just reboots to recovery once again but without TWRP being able to initialize and keept stuck on this reboot to recovery loop.

I don't have the slightest idea how can the recovery be affected by a ROM flash, seriously... I never saw this. It is a completely different partition. Worst of all, everything on TWRP was working before flashing the Ancient OS ROM.

I have no idead what to do. Can't enter system, can't access TWRP and can't use fastboot (most likely because USB debugging was disabled after OS was flashed). If some one can shed some light... it would be truly appreciated.