Xiaomi R4AC - Problems installing OpenWrt

Hi there.
Does anyone successfully installed OpenWrt on Xiaomi R4AC with official firmware version 3.0.5?
Whenever I try to install OpenWrt I brick the router. All the procedures already explained on other threads work until the step where it should blink blue (finishing successfully). Mine always stays blinking orange and blue...and keeps that way ad infinitum.
Does anyone have a clue on what I'm doing wrong?

Thanks for any help!!

2 Likes

Hi,

I also have a xiaomi r4ac that was running 3.0.5 and unfortunately bricked it. Have you managed to find a debrick method that works? If so, what are you using for test.bin when you enter tftp recovery mode? Hoddy's images don't appear to work for me.

Thanks,

  • Mark
1 Like

I can answer that, I used this:

It's for the GLOBAL version of the router, so make sure you don't have the chinese version.

3 Likes

Correct. I followed Hoody's tutorial to debrick, and used this firmware image.

Excellent. Thank you, that worked.

Unfortunately, after running openwrtinvasion, copying over https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt76x8/openwrt-19.07.5-ramips-mt76x8-xiaomi_mir4a-100m-squashfs-sysupgrade.bin as /tmp/firmware.bin, and then running
mtd -e OS1 -r write /tmp/firmware.bin OS1

I rebrick the router. Am I using the correct procedure?

I'm going to try one more time and check that sha256 is correct as I forgot to do that the last time.

  • Mark

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

2 Likes

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
2 Likes

@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.