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

I have encountered two bugs with the 4 Jan snapshot using the old kernel:

  1. Clients on the LAN couldn't ping or ssh into each other, dropped packages. They could connect to the router.
  2. DHCP doesn't seem to work on the second LAN ethernet port. If I specify an IP manually, it's fine.

Gingernut, both of these bugs are gone with your image using the same configs, thank you!
[deleted] EDIT: Nevermind, the problem turned out to be lingering routes on my PC from a VPN connection. Sorry for jumping the gun.

I have problems flashing the openwrt bin .Serial connection only works over putty. I´m on windows 10.

Can someone explain how I can flash with windows 10 over tftp server.
SPI flash part already done thanks to rogerpueyo and johnny881386 :slight_smile:

Or would it be easier with ubuntu?

I have used Windows without problem and Putty to show output of what's going on.

Ethernet cable to lan port of router and PC with IP 192.168.31.100
Download tftpd32
Rename the openwrt sysupgrade.bin to 123.bin and place it in tftpd32 folder
Start tftpd32, give firewall permission and on tftp server tab at the top select your ethernet interface
Stop router boot process, press 2 once while booting, it will ask for flash overwrite confirmation
It will go through an IP address and .bin name confirmation in three steps
It should start the .bin transfer process

As I didn't really test factory firmware much and also wanted to do some digging I was trying to return to stock using the tftp process but my R3Gv2 wouldn't boot with R4AG stock firmware, magic number mismatch or something, and just bootlooped

Has anyone been able to return to stock?

It seems factory R3GV2 firmware isn't available at http://www.miwifi.com/miwifi_download.html.

With these tips I managed to flash the device.
It works great.

I have not found any bugs so far.

Big thanks to you and the community :slight_smile:

1 Like

You don´t have the original dump of your SPI flash?

Probably i can split the firmware image out with dd if you want...

Boot log of original firmware give me this mtd partition layout:

[    2.280000] 0x000000000000-0x000001000000 : "ALL"
[    2.280000] 0x000000000000-0x000000030000 : "Bootloader"
[    2.280000] 0x000000030000-0x000000040000 : "Config"
[    2.280000] 0x000000040000-0x000000050000 : "Bdata"
[    2.280000] 0x000000050000-0x000000060000 : "Factory"
[    2.290000] 0x000000060000-0x000000070000 : "crash"
[    2.290000] 0x000000070000-0x000000080000 : "cfg_bak"
[    2.290000] 0x000000080000-0x000000180000 : "overlay"
[    2.290000] 0x000000180000-0x000000e80000 : "OS1"

i think you only need the last partition?

Here you go:
This is my not booted stock firmware partition from MIR3GV2 (called OS1 on stock) and should be flashable through tftp flash...
Extracted it with: dd if=mtd_full.bin of=firmware.bin bs=1k skip=1536

1 Like

Thank you.

I'll test when I get the chance and report back.

Any updates on uboot mod with correct partitions table?

Unfortunately no - my uart port broke in my test router so i suspended my work.

Hello Gingernut,
How did you resolved the switch problem?
I have tried to add new MIR4AG target to 19.07 and compiled, everthing looked good after upgrade from MIR3gV2 firmware, except the switch. There was that mischmasch error you were posting...I have also used the layout from [rogerpueyo] :

xiaomi,mir4ag)
		ucidef_add_switch "switch0" \
			"2:lan:2" "3:lan:1" "4:wan" "6@eth0" ;;

even tried

xiaomi,mir4a-gigabit)
		ucidef_add_switch "switch0" \
			"2:lan:2" "3:lan:1" "4:wan" "6t@eth0";;

but got the same error always.

thanx and regards
Jan

1 Like

v2.28.132 stock firmware? mi routher 4A giga version
hello i bought this version, i have installed china rom the device is not working healthy. global software send rom file?

1 Like

Hello Roger,
Tried to make new MIR4AG target for 19.07, but still have problems with switch.
Have used your board layout - "2:lan:2" "3:lan:1" "4:wan" "6@eth0".

But got the entry to menuconfig:

And name...

...but switch is still a problem.
....and i can upload only one image...

I HAVE NOTICED you were here talking about portmaping...could you kick me little more in the right direction?
Thanks
Jan

Just use latest openwrt git master branch as support was offically merged.

Both routers are exactly the same hardware wise.

Hello,
I know, thats where I have started from (when I was younger, they called it "trunk" or "bleeding edge":-]) but I wanted something more stable, thats why I'm tickeling 19.07, and also I would like to have proper model of the device in the management interface, not 3Gv2:-].

2 Likes

Check your board layout again and make sure you don't have any format errors, I remember I missed something and that was giving me the switch mismatch error and switch0 setup wasn't getting created.

What is wrong with the original uboot? It knows where the env partition is and from where to load the kernel.

1 Like

Thanks for a tip - network layout is simple copied from 3gv2 master, which is working on master...
Switch is configured in /etc/config/network following way (which again works in 3gv2):

config switch
option name 'switch0'
option reset '1'

config switch_vlan
option device 'switch0'
option vlan '1'
option vid '1'
option ports '6t 3 2 4'

I can't find any error here, I'm using box as a dumb AP, so basically no need for VLANS, but that error is bothering me an if I kick whole vlan config out and restart, I can't reach the box anymore:-/

TFTP upload only works on LAN Port No. 2

Did you add model's switch layout to target/linux/ramips/mt7621/base-files/etc/board.d/02_network before compilation?

Did you test juppin's .bin