🌐 VI | EN

How to Install OpenWrt on the Redmi AX6000

Nghia Phan
Nghia Phan
🌐 Bản tiếng Việt Technical Guide Views

{{<notice “danger”>}} WARNING: These procedures are not for beginners. Proceeding means accepting the risk; I am not responsible for damage, although I will try to help if problems occur.

  • There are two procedures for two different OpenWrt layouts:

    • Version 1 uses the stock bootloader.
    • Version 2 uses U-Boot Mod. {{}}
  • Requirements:

    • A router with SSH enabled (guide).
    • Basic command-line skills.
    • Careful attention to every command and its order.
  • Prepare:

I. Install the stock-bootloader OpenWrt version

Download these files from OpenWrt:

  • xiaomi_redmi-router-ax6000-stock-initramfs-factory.ubi
  • xiaomi_redmi-router-ax6000-stock-squashfs-sysupgrade.bin

Open WinSCP:

  • File Protocol: SCP
  • Hostname: normally 192.168.31.1, port 22
  • Username: root
  • Password: generate the root password from the router SN.

Click Copy to copy the generated password.

{{< collapse “SCP login screenshot” >}} SCP Login {{< /collapse >}}

In SCP, double-click the tmp directory on the right and upload openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-initramfs-factory.ubi.

Log in over SSH and run the commands below in the correct order. Run only the block matching the value returned by cat /proc/cmdline (firmware=1 or firmware=0).

{{}}

# Click Copy to avoid typing mistakes cat /proc/cmdline # Example output: console=ttyS0,115200n1 loglevel=8 firmware=1 uart_en=1 # If firmware=1 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 ubiformat /dev/mtd8 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-initramfs-factory.ubi reboot # If firmware=0 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 ubiformat /dev/mtd9 -y -f /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-initramfs-factory.ubi reboot
{{}}

After reboot, the router address is 192.168.1.1. Log in over SCP at 192.168.1.1:22 (no password), open tmp, and upload openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-squashfs-sysupgrade.bin.

Log in over SSH and run:

{{}}

# Set the environment required to boot OpenWrt 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),30720k(ubi),30720k(ubi1),51200k(overlay)" # Flash OpenWrt sysupgrade -n /tmp/openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-stock-squashfs-sysupgrade.bin
{{}}

The stock-bootloader OpenWrt installation is complete.

II. Install the U-Boot Mod OpenWrt version

{{<notice “danger”>}} The router must already be running OpenWrt with the stock bootloader. Incorrect U-Boot steps or a corrupted download can brick it. Verify the network, PC, and file integrity before proceeding. {{}}

Prepare:

{{<notice “tip”>}} These links use OpenWrt 23.05.2. Find newer versions at OpenWrt.org. {{}}

II.1 Back up the stock-bootloader installation

Log in over SSH and run:

{{}}

cat /dev/mtdblock0 > /tmp/BL2.bin cat /dev/mtdblock1 > /tmp/Nvram.bin cat /dev/mtdblock2 > /tmp/Bdata.bin cat /dev/mtdblock3 > /tmp/Factory.bin cat /dev/mtdblock4 > /tmp/FIP.bin
{{}}

Use WinSCP to download these files from tmp to the PC.

II.2 Install U-Boot Mod

II.2.1 Flash initramfs

Upload xiaomi_redmi-router-ax6000-ubootmod-initramfs-factory.ubi to /tmp, then run:

{{}}

ubiformat /dev/mtd7 -y -f /tmp/ax6000-ubootmod-initramfs-factory.ubi reboot
{{}}

After reboot, check the partition table:

cat /proc/mtd

The ubi partition must be mtd5.

II.2.2 Unlock the bootloader partition

Official OpenWrt locks the bootloader partition. Install and load kmod-mtd-rw:

{{}}

opkg update && opkg install kmod-mtd-rw insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1
{{}}

Clear persistent logs so OpenWrt does not automatically boot into recovery:

rm -f /sys/fs/pstore/*

II.2.3 Format UBI and create U-Boot environment volumes

ubidetach -p /dev/mtd5; ubiformat /dev/mtd5 -y; ubiattach -p /dev/mtd5ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiBubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB

II.2.4 Flash U-Boot Mod

Upload these files to /tmp:

  • xiaomi_redmi-router-ax6000-ubootmod-bl31-uboot.fip
  • xiaomi_redmi-router-ax6000-ubootmod-preloader.bin
  • xiaomi_redmi-router-ax6000-ubootmod-squashfs-sysupgrade.itb
mtd write /tmp/xiaomi_redmi-router-ax6000-ubootmod-preloader.bin BL2mtd write /tmp/xiaomi_redmi-router-ax6000-ubootmod-bl31-uboot.fip FIP

II.2.5 Install U-Boot Mod OpenWrt

sysupgrade -n xiaomi_redmi-router-ax6000-ubootmod-squashfs-sysupgrade.itb

The U-Boot Mod OpenWrt installation is complete.

Comments & Discussion

Share your thoughts, ask questions and feedback

Markdown & QQ Emoji
Loading comments...