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

Try one of these debrick guides to get your router back to stock, then you can retry with the correct firmware. If you use my video (last link) can you check how bad my chinese subtitles are =D

My builds have openvpn ready to use. They have some additional apps but the size is small nevertheless (about 6.2 MiB), so it still leaves plenty of space on the flash. Should you need smaller builds, you can try to build and costumize, the config files I used are there too on the releases page.

@joedotnet I've made a build replacing wpad-basic with wpad and put it on my google drive:


See if it helps. The .config file is there also on the zip file (rename dot-config to .config and put it in openwrt build directory). To build it yourself, clone my repo (on linux, mac or *bsd ready machine) and switch to the apropriate branch, like this:

git clone https://github.com/araujorm/openwrt.git
cd openwrt
git checkout xiaomi-miwifi-3gv2-19.07-mt76updated
cp /path/to/dot-config .config
./scripts/feeds update -a && ./scripts/feeds install -a
make menuconfig  ### if you want to further costumize anything
make -j8

The -j8 switch is optional, but recommended, and you should adjust it to the number of threads/cores of your machine. You can ommit it, but instead of building the image in 10 or 15 minutes it may take hours. Also, you need the machine to be connected to the internet because most source packages are downloaded during the build process.

When done, the image will be in bin/targets/ramips/mt7621/openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin

More info on the README file.

Best of luck.

(edited: wrong order of make menuconfig, corrected "switch to the apropriate branch", not "repo")

1 Like

Thanks, i have solved wpad problem. But new problem or bug how change wlan mac address...

I tried already , thank you for all the feedback.

1 Like

This isn't a "bug" your technically not supposed to change your mac adderess because it should be set from your device hardware itself. However there are a few software work arounds. I'd try some of the methods here to start:

Ah well, if you want to know how to do the programing with the CH341A if you go to some of the first posts in this thread there is a lot of info there.

:warning: WARNING Do not buy R3GV2 . :warning:

well, R3GV2 and R4A Giga version have the same hardware but the software is not . they have different bootloader...


Thanks for clarifying.

1 Like

I installed your latest firmware from github and now openvpn working properly. Thanks for you work

#!/bin/sh /etc/rc.common
# Copyright (C) 2014 OpenWrt.org


start() {
    ifconfig wlan0 down
    ifconfig wlan0 hw ether 40:B0:76:D1:40:2C
    ifconfig wlan0 up

stop() {
    echo "Stop."

I made this script as tutorial on internet
name file clone
copy to /etc/init.d/
chmod +x /etc/init.d/clone
/etc/init.d/clone start
working good mac address wifi change
and to enable autostart
/etc/init.d/clone enable
showing on my openwrt luci web on startup menu
but the problem
this script not runing on startup Mac addres wifi stil no change, i had to click "start or restart" on startup menu than mac addres wifi change
point me.. how to make script clone run automatic when it reboot?
Thanks. sorry my english

/etc/init.d/clone enable should have enabled it to autostart, make sure it is actually enabled in the startup tab in Luci. If it is, I'd probably start looking into the logs to see if it created an error. You could also increase the START=94 figure to something like 99 as it's starting about the same time as gpio_switch might cause a bit of confusion. Other than that read up on init.d and how it works.

Just so you know this stops being relevant for this device-specific thread and is more an issue with configuring OpenWrt so should you have more problems might be worth asking them in a new thread or in one with similar content.

This. Doubts about OpenWrt usage, not device specific, please put on a new thread.

In any case, I wouldn't mess much with init.d for what you asked, you should be able to override the MAC address using the web interface, as per attached screenshot:

Every interface has that option, just note that one thing is the "wifi interface" that you configure in the Wireless section, and another is the "Interfaces" section: one must be refered by the other, but the mac address is changeable in the "Interfaces" section. I never tried to change it from there, but it should work and become persistent after a reboot.

1 Like

Sorry for out of topic, but overide Mac address not work on this

Thanks for this, I've must have tried 5 differents images multiple times throughout the past months, all resulting in bricks for some reason. This worked.

Some notes:
I could not easily wget or curl your github assets on the stock Xiaomi firmware, I downloaded and hosted them somewhere where I could use wget or curl.
There was no partition named kernel, I flashed the image to firmware which worked:

mtd -e firmware -r write openwrt-ramips-mt7621-xiaomi_mir3g-v2-squashfs-sysupgrade.bin firmware

Thanks for your work!

1 Like

Back again after few months with flashed my Mi router 4 flashed with openwrt ( Firmware Version:
OpenWrt 19.07.2 r10947-65030d81f3 / LuCI openwrt-19.07 branch git-20.057.55219-13dd17f).

Now, I'd like to update to the last stable version.
What procedure has to be followed please ?

Thanks again !

Hello, I am wondering to expand EEPROM storage with Arduino SD Card shield. Since Arduino SDCard Shied and R4AG is using same protocol for ROM interface (SPI protocol) *CMIIW.

I think it might works. Any thought?

hello, thank u very much for the Steps.

i flowed every steps, but i got nothing from ttfpt, i also actived the windows function for that, but it still doesn't work.

i also tried 192.168.0.xxx, 192.168.1.xxx and 192.168.31.xxx, it came the same.

background, ich booted the OpenWrt and it startet to restart without ending.... that why i wanted to save it

could u pls give me some advice what i should do?

hoping for ur info.
thanks a lot.

Hello all, I want to flash the image that build using image builder, master branch, however when try to flash it, there is notice as follow:
"Device xiaomi,mir3g-v2 not supported by this image Supported devices: xiaomi,mir3g-v2 - Image version mismatch: image 1.1, device 1.0. Please wipe config during upgrade (force required) or reinstall. Reason: Config cannot be migrated from swconfig to DSA (early adopters with DSA already set up may just force-flash keeping existing config) Image check failed.

The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform."

it is ok to do the FORCE UPGRADE the firmware?
If after I upgrade it, can I revert back to v19.07 branch? (sorry, I am new to this openwrt, just start trying to builde image last week for my old tplink wdr3600, and now want to test it with mifi 4A gigabit)

Thanks in advance and sorry for my english, i am from Indonesia.

Yes, but you must delete the existing configuration over the upgrade (sysupgrade -n -F <sysupgrade-image.bin>), as the networking configuration differs between 19.07.x and master.

1 Like