Observations on Xiaomi MIR4AG newer firmware

I just got a Chinese Mi Router 4A Gigabit-model and I immediately proceeded to dump the firmware and see about enabling UART-input. Alas, the procedure has changed slightly since in the thread the wiki points to the firmware is from 2019 and mine is from September 2021.

In the above thread, one has to modify the bootdelay parameter Uboot uses by default:

With my box, that's no longer the case. I had to change the word off to a null-character followed by on at 0x19324:
uboot_off
to
uboot_on

I also noticed that OpenWrt's partition-layout is actually wrong. The firmware-partition extends all the way to the end of the flash chip, ie. 0x1000000, even though partitions inside it only go to 0xe80000. There's supposed to be a "disk" partition starting at 0xe80000 that then extends to 0x1000000.

OpenWrt erases the entire firmware-partition when installed and thus clobbers the disk-partition as well. Alas, with the firmware my router came with, Uboot's env-variables are stored at 0xff0000 inside the disk-partition.

There's no point in extending the firmware-partition all the way to the end, when it's not actually used that way and it seems short-sighted to just clobber the disk-partition like that for no good reason. On my box, Uboot still works and just uses some defaults it was compiled with, but if Xiaomi continues to fiddle with their Uboot and ends up storing some more important environment-values at 0xff0000, this could cause some trouble.

Other stuff:
On my device, the magnetics for the Ethernet-ports have changed from those big, chonky components to a whole bunch of small SMD-devices. If you find your device with a similar arrangement, don't worry: it is still the same device.

Also, as a sidenote regarding using a CH341a-based flashing-tool: I had no trouble using one, unlike the person in the original thread. The difference may be because I have fixed the voltage the tool used (see e.g. https://www.youtube.com/watch?v=-ln3VIZKKaE ) and I am powering it from a USB3.0-port, instead of USB2.0 -- USB3.0-ports can supply more power.

2 Likes

Which flash chip is fitted to your R4AG ?
eg. Eon EN25QX128 ?

Nope. It was fitted with the GigaDevice NOR.

1 Like

Do you recall what firmware version shipped with your R4AG, and what latest version it auto updated to?

I never connected it to Internet, so it never got to update itself at all. I do have full bootlog stored away, though, and the log says it shipped with 2.28.84.

[ 0.000000] Linux version 3.10.14 (jenkins@d19057436595) (gcc version 4.8.5 (crosstool-NG crosstool-ng-1.22.0) ) #1 MiWiFi-R4A-2.28.84 SMP Thu Sep 30 03:27:19 UTC 2021

1 Like

Thankfully,Finaly find someone has same device,Have you successfully installed the newest openwrt?

Yes, like I mentioned in the initial comment on this thread, I had to modify Uboot to get serial-input to work and the procedure is different than what the wiki says.