I recently installed Cyanogen mod 14.1(7.1.1) on Mi5(gemini) and now I want to go back to MIUI (preferably MIUI global developer rom) and lock the bootloader. I have to tried to flash using the existing TWRP and also using the inbuilt fastboot mode, but was not successful. I can neither find a proper flashing guide nor the proper files required to flash. Is there something I am missing?
If you have backed up previous MIUI ROM(nandroid) using TWRP, you can restore MIUI by locating the backup file. Also, you can restore user apps from nandroid backup using Titanium backup.(Titanium backup pro have option to restore apps from nandroid backup).
If you don't have nandroid backup, then you need to reinstall MIUI. Download MIUI ROM from http://en.miui.com/download.html. And have a factory reset, to lock bootloader and remove root and replace stock recovery.
If you haven't saved a backup with TWRP you have to reinstall the MIUI.
First of all download the ROM here.
Then put the ROM in a USB drive or SD card (it has to be read from the smartphone outside its own disk).
Then, install the ROM.
You can follow these steps from How to Flash a New ROM to Your Android Phone
But if you have a saved backup with TWRP, go to restore and select your backup.