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

Thanks for the suggestion. Unfortunately I have some specific packages on my build, so I didn't use yours. Instead I also pulled some of the changes from the 3Gv2 patch into my build, more specifically, some parameters on the DTS file.

I didn't touch the "ralink,group" on the pinctrl section because it didn't seem relevant (and anyway I don't really know what that part is for and the meaning of the different parameters), but changed some addresses and the SPI frequency.

Let's see how this goes. Already flashed my device with this new build and looking good so far, but too soon to see if it's more stable.

Should anyone be curious, here's a patch (to apply from openwrt/master lastest commit) with the changes I made to try merging Roger's patch and the 3Gv2 currently proposed patch:

If it looks good, @rogerpueyo you can use this in your repo :slight_smile: Also, can you make a pull request for integrating the support on the official openwrt tree?

1 Like

Any update on the problem, was it solved with your patch?

Hi.

So far, so good, with uptime of about 2 days. For now just one minor hiccup on the IP camera connection to the NVR, of a few seconds (meanwhile I've also configured NVR to send emails when that happens, which gives me additional precision to detect failures), but no error messages on the kernel ring buffer of the router.

But I think I'll wait some more time until considering it a full success. I'll be happy when the uptime is of a few weeks with no video losses, like with the other camera on the other side of the house which is connected to other (mt7628) weaker AP :slight_smile:

1 Like

6 days of uptime and no kernel messages indicating errors. In terms of WiFi stability, not 100% but about 95% - still have some breaks now and then, of some seconds, but way less. Meanwhile I've also fine tuned some parameters (e.g. disabled short gi to try to improve communications across a wall), but that's more related to my environment that anything else.

So in my experience, the patch I referred has been performing better. Should anyone have issues, feel free to try it.

Thanks @Gingernut for the tip.

1 Like

Hello my spi/uart usb Interface arrived. Opend the router it did not looked the pics (no SPI chip). With the uart connected i noticed that i dont have a R4A I have an R4 and from what I can read its a nand device.

I got access to CLI and uart. It had the 5 sec bootdelay from factory so problem accessing the CLI to enable uart.

I know this might be a bit of topic but how to compile the firmware for the R4, is it possible ? Can I use same image ?

/Henrik

No, image is different for R4.

Try this topic instead:

Info:
https://openwrt.org/toh/hwdata/xiaomi/xiaomi_miwifi_r4

Sorry that I can't help much more than that :frowning:

Hi, thanks to this great contribution. I've purchased an Xiaomi 4A Gigabit edition and flashed the version from @rogerpueyo's branch. All is fine except that I can't install openvpn or wireguard (not even from the additional compiled ipk's) because of a kernel version being older that the required one.
I'm wondering if there's an easy way to upgrade the kernel only or should I get a latest snapshot and apply the same commit on it?

Update your source to the latest OpenWRT master branch and compile.

Why not include the packages you want at build time to your compiled image?

@Gingernut Thanks, I'll try it out at home. I actually did select the packages but for some reason I ended up with the normal snapshot build without additional changes, luci wasn't in there as well. Maybe my new try will have them included now. I didn't have to build openwrt image before so most probably I did something wrong there.

Nope didn't work. I even got the latest openwrt original master and applied the changes there. Both luci and openvpn are nowhere to be found on the image. It did compile the separate ipk versions but they are not included in the build. Installing them manually gives the same error. I must be doing something wrong with adding luci and openvpn in there.

When in the make menuconfig setup you include the packages you want with a asterisk correct?

Ahhh I feel so stupid. I selected the packages with the "M". After compiling it again it is working perfectly. Thank you.

1 Like

After compile (branch xiaomi-mi-router-4a-1000m-gigabit-edition_wip) and flash via TFTP the device is not booting, freezed at Stating Kernel...

ETH_STATE_ACTIVE!! 
TFTP from server 192.168.31.100; our IP address is 192.168.31.1
Filename 'sysupgrade.bin'.

 TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: Got ARP REPLY, set server/gtwy eth addr (00:00:00:00:67:19)
Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########################################
done
Bytes transferred = 3867399 (3b0307 hex)
LoadAddr=80100000 NetBootFileXferSize= 003b0307
 Writing OS1 to 0x180000
raspi_erase_write: offs:180000, count:3b0307
raspi_erase: offs:180000 len:3b0000
...........................................................
...........................................................
raspi_erase: offs:530000 len:10000
.
.
Done!
Erasing SPI Flash...
raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
.
done
Booting System 1
Erasing SPI Flash...
raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
.
done
## Booting image at bc180000 ...
   Image Name:   MIPS OpenWrt Linux-4.19.57
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1795977 Bytes =  1.7 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Erasing SPI Flash...
raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
.
done
commandline uart_en=1 factory_mode=0 mem=128m root=/dev/mtdblock9
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

Any idea?

First TFTP the initramfs version, then you can do sysupgrade.

ubuntu tftp using the service xinetd.
I think that the problem is my image, would be fine to get the @ rogerpueyo image to be sure that the procedure works.

I mean:
Step 1: install initramfs-kernel.bin via TFTP
Step 2: do sysupgrade to squashfs-sysupgrade.bin

The same result booting freezed at Starting Kernel:

raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
.
done
Automatic boot of image at addr 0x80A00000 ...
## Booting image at 80a00000 ...
   Image Name:   MIPS OpenWrt Linux-4.19.57
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    3669349 Bytes =  3.5 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Erasing SPI Flash...
raspi_erase: offs:30000 len:10000
.
Writing to SPI Flash...
.
done
commandline uart_en=1 factory_mode=0 mem=128m root=/dev/mtdblock9
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in MB, 128

Starting kernel ...


CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB1 

hm, I've built my image yesterday and has kernel 4.14.143 for R3Gv2 (what is pretty much the same device), yours has 4.19.57, maybe its really your image has a problem.

Seems to be the kernel configuration... could you share your image?

Thank you

Good luck:

sha256:
6ba52e2771ab3fbf0a1a2b0a9b6a0c123fbc6069649bdb9c9222cb782a3e49bc openwrt-ramips-mt7621-xiaomi_mir3g-v2-initramfs-kernel.bin
46911e4d41995179b14e5e1d4f333e6f01f3aa62f74c67fff43ed688218e26e2 openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin

It was built with this patch: https://patchwork.ozlabs.org/patch/1154310/

1 Like