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

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

Definitely I was the kernel version, maybe the patch you sent me could solve this issue.
Working image:

Thank you so much

Could you share yours flash file ( from breed or from spi programmer ) with this version openwrt ?
I can't install any version openwrt with mounted overlay partition, so my router loose any setting over reboot.
Now I use padavan on this, but i will testing openwrt.
BTW From breed is impossible get working openwrt ( in my case ) any working compilation has no overlays mounted.
Breed only see partition 0x4000 0x5000 and 0x6000 for firmware - only initramfs kernel image working.
Is any solution for regen partiton table wiitch work with eg, openwrt-4a compilation ?

Not sure if this'll help because I think you mean an image for the Xiaomi 3G v2 (in that case don't flash this file) but otherwise here's a normal compiled kernel and sysupgrade image for the Xiaomi 4A Gigabit edition build from master (16-09-2019) snapshot and @rogerpueyo's original changeset with following packages added:

  • luci
  • openvpn-easy-rsa
  • openvpn-openssl
  • wireguard
  • wireguard-tools
  • luci-app-wireguard
  • luci-app-openvpn
  • luci-app-adblock
  • wpad-mini

https://transfer.sh/K56bJ/openwrt-ramips-mt7621-xiaomi_mir4a-gigabit.zip

Yes, this compilation works OK !!

1 Like

Meayby is silly question but how aply this patch on pure clone git tree - i got error:

git apply *.patch
error: patch failed: target/linux/ramips/base-files/etc/board.d/02_network:683
error: target/linux/ramips/base-files/etc/board.d/02_network: patch does not apply

??

You can try with the "--3way" parameter wich will ask you to solve conflicts like so: "git apply --3way filename.patch".

Can we keep this thread strictly Mi Router 4A hahaha, its soo confusing reading comments talking about image files for the 3G that are not even related or could help the 4A project.

If you mean files with the name 3gv2, they match the 4A router :slight_smile:

Both threads should probably be merged together.

Here's an updated firmware off master branch for the interested, it should be compatible for both models:

It has some included packages:
LuCI
BanIP
Simple Adblock
WiFi Schedule
UPnP
Dynamic DNS
Wake On Lan
SQM QOS
Wireguard

1 Like

I have tried to install this .bin file directly on XIAOMI 4A but it puts our "file verification failed" :slight_smile:

Hi everyone!

I successfully installed the firmware (the version posted by kevinsa a few days ago) on mi Mi Router 4A using the bootloader unlock with the help of a flash memory programmer. So far so good, performance is excellent and now I have all the features from full OpenWRT (stock has IPv6 disabled!!!)

1 Like

You more than likely need to force the system update manually over CLI because of the model name changes.

Can you share with us the proces where to download and how to go true? Do we need any hardware gadgets?

You can find the procedure in the first post of this thread, but basically you need to dump the SPI flash, modify a few bytes then write it. You need a CH341A programmer with a SOIC8 clamp (you can easily find them online for cheap)

So as I understand "rogerpueyo" explained

I have bayed - CH341A programmer with a SOIC8 clamp understand how to get inside the FLASH memory then Dumping the SPI FLASH memory > Extracting the SPI FLASH memory content using binwalk > Modifying the U-Boot bootloader timeout > then what is next step .. Thanks for help :slight_smile: