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

Hello good people.

I've cloned openwrt and mt76 repos on github and made some attempts to backport all the fixes that seemed relevant for the mt76 driver to the 19.07 branch.

Then backported the Mi 4AG support to the openwrt-19-07 branch, similar to what @Byte and @Zorro did.

OpenWRT repo with that branch is available here:

MT76 with backported fixes (called by the build system when building from the above OpenWRT branch):

Build I made yesterday available here, along with my .config file should anyone prefer to make their own builds:

May be placebo effect, but this build seems to me better than previous 19.07 attempts. But use at your own risk (should you brick your router, use a flasher to recover it as described in the first posts, it's all there).

Hope it's useful to some one. Feedback is welcome, and other people that made their forks please feel free to take any ideas from here at will :slight_smile:

6 Likes

I've got a feeling that's an error with the latest version of OpenWrt from memory (excuse my pun), I might be wrong. Are you using a modified version of 19.07 like the one by Byte or Araujorm?

Good work! I'll give it a test in the next few days and let you know how I get on.

But we aren't running any ath10k hw on our mediatek based devices. There are a lot mt76 dual radio devices that runs fine with 128 mb ram.

3 Likes

The latest version is very stable and the WiFi i think it a bit faster !! Thank you very much for the latest build! :slight_smile:

Just a heads up.

I've updated the assets on the release. At first there was only one bin image, compiled with the "optimize for size" option. Now I've added another one, compiled with the "optimize for performance" option, which it's an extra 200 Kb but may be worth it (not really sure, any feedback is welcome).

I've renamed the old one to openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade-optimize_for_size.bin, and the new one is called openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade-optimize_for_performance.bin, and the config files as well.

5 Likes

Excuse me, could anyone give me a hand?
Im a user from china and i know little about IT, so its a bit hard for me to look for the instruction.
What i want to ask it that after i typed in the IP address and the stok, it shows these in the cmd:
Traceback (most recent call last):
File "remote_command_execution_vulnerability.py", line 42, in (module)
template = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence
Could you plz tell me what happened to the program?

What OS are you trying to run the expolit from?

Thanks for your reply!
im running remote_command_execution_vulnerability.py on windows
Following the instruction i found on the internet, i have installed Python3.8.4 and its pycryptodome and requests module. Did I missed anything?

1 Like

Yeah to be honest it really dosent run well on Windows, i'd suggest running it on linux possibly in a VM. I made a couple of videos that might help you:
How to setup Ubuntu as a VM (in windows): https://youtu.be/85Rm7Khitdw
How to run the exploit: https://youtu.be/VxzEvdDWU_s

thank you!
ill learn and have a try.

1 Like

Both images does not support pppoe protocol in network/interfaces.
The strange thing is that the package luci-proto is installed...

Try the following via SSH:

opkg update
opkg install luci-proto-ppp ppp ppp-mod-pppoe
sync
reboot

If on the other hand you just can't connect to the Internet without having had that installed previously, and feel these packages are crucial, I guess I can include them in the image and make a new build. Please tell me if so.

The packages I included are the ones I always use and can't live without, or ones I knew that wouldn't work with opkg because of specific kernel dependencies (like wireguard, openvpn with mbed-tls, kmod-ppp*, etc.) but should there be any more packages anyone else think are really essential feel free to suggest and I may post a new build on github (within reasonability, of course, since most are just installable with opkg).

Remember you can always build your own image from that source code. The config files I put along the release files are the ones for me, but you can always use them as base for your own builds.

Hi,
It’s like The seventh time that I try to flash OpenWRT on my Mi Router 4A Gigabit Version but trying to flash it, after the command mtd -e OS1 -r write firmware.bin OS1 ,I stuck to the power light orange for like 30 minutes and I have to follow the unbrick guide.
Any advice?

Does it happen with @Byte and @Zorro builds too? Or my builds?

hi, i have same router can you give me guide how to install openwrt on it please?

I tried with your build (optimized for performance), the @Byte build and the “official” build (https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin). All three after rebooting stuck with orange light for like 30 minutes.

i have the same problem with my R4AG, the pcb is indicated with R0101

@araujorm optimize_for_performance.bin build worked for me, the two others didn't work

1 Like

I tried three times with the optimize_for_performance.bin. Still don't work :frowning: