Xiaomi R4AC - Problems installing OpenWrt

I did everything as you described....had the same results. another brick in the wall!!!
I'm gonna try the procedure that is described here (Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion), as soon has I find some time to do it.

1 Like

Thank you! I had the same idea but I need a stable router at least until the holidays... If you manage to try it please let us know how it goes.

Describe precisely what you did. Did you manage to load the Chinese Xiaomi firmware?

Yep. Worked like a charm. Used the tool to downgrade to the chinese version. Updated to the 2.18.58 and then used hoody's guide.
I have OpenWrt up and running. Now I just need to figure out how to use it with my operator router and how to install OpenVPN in it.

But, for this matter (of installing it) it worked.

1 Like

Thank you for the update! Gonna try this ASAP.

To wrap it up, just comment that I have it fully functional now. OpenVPN installed and running as well.
Tried WWAN (working) and I just need to try WAN connected (to the operators router) but I think it will work as intended.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

1 Like

Long story short:

I bought a Xiaomi R4AC 100M router, which had the 3.0.5 global stable version firmware, which was always bricking when trying to install OpenWrt. I followed the steps below to get it to function:

  1. Downgrade to chinese firmware 2.18.28, using MiWifi Repair Tool.

  2. Update to 2.18.58.bin manually through the xiaomi web interface
    (Procedures can be found here Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion Thanks to @beitabeet).

  3. Then followed up with @hoddy tutorial to install OpenWRT. (Thanks for the time you had spent with my questions).

  4. In case you brick the router, @hoddy has an excelent tutorial on how to debrick it as well.

Case closed and solved

1 Like

Hi,

I managed to get openwrt installed on my r4ac 100M international version router today. Same as yours, it was running 3.0.5. I don't have anything running windows here so I couldn't run the miwifi repair tool.

The sequence that worked for me was

go to the firmware upgrade section through the web interface and select manual firmware update.
select file
miwifi_r4ac_all_c4b35_2.18.28.bin

the firmware burn appeared to fail, and recovering to 3.0.5.bin as test.bin no longer worked.

However, copying miwifi_r4ac_all_c4b35_2.18.28.bin to my tftp server as test.bin worked.

I then upgraded through the chinese web interface to miwifi_r4ac_firmware_e9eec_2.18.58.bin

and subsequently was able to use mtd to write openwrt-19.07.5-ramips-mt76x8-xiaomi_mir4a-100m-squashfs-sysupgrade.bin to OS1.

I think the significant difference between international 3.0.5 and the chinese version is that the rom is laid out differently. In the international version the overlay partition is double the size. Also, there's an extra partition in the chinese firmware, although I would guess that it's the overlay difference that is important. The start of OS1 is quite different between the two versions.

  • Mark
1 Like

btw, something that was interesting doing the upgrade in the chinese version is that there was a tick box for something along the lines of, enable go through walls mode, which one would assume is transmit at more the 25mw. I forgot to do a survey when that firmware was running to see what the difference is. I've got two of these routers. One is running openwrt now, the other the stock international firmware, so I can gather further information if a developer is interested.

  • Mark
1 Like

@D3an3, I'd want to ask where you were able to get the Chinese firmware for the R4AC. I have the same router, but the Chinese version. I accidentally bricked it by choosing the gigabit firmware when installing OpenWRT. To unbrick it, I believe I need the Chinese firmware and Hoody's debrick tool (I already have Hoody's debrick tools, but either the router just keeps on blinking orange or blinking blue even after an hour).

The rom layout differences are indeed why the release sysupgrade.bin doesn't work on the r4ac international version.

If you apply this patch,

--- a/target/linux/ramips/dts/mt7628an_xiaomi_mir4a-100m.dts
+++ b/target/linux/ramips/dts/mt7628an_xiaomi_mir4a-100m.dts
@@ -90,13 +90,13 @@
 
                        partition@60000 {
                                label = "overlay";
-                               reg = <0x60000 0x100000>;
+                               reg = <0x60000 0x200000>;
                                read-only;
                        };
 
-                       partition@160000 {
+                       partition@260000 {
                                label = "firmware";
-                               reg = <0x160000 0xea0000>;
+                               reg = <0x260000 0xda0000>;
                                compatible = "denx,uimage";
                        };
                };

The resultant sysupgrade.bin works.

This is the sequence I used to install openwrt on an International version R4AC running 3.0.5 firmware:

Apply patch above to openwrt source tree.

Build openwrt

Get ssh access to r4ac router using OpenWRTInvasion

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc -o UserKnownHostsFile=/dev/null root@192.168.31.1 'cat > /tmp/sysupgrade.bin' < ~/openwrt/bin/targets/ramips/mt76x8/openwrt-ramips-mt76x8-xiaomi_mir4a-100m-squashfs-sysupgrade.bin
md5 ~/openwrt/bin/targets/ramips/mt76x8/openwrt-ramips-mt76x8-xiaomi_mir4a-100m-squashfs-sysupgrade.bin
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc -o UserKnownHostsFile=/dev/null root@192.168.31.1
md5sum /tmp/sysupgrade.bin

confirm the two checksums match

write the image
mtd -e OS1 -r write /tmp/sysupgrade.bin OS1

This is a lot simpler than downgrading the router to the Chinese language firmware.

openwrt probably needs a new target to accommodate the two variants.

  • Mark
2 Likes

Hi. I was able to download it from the links provided on this link (Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion)

Thanks a heap @D3an3! The link you shared even had specific instrucrions for my R4AC :blush:

@markky, where were you able to get the 2.18.58 version? Downloads for this at miwifi.com give me Access Denied errors.

Hmmm, turns out my openwrt tree was master from early October.

Here's a similar patch relative to tag v19.07.5


diff --git a/target/linux/ramips/dts/XIAOMI-MIR4A-100M.dts b/target/linux/ramips/dts/XIAOMI-MIR4A-100M.dts
index 8a33745f7f..3f81ba50da 100644
--- a/target/linux/ramips/dts/XIAOMI-MIR4A-100M.dts
+++ b/target/linux/ramips/dts/XIAOMI-MIR4A-100M.dts
@@ -8,7 +8,7 @@
 
 / {
        compatible = "xiaomi,mir4a-100m", "mediatek,mt7628an-soc";
-       model = "Xiaomi Mi Router 4A (100M Edition)";
+       model = "Xiaomi Mi Router 4A (100M International Edition)";
 
        chosen {
                bootargs = "console=ttyS0,115200";
@@ -97,13 +97,13 @@
 
                        partition@60000 {
                                label = "overlay";
-                               reg = <0x60000 0x100000>;
+                               reg = <0x60000 0x200000>;
                                read-only;
                        };
 
-                       partition@160000 {
+                       partition@260000 {
                                label = "firmware";
-                               reg = <0x160000 0xea0000>;
+                               reg = <0x260000 0xda0000>;
                                compatible = "denx,uimage";
                        };
                };

Cheers,

  • Mark
1 Like

I'm pretty sure I got it from

As someone else posted earlier.

Cheers,

  • Mark
1 Like

Cool! Many thanks.

After scanning a large proportion of the massive 4a gig thread, I'm pretty sure I recall that someone suggested that the xiaomi site geo blocks access to some of the images, and also I recall some mention of a chrome extension/plug in that gets around that. Frankly I'm glad I found a solution that doesn't require switching to the chinese version. Of the two units I have, my first success was managing to get it switched to the chinese version of firmware, but I'm going to try reverting it to the original xiaomi firmware so I can end up with two identical routers. Fortunately I saved a copy of mtd for both routers as soon as I got shell access with the shipped int firmware.

Cheers,

  • Mark
2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.