Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion

There is no support for leds with mixed colors like rgb or there like.
So it is not possible to add this!

1 Like

Fixed in: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=ad19751edc21ae713bd95df6b93be64bd1e0c612

The patch I proposed for testing enables loader for all mt7621 devices and it turns out to break some other routers unaffected by this problem. That's why I want some testing before pushing it to master and now I've abandoned that patch.


So, there is no options to add led with 2 gpios?

booting normally with this build,, , run opkg update, opkg install luci-app-mwan3 but got satisfy_dependency_for error (different kernel).. . add --force-depends and the router can't boot.. . any solutions to install luci-app-mwan3 on non-latest snapshots? edited opkg sources but got same satisfy_x_x error.. .thanks a lot..

@981213 @acecilia @ave @juppin thanks all. sorry i'm not able to test the patch because i don't know what should i do ... i need step by step instruction for how to build images with patch included in it.

Here's my build of master from today including the patch that was merged into master by 981213. (157474811cdc34fda095c020d36dc13ca90c4c2fe1bbb33a377397b3e058af93)

Tested and works on my end, great work 981213. As always, has adblock, luci, https-dns-proxy (will drop in favor of dnscrypt later), wireguard-tools, kmod-wireguard, kmod-tun, kmod-sit.

Also @frosp, you need kmod-ipt-ipset. Here's a build of it, requires the openwrt build from this post.

Ps: My posts were apparently flagged as spam and my main host gets me a "You can't post links to that host" error. I have been using that host to have links not rot like they might on transfer.sh etc and to allow wgeting unlike things like mediafire, so uh... whoever did that, please don't? I don't have an obligation to post builds, I just do that so that others can the most out of their devices without having to build stuff.

Edit: Staff restored the posts and unbanned my host. Thank you! I've updated links in this post to my host too, so that they won't rot.


thank you so much , here is mirror link to your build :


sha256: 157474811cdc34fda095c020d36dc13ca90c4c2fe1bbb33a377397b3e058af93

MD5: 3b997f0439c26af41822d69425a74007

As for building, here's the official documents on how to do so:

I think you also need rsync installed.

Basically gets down to:

  • Get a debian-based linux environment (can be your linux setup, can be a VM, can be an LXC container. I use an debian buster LXC container as my host is arch)
  • Install required packages
  • Switch to a non-root account
  • Clone repo with git
  • Run ./scripts/feeds update -a and ./scripts/feeds install -a.
  • Configure it with make menuconfig, this is how 4AGbE looks, pick the packages you want, I recommend setting them to *, not M. M generates them as ipks that you separately need to install (this is what I did to build kmod-ipt-ipset for frosp above). When you're done, hit Save, save as .config.
  • Start compilation with make.
  • After a couple hours, the bin file will be in /bin/targets/ramips/mt7621/.

Great news. So it is safe to upgrade from older snapshot?

1 Like

As far as I can see yes, but please keep in mind what I said about having to reset (aka uncheck "keep settings" on luci flash screen) and reconfigure here:


thanks @ave i flashed your image but i don't have access to internet with your build here is serial cosole log:

[   96.701610] mt7530 mdio-bus:1f wan: Link is Down
[   99.793555] mt7530 mdio-bus:1f wan: Link is Up - 100Mbps/Full - flow control off
[  100.797586] mt7530 mdio-bus:1f wan: Link is Down
[  104.913556] mt7530 mdio-bus:1f wan: Link is Up - 100Mbps/Full - flow control off
[  105.917584] mt7530 mdio-bus:1f wan: Link is Down
[  112.081561] mt7530 mdio-bus:1f wan: Link is Up - 100Mbps/Full - flow control off
[  113.085577] mt7530 mdio-bus:1f wan: Link is Down
[  117.201581] mt7530 mdio-bus:1f wan: Link is Up - 100Mbps/Full - flow control off
[  118.205649] mt7530 mdio-bus:1f wan: Link is Down

edit: also have same problem with latest snapshot (Wed Apr 15 16:57:41 2020)

In the network section the switch tab is missing and when you trying to change to 172.28.10.* you cant login to luci.

1 Like

In the network section the switch tab is missing

Well, can repro. swconfig list is empty too. I'm not sure if this is a thing on my end or on upstream tho, but I can't see any packages that'd help to include which'd solve this issue. This is an open bug on OpenWRT when running Kernel 5.4 on R3/R3v2/R4A.

Only culprit I can think of is this DTS change which was supposed to introduce a switch, https://github.com/openwrt/openwrt/commit/30644bc579e771e4b6dcc165ca966124e0259e1e#diff-a0859b8f2d604a5ea50a3e976bfb51de

Also, @Zorro, did you upgrade from a version before this commit while keeping your settings? If so, you're likely having the same issue I mentioned here, I personally fixed that by resetting and reconfiguring my device (both from inside luci), but there might be a less nuclear path you might be able to take.

172.28.10.* you cant login to luci.

I can't repro this, I personally use without issues.

1 Like

Hi all,

Not sure somebody sent pictures of r0202.
Here's mine.

May I follow this procedure ?


I can´t DM you here, but I´d need that rom, nothing works on R3Gv2, and I can confirm that it´s not working because of the rom since I saw the error through serial:

1 Like

this is what you are looking for found it on neighbor forum:


this .bin file is for mir3g v2 firmware version (2.28.8)

but i'm not sure if it is possible to flash it.

also maybe you need this usefull tool (R3GV2+PATCHES for windows x64)

I think you need above tool for flashing it.


also here is firmware ver 2.28.132 with english UI for mi router 4a gigabit :


above image is tested by me on 4a gigabit edition and it worked !!


  1. before running any configuration scripts==>you need to access the router,to do this,run 0.start_main.bat and enter the password of your router wait for the script to execute. the answer should be like this :
start uploading config file ...
run telnet+ ftpd...
press any key to continue...

the result of the script will be running telnet and ftp servers on the router until it reboots.
2)0.start_read_uboot.bat and 0.start_open_uboot.bat:
shows you the status of the bootdelay and uart_en variables.
0.start_open_uboot.bat==>it changes bootdelay=5 and uart_en=1
this allow you to use the bootloader and using the console in the stock firmware.
and help you to restore the router without a programmer if the OS did not boot

  1. 1.start_create_backup.bat - just creates a full backup of the current firmware. As a result of the work, the backup.bin file should appear in the data directory..

4)2.start_write_uboot_R4AGE.bat - THE MOST DANGEROUS SCRIPT to run it is necessary only for the owners of R3Gv2 . Owners of R4GE do not need to do this, you have it exactly the same, and the Chinese have firmware for recovery only for R4AGE. Unlike other flashing scripts, this one does not restart the router automatically.
Replacing the bootloader allows you to restore the router even if there was a jamb in the main firmware, as happened when switching to the 5.4 kernel from openwrt.
The process takes about 7 minutes. the router does not automatically restart, a sign of the end will be change of the yellow LED to blue.

  1. 4.start_add_english.bat - the script turns the Chinese UI into English.(Tested on mi4a gigabit on firmware 2.28.62 and it worked)

  2. 5.start_write_OS1.bat - a script for changing the main firmware (the bootloader and special zones are not overwritten). The script takes the sysupgrade.bin file in the data directory and flashes it into the router. After the flash, the router will reboot.

Caution : use at your own risk .

1 Like

I uploaded today's snapshot to the repo https://github.com/acecilia/OpenWRTInvasion, which is suppose to work and contains the patch described here. I also updated the readme.

Apparently, today's snapshot boots, but has internet problems, as described here. I will add a comment on the readme about it.

As soon as there is a fully working snapshot I will upload it to the repo again.


is this (2.28.132) official?
can't we just upload the file via admin panel?

@Zorro posted that files and info from 4pda that I found. You can try to use links he provided.

Also, those .bin files does not contain header so if you trying to use builtin recovery they will not work (but that is only my opinion).
I have added the header form r4ag to that dump and modded model to r3gv2. The 28.8 file dump look almost the same as r4ag official miwifi_r4a_firmware_72d65_2.28.62.bin (just short on header and some differences at the end of file). Try to upload this by recovery: http://radek.piastlan.net/openwrt/r3gv2_firmware_72d65_2.28.62.bin

1 Like

Hi @Jeffpeng

You did anything special to flash the R4AC with firmware 2.18.58. I flashed the Gigabit Edition R4A without issues but the R4AC never seem to come trough. Tried already different openwrt firmwares but none of them seems to work fine. Can't ssh into it, can't get an ip. Had to unbrick it several times already.

Happy to hear your experiences.