Add OpenWrt support for Xiaomi "Redmi AX6000"

Is there a kernel driver to show the cpu frequency and scaling governor? I believe I found the CPU temperature:

# cat /sys/devices/virtual/thermal/thermal_zone0/temp         
32607

Build with initramfs-factory.ubi that support official OpenWRT
Download https://github.com/dimfishr/openwrt/releases/

1. Gain ssh access https://openwrt.org/toh/xiaomi/redmi_ax6000#installation
2. Check current stock system
cat /proc/cmdline
if firmware=1, current system is ubi1
if firmware=0, current system is ubi
3. Setup nvram
if current system is ubi1, please setup: next time it would boot from ubi

nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=0
nvram set flag_last_success=0
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit

else if current system is ubi, please setup: next time it would boot from ubi1

nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=1
nvram set flag_last_success=1
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit

4. Flash flash initramfs-factory.ubi
if firmware=1, current system is ubi1, flash to ubi:
ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-initramfs-factory.ubi
if firmware=0, current system is ubi, flash to ubi1:
ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-initramfs-factory.ubi
5. Reboot and setup uboot-env
reboot then it should boot to the openwrt initramfs system now, login ssh and setup:

fw_setenv boot_wait on
fw_setenv uart_en 1
fw_setenv flag_boot_rootfs 0
fw_setenv flag_last_success 1
fw_setenv flag_boot_success 1
fw_setenv flag_try_sys1_failed 8
fw_setenv flag_try_sys2_failed 8
fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),112640k(ubi)"

here set flag_last_success=1 and flag_try_sys1_failed >= 6 and flag_try_sys1_failed >=6, to make it always boot from system 0
6. Flash via sysupgrade
sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-squashfs-sysupgrade.bin

1 Like

Just wanted to report successfully flashing without using the UART headers/purely ssh.

As of 23-Nov-2022, if you build from master, there are only two PRs that need to be merged:

3 Likes

You can flash official Openwrt partitions without UART with my initramfs-factory.ubi and then sysugrade to the latest official snapshot.
See my previous post

Yes, I only wrote that to clear up some pervious conversations in this thread and in the PR#11115 wherein people are pointing to failures they claimed were due to using ssh.

OK to move from unofficial Openwrt (X-WRT) you can also use my initramfs-factory.ubi:

fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),112640k(ubi)"
mtd -r -e ubi write /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-initramfs-factory.ubi

reboot

sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-squashfs-sysupgrade.bin

I was able to successfully flash via this method and then sysupgrade to today's vanilla openwrt snapshot (had to use -F with sysupgrade to bypass config version check).

Still testing, but at first glance everything seems to be working :+1:.

1 Like

Yes, that is what PR#11004 will fix

One note I'd like to add that may not be obvious for novices is how to get the ubi and bin files onto the device without using tftpd. The best option here is scp but you'll first need to enable ssh access on the router (the firmware unlocking steps in the wiki only enable telnet).

  1. Telnet into the router
  2. sed -i 's/channel=.*/channel="debug"/g' /etc/init.d/dropbear
  3. /etc/init.d/dropbear start

You should now have ssh access but the version of dropbear in the stock firmware is very old so you need to add some options to your ssh/scp commands to connect.

For ssh:
ssh -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa root@192.168.31.1

For scp:
scp -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa -O openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-squashfs-sysupgrade.bin root@192.168.31.1:/tmp/

scp -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa -O openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-initramfs-factory.ubi root@192.168.31.1:/tmp/

1 Like

There is special automated tool to enable telnet, ssh and many more for Xiaomi devices:

1 Like

I put these steps on the wiki... feel free to review and edit.

I am at my wit's end right now trying to get this installed. I TFTP booted the iniramfs.bin file, and now I'm on the next part. However, I cannot SSH into the router, nor can I access luci. Using serial, I can get into the router, but I cannot SSH out, or use wget due to DNS not working for whatever reason (have tried for the last 4 hours to get it to work). Is there another way I can get the file onto the router without having to rely on DNS?

What build / revision are you using? I know a few folks have noted that this commit seems to be breaking the networking on this router. That could potentially explain the DNS / SSH issues you're seeing.

That being said, wget should work without DNS if you point it at an IP address instead of a hostname (like wget http://192.168.1.X/whatever)

1 Like

The issue is that it says "operation not permitted" due to DNS not working. The "fun" part is that I can ping to and from the router, but doing anything else fails. I'm currently attempting to transfer the firmware over serial because my brain is fried... I'll try a different git commit if I can't get it working right

See scp method here: Add OpenWrt support for Xiaomi "Redmi AX6000" - #339 by anon_openwrt



The problem isn't SSH algo differences, it's the fact that it just doesn't work in general

Sounds like you are affected by a bug that was fixed yesterday. Build yourself a new image from HEAD or use the snapshot from 23-Nov-2022.

Does anyone know which of the 4 antennas are connected to the 5 GHz radio and which to the 2.4 GHz radio?

Does the PR submitted here if approved mean us existing users of OpenWRT will be forced to have mtdparts changed back to original layout in line with stock?

I can see they added an alternate layout for existing users but wasn't sure if that's to allow us to flash OpenWRT if that PR is approved with existing mtdparts that utilize the whole 128Mb flash or if we are being forced to change back to stock mtdparts.

Both 2.4 and 5ghz are in all 4 antenna.

1 Like