Adding OpenWrt support for Xiaomi "Redmi Router AX6S"/"Xiaomi Router AX3200"

Here's a build I've cherry-picked and tested in the past day

It has luci, sqm, adblock, dns over https, openvpn, and other goodies out of the box. The image is 14MB, ram usage is solid.

It's based of latest @namidairo commit, so it's a single partition image.

Today I got my AX3200. I used the instruction on this link: https://github.com/mikeeq/xiaomi_ax3200_openwrt and used the image: https://github.com/mikeeq/xiaomi_ax3200_openwrt/releases/download/v20220303/openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-sysupgrade.bin

First everything seemed to work, I could configure the router as I wanted. But later I noticed that after a reboot all configurations are lost. Does anyone also have this problem and know what I'm doing wrong?

2 Likes

Do a sysupgrade with the same image.

1 Like

I'm guessing I probably made an oopsie with the definition of the OOB size?

Either that or some shenanigans occurring with the mediatek BBT/BBM.

Edit: Hmm that could be it, the bootloader looks like it has it defined as 128 for the chip with id C8,51 (The OOB size seems to be +0xA after the nand id if you look in U-Boot)

1 Like

@namidairo something weird is happening, so as @dekomote said after making changes in /overlay via Luci or CLI and executing sysupgrade -u seems to solve the issue with corrupting jffs2 after a reboot, but whenever you do sysupgrade -u -n (without saving current configuration) the issue still persists (the issue that the configuration is not getting restored after a restart)? Seems like making a change, so modifying /overlay and then executing sysupgrade -u fix somehow jjfs2/partition layout? No idea

EDIT. After executing sysupgrade -u I have different logs about jffs2:

root@OpenWrt:/etc/config# logread | grep -i jffs
Fri Mar  4 06:21:26 2022 kern.info kernel: [    0.042257] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    7.657186] jffs2: CLEANMARKER node found at 0x00000000 has totlen 0xc != normal 0x0
Fri Mar  4 06:21:26 2022 kern.warn kernel: [    7.691746] jffs2: Empty flash at 0x000011b4 ends at 0x00001800
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    9.178666] jffs2: notice: (818) jffs2_build_xattr_subsystem: complete building xattr subsystem, 11 of xdatum (0 unchecked, 3 orphan) and 13 of xref (2 dead, 1 orphan) found.
Fri Mar  4 06:21:26 2022 user.info kernel: [    9.197593] mount_root: switching to jffs2 overlay

Some more not related logs:
Errors:

Fri Mar  4 06:21:26 2022 kern.err kernel: [    0.079531] mt-pmic-pwrap 10001000.pwrap: unexpected interrupt int=0x1
Fri Mar  4 06:21:26 2022 kern.info kernel: [    1.767899] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x200000000 64bit pref]
Fri Mar  4 06:21:26 2022 kern.err kernel: [    1.817968] pcieport 0000:00:00.0: of_irq_parse_pci: failed with rc=-22

MTD:

Fri Mar  4 06:21:26 2022 kern.info kernel: [    0.726228] mtk-snand 1100d000.snfi: chip is F50L1G41LB, size 128MB, page size 2048, oob size 64
Fri Mar  4 06:21:26 2022 kern.info kernel: [    0.737025] [BBT] BMT.v2 is found at 0x3ff
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.741315] 9 fixed-partitions partitions found on MTD device 1100d000.snfi
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.748297] Creating 9 MTD partitions on "1100d000.snfi":
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.753689] 0x000000000000-0x000000080000 : "Preloader"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.760096] 0x000000080000-0x0000000c0000 : "ATF"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.765450] 0x0000000c0000-0x000000140000 : "u-boot"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.771511] 0x000000140000-0x000000180000 : "u-boot-env"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.777477] 0x000000180000-0x0000001c0000 : "bdata"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.782993] 0x0000001c0000-0x000000240000 : "factory"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.789140] 0x000000240000-0x000000280000 : "crash"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.794658] 0x000000280000-0x0000002c0000 : "crash_log"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    0.800542] 0x0000002c0000-0x0000075c0000 : "firmware"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.001667] 2 fit-fw partitions found on MTD device firmware
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.007330] Creating 2 MTD partitions on "firmware":
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.012287] 0x000000000000-0x0000003a0000 : "kernel"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.023609] 0x0000003a0000-0x000007300000 : "rootfs"
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.217710] mtd: device 10 (rootfs) set to be root filesystem
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.223679] 1 squashfs-split partitions found on MTD device rootfs
Fri Mar  4 06:21:26 2022 kern.notice kernel: [    1.229860] 0x000000880000-0x000007300000 : "rootfs_data"

EDIT2: After executing sysupgrade -u -n again I've got corrupted passwd/shadow and now I can't login :smiley: Lovely

2 Likes

sysupgrade -u with the same image works for me

The lan/wan mac is set to 00:0c:e7:11:22:33 on my device. Shouldn't it get set automatically?

Could you tell me what hardware you're using for 800 Mbps?
I'm using an Wireless 8265 / 8275 (Dual Band Wireless-AC 8265) as client and the AX3200 is is sitting next to it. It doesn't go above ~100 Mbps
Same with an Intel AX200 using the iwlwifi driver.

Connecting to host 192.168.50.10, port 5201
[  5] local 192.168.50.36 port 60804 connected to 192.168.50.10 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  12.5 MBytes   105 Mbits/sec   73    313 KBytes
[  5]   1.00-2.00   sec  10.3 MBytes  86.0 Mbits/sec  100    250 KBytes
[  5]   2.00-3.00   sec  11.1 MBytes  93.3 Mbits/sec    0    283 KBytes
[  5]   3.00-4.00   sec  10.9 MBytes  91.7 Mbits/sec  103    232 KBytes
[  5]   4.00-5.00   sec  9.94 MBytes  83.4 Mbits/sec    0    263 KBytes

Thank you, I've changed SNAND_MEMORG_1G_2K_64 to SNAND_MEMORG_1G_2K_128 and it works great now

Here's firmware I built
https://drive.google.com/file/d/1SMbRFHIY3zzVWS-_Yt6WoIPdB2hhD-Ai
based on @namidairo ax6s branch, but with fix above
additional packages:
luci
wpad-mesh-wolfssl

2 Likes

AX200 :slight_smile:

$ iperf3 -c 192.168.0.254
Connecting to host 192.168.0.254, port 5201
[  5] local 192.168.0.248 port 55570 connected to 192.168.0.254 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  88.9 MBytes   746 Mbits/sec    0    880 KBytes       
[  5]   1.00-2.00   sec  92.5 MBytes   776 Mbits/sec    0    987 KBytes       
[  5]   2.00-3.00   sec  92.5 MBytes   776 Mbits/sec    0   1.22 MBytes       
[  5]   3.00-4.00   sec  92.5 MBytes   776 Mbits/sec    0    935 KBytes       
[  5]   4.00-5.00   sec  91.2 MBytes   765 Mbits/sec    0   48.1 KBytes       
[  5]   5.00-6.00   sec  78.8 MBytes   661 Mbits/sec    0   1021 KBytes       
[  5]   6.00-7.00   sec  86.2 MBytes   724 Mbits/sec    0   1.89 MBytes       
[  5]   7.00-8.00   sec  96.2 MBytes   807 Mbits/sec    0   1.01 MBytes       
[  5]   8.00-9.00   sec  90.0 MBytes   755 Mbits/sec    0    905 KBytes       
[  5]   9.00-10.00  sec  92.5 MBytes   776 Mbits/sec    0   1.32 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   901 MBytes   756 Mbits/sec    0             sender
[  5]   0.00-10.01  sec   899 MBytes   753 Mbits/sec                  receiver

iperf Done.

28:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)

image

Where's your iperf3 server? Maybe it's 100mbit itself?

1 Like

Thanks for confirming, I'll get that fixed up.

3 Likes

Confirming via the mfg spec sheet https://www.mouser.com/datasheet/2/870/gd5f1gq5xexxg_v1_3_20210513-2400480.pdf definitely 128B page size

Is there the same issue on GD5F1GQ5UEYIG flash as it is on F50L1G41LB that after a fresh mtd -r write sysupgrade.bin firmware fails to sync jffs2 overlay after reboot?

Yes, I had to sysupgrade to make my config persistent. And I need to sysupgrade again after factory reset

Interestingly, you can see the same issue here with ax3600 from xiaomi. It's a completely different soc, but they still advise on doing sysupgrade after writing the image because the settings don't persist.

The AX3600 has two system partitions (mtd12 and mtd13), thats why they have to double flash.

So does this one. But its the same issue, check the Notes.

1 Like

I'm not aware of the flash layout of the AX3200.

Good info tho. ty

I have a GD5F1GQ5UEYIG flash unit as well, @panton's last build is working for me as I am now able to boot into openwrt firmware where as before it would just brick itself. I will setup the router and report back after some testing.

I think AX3600 did not have this issue. It is, like @RHBH said, about two partitions system.

Note

    160MHz channel is 64
    Please sysupgrade twice nand-ipq807x-single.img (not keep settings)

This "not keep settings" was about do not keep settings when sysupgrade. It is an usual step to avoid incompatibilities with different firmware versions.

*BTW, That first QSDK build attempt brought a lot of AX3600 bricks because it modified the partition table partition... A good time to remember to be careful with your AX6S NAND original partition layout and important partitions.

Good news from this device, good job guys!!