Adding OpenWrt support for Xiaomi AX3600 (Part 1)

I managed to bricked my AX3600 (got a bit greedy with adding too many packages to my OpenWRT image, making it too large). I did have a few issues reflashing the AX3600 and pulling all the info on how to do it from loads of different sources, so I thought I'd document the process in a bit more detail and in one place here (if only for me to find again next time I go a bit mad with packages). Sorry this is so long, I try to go into as much detail as possible, and also include my working .config at the end (well the diffconfig of my .config).

RECOVERY:

NOTE: Items in BOLD are not to be typed literally, but are pointers on what you need to type.

  • Connect the serial cable to the router (NOT THE VCC CABLE THOUGH), in putty the setting are Speed: 115200, Data Bits: 8, Stop Bits: 1, Parity: None, Flow Control: None in the Connection -> serial screen. The power for the router will come from it's normal mains cable (you don't need to connect this yet).

  • Create somewhere to place your firmware for the tftp server and download the default xiaomi firmware:
    mkdir /tmp/tftp
    wget http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/r3600/miwifi_r3600_firmware_5da25_1.0.17.bin

  • Please note the name of the firmwarefile will probably be wrong, it seems to change with reboots and ip address changes:
    cp miwifi_r3600_firmware_5da25_1.0.17.bin /tmp/tftp/C0A81F0F.img

  • Also copy your compiled version of OpenWRT to the ftp folder:
    cp <location of openwrt-ipq807x-generic-xiaomi_ax3600-squashfs-nand-factory.ubi> /tmp/tftp/factory.ubi

  • Set a static address on your PC to serve the firmware from, here I use eno1 change this to the name of your adapter, also I use an ip address of 192.168.31.100 here as that is what the router expects:
    sudo ip address flush dev <adapter name, such as eno1>
    sudo ip address add 192.168.31.100/24 dev <adapter name, such as eno1>
    sudo dnsmasq --no-daemon --listen-address=192.168.31.100 --bind-interfaces --dhcp-range=192.168.31.1,192.168.31.99 --enable-tftp --tftp-root=/tmp/tftp

  • Then restart the router (unplug and then replug the power cable), with the reset button pushed in until the amber light starts flashing (follow in serial console if you like).

  • If it can't connect after a few goes, use a switch and only have the router and your PC plug in to it, this should stop the problem where Linux doesn't bring the interface up before u-boot just restarts the interface again. Please note, even when working it will still take a few cycles before the firmware starts to upload, again follow this via the serial connection.

  • It will then probably complain saying it can't find the file (it will be subtly different from C0A81F0F.img)

    • If so, press Ctrl+C on dnsmasq and then:
      cp miwifi_r3600_firmware_5da25_1.0.17.bin /tmp/tftp/<name of file it wants>
  • Restart dnsmasq:
    sudo dnsmasq --no-daemon --listen-address=192.168.31.100 --bind-interfaces --dhcp-range=192.168.31.1,192.168.31.99 --enable-tftp --tftp-root=/tmp/tftp

  • It will take a few goes, but eventually it you should start to see loads of hash tags '#' in the serial console

  • Sometimes it will then fail to verify, just try again by power cycling the router with the reset button pressed

  • Once it takes, I found that the serial console stated the Upgrade was successful, but the light still flashed white, just power cycle the router again

  • Either wait for it to finish booting via the serial console and press 'return/enter'when it finishes displaying all the boot messages, or press 'f' when asked to get a shell prompt if you don't want to wait

  • Then transfer the firmware to the router (it's filesystem will be read-only at them moment, so you must be in the tmp folder)
    cd /tmp
    tftp -g -r factory.ubi 192.168.31.100

  • There will be no progress, but in your dnsmasq command terminal window it will say it uploaded successfully

  • Then apply the firmware
    ubiformat /dev/mtd13 -y -f factory.ubi

  • And make sure it will boot from it
    nvram get flag_last_success ##just to see what it was, you don't need to run this if you don't want to
    nvram get flag_boot_rootfs ##just to see what it was, you don't need to run this if you don't want to
    nvram set flag_last_success=1
    nvram set flag_boot_rootfs=1
    nvram commit

  • Finally you are ready to boot into OpenWRT
    reboot

Also, my diffconfig which adds:

  • LuCI
  • Dashboard
  • The new theme
  • DAWN
  • adblock
  • acme
  • bash
  • Monitoring
  • Dynamic DNS
  • OpenVPN
  • WireShark
  • iperf3
  • nano
  • logratae
  • lsof
  • Quality of Service
  • UPNP Setup
  • PPPoE Setup
  • Shell commands via the Web Interface
  • Full versions of some core utils instead of limited busybox ones

Obviously, edit out the features you don't want, and then save it to your .config file:

CONFIG_TARGET_ipq807x=y
CONFIG_TARGET_ipq807x_generic=y
CONFIG_TARGET_ipq807x_generic_DEVICE_xiaomi_ax3600=y
CONFIG_DEVEL=y
CONFIG_OPENSSL_ENGINE=y
CONFIG_OPENSSL_WITH_ASM=y
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
CONFIG_OPENSSL_WITH_CMS=y
CONFIG_OPENSSL_WITH_DEPRECATED=y
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y
CONFIG_OPENSSL_WITH_PSK=y
CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_PACKAGE_TAR_BZIP2=y
CONFIG_PACKAGE_TAR_GZIP=y
CONFIG_PACKAGE_TAR_XZ=y
CONFIG_PACKAGE_TAR_ZSTD=y
CONFIG_PACKAGE_acme=y
CONFIG_PACKAGE_adblock=y
CONFIG_PACKAGE_bash=y
CONFIG_PACKAGE_bzip2=y
CONFIG_PACKAGE_cgi-io=y
CONFIG_PACKAGE_collectd=y
CONFIG_PACKAGE_collectd-mod-cpu=y
CONFIG_PACKAGE_collectd-mod-interface=y
CONFIG_PACKAGE_collectd-mod-iwinfo=y
CONFIG_PACKAGE_collectd-mod-load=y
CONFIG_PACKAGE_collectd-mod-memory=y
CONFIG_PACKAGE_collectd-mod-network=y
CONFIG_PACKAGE_collectd-mod-rrdtool=y
CONFIG_PACKAGE_coreutils=y
CONFIG_PACKAGE_coreutils-sort=y
CONFIG_PACKAGE_dawn=y
CONFIG_PACKAGE_ddns-scripts=y
CONFIG_PACKAGE_ddns-scripts-services=y
CONFIG_PACKAGE_etherwake=y
CONFIG_PACKAGE_grep=y
CONFIG_PACKAGE_iperf3=y
CONFIG_PACKAGE_ipset=y
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
CONFIG_PACKAGE_iptables-mod-extra=y
CONFIG_PACKAGE_iptables-mod-ipopt=y
CONFIG_PACKAGE_iptables-mod-physdev=y
CONFIG_PACKAGE_kmod=y
CONFIG_PACKAGE_kmod-br-netfilter=y
CONFIG_PACKAGE_kmod-crypto-kpp=y
CONFIG_PACKAGE_kmod-crypto-lib-blake2s=y
CONFIG_PACKAGE_kmod-crypto-lib-chacha20=y
CONFIG_PACKAGE_kmod-crypto-lib-chacha20poly1305=y
CONFIG_PACKAGE_kmod-crypto-lib-curve25519=y
CONFIG_PACKAGE_kmod-crypto-lib-poly1305=y
CONFIG_PACKAGE_kmod-ifb=y
CONFIG_PACKAGE_kmod-ipt-conntrack-extra=y
CONFIG_PACKAGE_kmod-ipt-extra=y
CONFIG_PACKAGE_kmod-ipt-ipopt=y
CONFIG_PACKAGE_kmod-ipt-ipset=y
CONFIG_PACKAGE_kmod-ipt-physdev=y
CONFIG_PACKAGE_kmod-ipt-raw=y
CONFIG_PACKAGE_kmod-nf-conntrack-netlink=y
CONFIG_PACKAGE_kmod-nfnetlink=y
CONFIG_PACKAGE_kmod-qca-nss-drv=y
CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe=y
CONFIG_PACKAGE_kmod-qca-nss-ecm=y
CONFIG_PACKAGE_kmod-sched-connmark=y
CONFIG_PACKAGE_kmod-sched-core=y
CONFIG_PACKAGE_kmod-udptunnel4=y
CONFIG_PACKAGE_kmod-udptunnel6=y
CONFIG_PACKAGE_kmod-wireguard=y
CONFIG_PACKAGE_less=y
CONFIG_PACKAGE_libbz2=y
CONFIG_PACKAGE_libcap=y
CONFIG_PACKAGE_libcap-ng=y
CONFIG_PACKAGE_libgcrypt=y
CONFIG_PACKAGE_libgpg-error=y
CONFIG_PACKAGE_libipset=y
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_libkmod=y
CONFIG_PACKAGE_libltdl=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_liblzma=y
CONFIG_PACKAGE_libmnl=y
CONFIG_PACKAGE_libncurses=y
CONFIG_PACKAGE_libnetfilter-conntrack=y
CONFIG_PACKAGE_libnfnetlink=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libopenssl-conf=y
CONFIG_PACKAGE_libpci=y
CONFIG_PACKAGE_libpcre=y
CONFIG_PACKAGE_libpopt=y
CONFIG_PACKAGE_libreadline=y
CONFIG_PACKAGE_librrd1=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libtirpc=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_libuuid=y
CONFIG_PACKAGE_libuv=y
CONFIG_PACKAGE_libwebsockets-full=y
CONFIG_PACKAGE_libzstd=y
CONFIG_PACKAGE_logrotate=y
CONFIG_PACKAGE_lsof=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-acme=y
CONFIG_PACKAGE_luci-app-adblock=y
CONFIG_PACKAGE_luci-app-commands=y
CONFIG_PACKAGE_luci-app-dawn=y
CONFIG_PACKAGE_luci-app-ddns=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-ledtrig-rssi=y
CONFIG_PACKAGE_luci-app-ledtrig-switch=y
CONFIG_PACKAGE_luci-app-openvpn=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-app-qos=y
CONFIG_PACKAGE_luci-app-statistics=y
CONFIG_PACKAGE_luci-app-ttyd=y
CONFIG_PACKAGE_luci-app-upnp=y
CONFIG_PACKAGE_luci-app-vpnbypass=y
CONFIG_PACKAGE_luci-app-watchcat=y
CONFIG_PACKAGE_luci-app-wireguard=y
CONFIG_PACKAGE_luci-app-wol=y
CONFIG_PACKAGE_luci-base=y
CONFIG_PACKAGE_luci-compat=y
CONFIG_PACKAGE_luci-lib-base=y
CONFIG_PACKAGE_luci-lib-ip=y
CONFIG_PACKAGE_luci-lib-ipkg=y
CONFIG_PACKAGE_luci-lib-json=y
CONFIG_PACKAGE_luci-lib-jsonc=y
CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-mod-dashboard=y
CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-proto-wireguard=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
CONFIG_PACKAGE_miniupnpd=y
CONFIG_PACKAGE_more=y
CONFIG_PACKAGE_moreutils=y
CONFIG_PACKAGE_nano=y
CONFIG_PACKAGE_nss-firmware-ipq8074=y
CONFIG_PACKAGE_openssl-util=y
CONFIG_PACKAGE_pciids=y
CONFIG_PACKAGE_pciutils=y
CONFIG_PACKAGE_perl=y
CONFIG_PACKAGE_perlbase-base=y
CONFIG_PACKAGE_perlbase-bytes=y
CONFIG_PACKAGE_perlbase-class=y
CONFIG_PACKAGE_perlbase-config=y
CONFIG_PACKAGE_perlbase-cwd=y
CONFIG_PACKAGE_perlbase-errno=y
CONFIG_PACKAGE_perlbase-essential=y
CONFIG_PACKAGE_perlbase-fcntl=y
CONFIG_PACKAGE_perlbase-file=y
CONFIG_PACKAGE_perlbase-filehandle=y
CONFIG_PACKAGE_perlbase-getopt=y
CONFIG_PACKAGE_perlbase-i18n=y
CONFIG_PACKAGE_perlbase-integer=y
CONFIG_PACKAGE_perlbase-io=y
CONFIG_PACKAGE_perlbase-ipc=y
CONFIG_PACKAGE_perlbase-list=y
CONFIG_PACKAGE_perlbase-locale=y
CONFIG_PACKAGE_perlbase-params=y
CONFIG_PACKAGE_perlbase-posix=y
CONFIG_PACKAGE_perlbase-re=y
CONFIG_PACKAGE_perlbase-scalar=y
CONFIG_PACKAGE_perlbase-selectsaver=y
CONFIG_PACKAGE_perlbase-selfloader=y
CONFIG_PACKAGE_perlbase-socket=y
CONFIG_PACKAGE_perlbase-symbol=y
CONFIG_PACKAGE_perlbase-text=y
CONFIG_PACKAGE_perlbase-tie=y
CONFIG_PACKAGE_perlbase-unicore=y
CONFIG_PACKAGE_perlbase-utf8=y
CONFIG_PACKAGE_perlbase-xsloader=y
CONFIG_PACKAGE_qos-scripts=y
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-file=y
CONFIG_PACKAGE_rpcd-mod-iwinfo=y
CONFIG_PACKAGE_rpcd-mod-luci=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_rrdtool1=y
CONFIG_PACKAGE_rssileds=y
CONFIG_PACKAGE_sed=y
CONFIG_PACKAGE_socat=y
CONFIG_PACKAGE_tar=y
CONFIG_PACKAGE_tc-mod-iptables=y
CONFIG_PACKAGE_tc-tiny=y
CONFIG_PACKAGE_terminfo=y
CONFIG_PACKAGE_tree=y
CONFIG_PACKAGE_ttyd=y
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y
CONFIG_PACKAGE_umdns=y
CONFIG_PACKAGE_vpnbypass=y
CONFIG_PACKAGE_watchcat=y
CONFIG_PACKAGE_wget-ssl=y
CONFIG_PACKAGE_whereis=y
CONFIG_PACKAGE_wireguard-tools=y
CONFIG_PACKAGE_xz=y
CONFIG_PACKAGE_xz-utils=y
CONFIG_PACKAGE_zlib=y
CONFIG_PERL_NOCOMMENT=y
CONFIG_SRC_TREE_OVERRIDE=y
CONFIG_ZSTD_OPTIMIZE_O3=y

Hope this helps some people out

16 Likes