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

Hi hoddy,

Thanks for the informations.
I posted the bootlogs on Post #309 and Post #484.

I've tried many builds but seems that are not working, anyway I will check again the version posted by zorro that you mention.



the version posted by rusek666 boots correctly, still not understanding why other versions are not booting.

Thanks! I got it up and running again.

1 Like

I will say I used a different method to you, I used the Invasion method to upload the firmware, not sure if this could effect the installation method?

Maybe it is, from the instructions, I see that the firmware is flashed into OS1, that i can't see on openwrt running firmware and the command fails.

Eventually i'll check.


1 Like

Thanks for answering :slight_smile: I cant test at the moment, but I think there should be some people here eager to try.

EDIT: as currently the firmware is broken, why not apply the path on master? This way it will be easier to test, because people could use the next snapshot build (compiling openwrt is not trivial IMHO)


I just finished building and flashing master with your patch included-- I had to reset then reconfigure the router as the RJ45 ports weren't working (including WAN) when I upgraded with configurations intact.

All I can say is "so far so good", it works:

Here's my build of it (SHA256: 26a34f1db3a84e9122f326813f3fb8cae54b4411483f01230bf34d5427451e8c), though again, while it works for me I'm not exactly sure that I'm doing everything right. I tested Wireguard on this and it does work except for IPv6, though I'm not sure if that's a problem on my end or not.


Can someone make changes to src? Our device have 3 LED instead of 2. They are blue status, orange status and blue+orange, let's say purple. And there are 2 LEDs that we don't have. Let's say in summary: add blue+orange led and delete unused mt76-phy leds

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