Saturday, September 30, 2017

Step-by-Step: OpenWRT/LEDE Base Installation for Xiaomi MiWiFi 3GR

The Xiaomi 3G router has a low price and spacious ROM (128MB) and RAM (256MB) for easily supporting most of the packages and loads a person would put on a OpenWRT/LEDE installation.  Thanks to some recent hard work by the LEDE community it’s fairly straight-forward to replace the Stock OEM firmware with LEDE.

NOTE: Development for the Xiaomi 3G is currently considered in BETA and should only be done by people who are content to support themselves and deal with bugs.  Having said that, I've found the most recent ROMs (March 2018) to be good enough for day-to-day use.


A. A computer with a web browser for downloading the files, registering a Xiaomi account, and capable of running SSH.
B. The OpenWRT Installation Files from |
C. A Xiaomi Account for registering the router |
D.  The Developer edition of the wifi ROM from Xiaomi |
  • Click the ROM graphic, scroll down to find “ROM for R3G 开发版”
E. A mobile device with Xiaomi’s router app installed | Google Play Link | Xiaomi APK
F. The customized SSH BIN file from Xiaomi.  This file can only be downloaded after registering the router with the Router app on your phone or tablet and it’s unique to each router since the ROOT password is apparently baked into it | Xiaomi SSH Site
G. A physical Ethernet connection to the router’s LAN ports (white colored).  Note: You can do most of the process on Wifi, but not all of it, so I recommend starting with Ethernet to simplify the process.
H. A USB drive formatted to FAT32 for installing the SSH BIN and LEDE BIN files to the router.


1. Unbox the router (if it’s new), connect the WAN uplink (blue port) to the Internet, power it on, connect your computer to one of it’s ethernet ports with a computer (white port), open a browser and go to, follow the onscreen router setup wizard (all in Chinese, but just use the same password for Admin and Wifi and you’ll be fine).
2. Download the "Developer" ROM from Xiaomi, if you haven’t already (see pre-reqs).
3. Manually flash the Developer ROM through the web app console.  Select the 3rd tab option, select the last menu item, and click the first command button to upload the file, click the right-hand button to confirm the installation of the new ROM. (It’s all in Chinese, so I’m trying to be helpful here, not condecending :-)
4. Install the Mi Wifi app on a mobile device
5. Connect your mobile device to the Wifi router's network
6. Sign into the app with your "Mi" account (or create one and then sign in, no personal information is needed other than an email account).
7. Sign into the Wifi Router through the app using the admin password you set during setup.  The router should now be registered to your Xiaomi account, our “Bound” as Google Translate says.
8. Download the the SSH BIN patch file at It's supposed to be custom for your router, so I'm imagining it's because the BIN files needs your router's root password baked in.
<insert screenshot>
9. While you're at this site, also copy down the "root" password from the page; you’ll need it for SSH later.
<insert screenshot>
10. Copy the miwifi_ssh.bin file from your computer to a USB drive formatted with FAT32.
11. Insert this USB drive into the USB port on the back of the Xiaomi router
12. Unplug the router's power cable.
13. Use a tool (like a straightened paperclip) to press down the reset button on the back of the router and hold it in.  While keeping the button pressed down, reconnect the power cable...not a task for the manually challenged. The yellow status light will come on the front of the router. After about 10 seconds, the yellow status light will begin to blink indicating that the router is now installing the SSH BIN file.  Now that the yellow light is flashing, you can finally release the reset button.

14. After the SSH file is installed, the router will reboot and the yellow light will become steady again during the boot process.  After the router is done booting, the status LED will turn a steady "blue" color.
15. Sign into the router using a ssh command from your computer and enter the enter the root password from the Xiaomi website
e.g. ssh root@
<insert screenshot>
You're in! Enjoy your new super powers wisely
16. Download the following LEDE BIN files from the SNAPSHOT tree | Download Page
17. Copy these two files to your USB drive and insert the USB drive back into the router.
18.  Within the SSH console, use these commands to flash the files:

cd /extdisks/sda1 (can be different if you remove and reinsert the usb stick)
mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
nvram set flag_last_success=1
nvram commit

     The router will reboot, and congratulations! You're now running LEDE SNAPSHOT. You'll need to SSH back in and install uHTTPd and Luci to get into the web app again (No web console out of the box with SNAPSHOT) and you'll also need to reconfigure Wifi since it's disabled by default in the Snapshot images.  Here's some tips to install those core apps if you're not familiar:

ssh root@
opkg update
opkg install uhttpd luci luci-app-uhttpd


Flash the TAR file from the Snapshot Repository (instead of a BIN file)
  • mir3g-squashfs-sysupgrade.tar

Xiaomi SSH Website After Registering Your Device in the App

Xiaomi_AAAA(小米路由器3增强版)root密码 xxxxxxxx下载工具包

等待3-5秒后安装完成之后,小米路由器会自动重启,之后您就可以尽情折腾啦 :)

Google Translate of Website

Has been bundled with a millet router
Xiaomi_AAAA (millet router 3 enhanced version) root password xxxxxx download kit
Toolkit to use: millet router to be upgraded to the development version of 0.5.28 and above, millet router mini to be upgraded to the development version of 0.3.84 and above, millet router 3 is about to support. Note: Steady version does not support.

Please download the toolkit bin file to U disk (FAT / FAT32 format) root directory, to ensure that the file name miwifi_ssh.bin;
Disconnect the power supply millet router, the U disk into the USB interface;
Hold down the reset button and then re-access the power, the indicator light to yellow flashing state can release the reset button;
Wait 3-5 seconds after the installation is complete, millet router will automatically restart, then you can enjoy tossing :)


This is how I got LEDE installed. Some of the steps can be done differently. I used this for inspiration
Unbox router
Connect to the router using WiFi
Go through the wizard to set passwords for the router + wifi
Reconnect to the router using WiFi
Logon and find the page where you can upgrade the firmware look for a big yellow dot with an “i” inside. You will see the version number of the router and there is a button below where you can browse for a file. Flash miwifi_r3g_firmware_c2175_2.25.122.bin (developer firmware) and wait a few minutes.
Download to your phone/tablet (there is also an iOS app)
Open “Mi Wi-Fi” app (and sign-up) and sign-in to your account. Router will be detected and added to your account (assuming you are connected to the WiFi on the router and the routers WAN port is connected to Internet).
On a PC, visit and sign-in to you account. You will get to a page that should display your router, the root password and a download button. Hit the button to get miwifi_ssh.bin
Format USB drive using FAT32 and copy miwifi_ssh.bin, lede-ramips-mt7621-mir3g-squashfs-kernel1.bin and lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin to the USB drive
Cut the power the router, put the USB drive in the router, press and hold “reset” button (with a paper-clip), power on the router (while holding reset). When the router starts flashing yellow release the reset button. Wait until router has rebooted and you should (finally…) have SSH access.
Login to the router using SSH using the “root” as username and the (root) “password” from
In SSH console
cd /extdisks/sda1 (can be different if you remove and reinsert the usb stick)
mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
nvram set flag_last_success=1
nvram commit
LEDE should be installed and available at (with WiFi disabled I assume)
Upgrading to a newer snapshot can be done using the regular methods (from the command-line using sysupgrade or through LuCI) using lede-ramips-mt7621-mir3g-squashfs-sysupgrade.tar
Thanks @dissent1 for adding the router to LEDE. Both WiFi radios seems to work (2.4Ghz on 20Mhz, 5Ghz on 80MHz) and I have also tested USB3 port with success. I have not tested 40MHz for 2.4Ghz as it does not make sense for me (very crowded WiFi). 5Ghz radio does not seem to like DFS channels (I get “DFS start_dfs_cac() failed, -1” in the log). The channels seems to work nicely when disabling DFS (by removing the requirement from regdb.txt for the selected country before building firmware) so this is likely “just” a DFS issue.
I can’t say anything about stability yet. I’ll probably try to replace my TP-Link Archer C5 with the Xiaomi router within the next week and then I will have to see how well it performs and how stable it is.

UPDATED on March 3, 2018 to include links to the OpenWRT repositories since the two projects have merged.