I was just flashed my old Xiaomi nano routers with OpenWRT.
Here my short summary how to do it / how i did it:
(Use this summary at your own risk)
Make sure your standard Wifi or LAN ist not using 192.168.31.* as IP-range.
Download the Official Developer ROM.
Install the official developer Rom.
Reset the router. (the reset button is located in one of the ventelation holes on the button of the device. Use a SIM-Tool to press it for a few seconds)
Connect device to your PC (white LAN-Port) and the internet (blue WAN Port).
Setup the router using the same Password for Wifi and UI. You will change it in a few minutes anyway.
Find out your <STOK>
. You will see it in the adressbar if you log in the routers UI.
http://192.168.31.1/cgi-bin/luci/;stok=
<STOK>
/web/init..
.
Modify this command with your <STOK>
http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/xqnetwork/set_wifi_ap?ssid=whatever&encryption=NONE&enctype=NONE&channel=1%3B%2Fusr%2Fsbin%2Ftelnetd
Paste it in your browser.
An message will show up
"msg":"未能連線到指定Wi-Fi(Probe timeout)","code":1616
Modify the following URL with your <STOK>
and passwords. I used the Wifi/UI Password as <CURRENTPASS>
and <NEWPASS>
http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/xqsystem/set_name_password?oldPwd=<CURRENTPASS>&newPwd=<NEWPASS>
Paste the modified URL in your Browser.
This message will show up:
{"code":0}
Use Putty to Telnet into your router using ip: 192.168.31.1
User: root
Password: <NEWPASS>
Navigate to /tmp
cd /tmp
Download OpenWRT using curl in insecure mode (the wget-version on the router does not support https). I used the OpenWRT 19.07.07 image.
curl --insecure https://downloads.openwrt.org/releases/19.07.7/targets/ramips/mt76x8/openwrt-19.07.7-ramips-mt76x8-miwifi-nano-squashfs-sysupgrade.bin --output openwrt-19.07.7-ramips-mt76x8-miwifi-nano-squashfs-sysupgrade.bin
Install the firmware:
mtd -r write /tmp/openwrt-19.07.7-ramips-mt76x8-miwifi-nano-squashfs-sysupgrade.bin firmware
Wait some time.
Done