New fixes feedback - Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit)

Hi peeps,

So rather than looking through a thousand page topic, i've started this thread to get some feedback from owners or devs on my recent updates, fixes to this device.

Im not trying to taking any credit from the original thread - Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion

Just getting to the bottom of the recent boot failures people and myself had experienced with this device.

My gitlab repo for the source code if you wish to fork or build:

  • Issue i had faced where - Squashfs data corruption

From my testing and eventual fix, it appears lzma-loader is not needed and there is no u-boot limit on this device (from my first initial discover, i thought it was the case).

The fix is very straight forward, but needs testing and feedback. turned out to be the block size and image size was set wrong.

As there where no official patch for this device, only based on the work of the similiar device 3Gv2, the two settings don't quite fit for this device.

Feedback would be gratefully appreciated!


Nice. Can you provide direct link to a build so that
it's easy for other people having the issue (note: I'm no affected) can see if it fixes for them?

Also, I didn't quite understand what are the changes that implement that fix. Can you point me to the commit?

1 Like

This is the original fix on my dev branch

I believe that default block size is 256k, so its possible on this device was creating out of bound r/w block issues, the image size being smaller reduced area to breath.

Like i say, need feedback. - pre built image to test



Nice! I will attempt an upgrade tonight and post my results.

@db260179 Seamless upgrade from 17.07.3 no issues at all as far as I can tell. No errors in logs, Wifi working as expected and GIG LAN also perfect. I'll continue to monitor for a few days but all looks good from here! Would you like me to test installing from the exploit at some point, or do you think the outcome should be the same?


1 Like

@hoddy Thanks for the feedback. So I have a few more patches to add to my master branch as a test image:

So i have discovered a nasty squashfs filesystem bug that corrupts the image when being built. Explains why i was getting a SQUASHFS corruption.

Also from testing, the network pausing of traffic issue occurs from using iperf3.

So I you could do the factory reset (using oem firmware), then follow Then feedback.

Let me know on stability overtime. I will upload a snapshot version with the above fixes for further testing, if stable then can apply to my stable branch

Hi @db260179

Thanks for taking care of this issue. :slight_smile:

I don't have the device anymore, so I can't test your patches. In any case, I would like to kindly ask you to submit them upstream once they are ready.


Yep will create an upstream patch once people have tested this.

@hoddy @araujorm New updated pre stable release v1.1-pre - updated the switch code to turn off flow control on all ports and not force 1gb speed

My iperf3 tests show around 750mbps to 980mbps depending on load in HW offloading mode, need to test vlan support in HW offloading mode

1 Like

Hey, looking very good.

Unfortunately I'm out of time to try it now, and I can't really take my router offline and experiment with it easily without having a riot in my house, but in due time some of these ideas may be useful to improve support on other (older) mediatek devices I have lying around :slight_smile:

Would be great if the people that were having trouble with the squashfs flashing would test it though. I never had those issues so I doubt my tests would be conclusive...

Great, updated!
Iperf3 -t 60
No offloading: 639mbps
Software flow offloading: 731mbps
Hardware flow offloading: 681mbps
If this helps, results for all 3 were quite spread but I didnt see much over 750, perhaps something is wrong with my setup i will try to diagnose when I can.

1 Like

Hello I am using the firmware since the morning and I feel that its working without issues till now my router, and sqm qos that I was needed works fine. now I am getting security certificate issue when logging and I feel that is loaded with unnecessary plugins for a lot of people and needs only basic things like adblock and qos in my opinion. Now I will flash the updated version and report back. but I saw its only firewall update. Nice find Hoddy!!! ps: I am not a Dev just fixing my miserable router based on xiaomi crap firmware. Thank you David for your time spending..

Thanks for the feedback. Did you have issues with the previous images from the other thread?

Ive added programs I use, once this is tested more will reduce the packages to just the basics.

The security issue is because luci-ssl generates its own certificate, you should be logging into your router via https and not http (plain text can see passwords if someone is sniffing), reason for this.

Let me know of any performance issues or weird problems.

1 Like

Yes I used before araujorm's firmware but was having issue with the kernel and couldn't install sqm qos cause of incompatibility. so I installed this one.