Hi everyone. Thank you for taking your time to help me. I manage to flash the official firmware 1.0.17 to the partition and recover the router. To summarie the problem for anyone who faces the same ploblem as me, I flashed the customised kernel and firmware to partition /dev/mtd12 using command:
ubiformat /dev/mtd12 -f /tmp/flashed-img.bin -s 2048 -O 2048
nvram set flag_ota_reboot=1
nvram commit
reboot
I didn't touced the bootloader. I use the tools available in the xiaomi website for recovering:
The website to download this tools with normal browser doesn't work. Please used VM with incognito tab to open the link. I used VM Ubuntu 18.0.4 and firefox.
and followed the instruction in the link below:
Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion
For Developers
well, if you have R4AC global version story is different . try this method :
1-download MIWIFIRepairTool from xiaomi:
http://bigota.miwifi.com/xiaoqiang/tools/MIWIFIRepairTool.x86.zip
2-download chinese firmware 2.18.28:
https://anonfile.com/h414S108o6/miwifi_r4ac_all_c4b35_2.18.28_rar
3-set static ip to your computer
[2020-05-19 01_11_45-Internet Protocol Version 4 (TCP_IPv4) Properties]
4-Run MIWIFIRepairTool.x86.exe
[2020-05-19 01_05_12-СÃ×·ÓÉÆ÷ÐÞ¸´¹¤¾ß]
[2020-05-19 01_06_56-Settin…
The main different between is when you pressed the reset button after rebooting, the red light have to blink multiple times twice, i repeat, "multiple times twice" before you can release the button, then the MIWIFIrepairtool should start sending the firmware.
Also allow access to your local server, when promted the first time you open the xiaomi router recovery software. This was the problem, why it didn't work the first time I used it.