|
| 1 | +# openwrt-redmi-ax3000 |
| 2 | + |
| 3 | +`Openwrt` for `Redmi AX3000` / `Xiaomi CR8806` / `Xiaomi CR8808` / `Xiaomi CR8809` |
| 4 | + |
| 5 | +**!!! NOTE: This is the main development branch which using mainline `Linux LTS 5.4` !!!** |
| 6 | + |
| 7 | +If you need more stable versions, please checkout the following branches which using QSDK kernel |
| 8 | +- [`ipq50xx-qsdk-kernel-5.4-openwrt-21.02-qsdk-11.5.05.841.1029`](https://github.com/hzyitc/openwrt-redmi-ax3000/tree/ipq50xx-qsdk-kernel-5.4-openwrt-21.02-qsdk-11.5.05.841.1029) |
| 9 | +- [`ipq50xx-qsdk-kernel-4.4-openwrt-21.02-qsdk-11.4.0.5.7418`](https://github.com/hzyitc/openwrt-redmi-ax3000/tree/ipq50xx-qsdk-kernel-4.4-openwrt-21.02-qsdk-11.4.0.5.7418) |
| 10 | + |
| 11 | +| Device | Boot | Switch | CPU Ethernet | NSS NAT | 2.4G WiFi | 5G WiFi | |
| 12 | +| :-: | :-: | :-: | :-: | :-: | :-: | :-: | |
| 13 | +| Redmi AX3000 <br /> Xiaomi CR880X <br /> (M81 version) | ✔️ | ✔️ | ✔️ | ❌ | ⚠️¹ | ✔️² | |
| 14 | +| Xiaomi CR880X <br /> (M79 version) | ✔️ | ✔️ | ✔️ | ❌ | ⚠️¹ | ✔️² | |
| 15 | +> |
| 16 | +> WARNING¹: Need to update BDF |
| 17 | +> |
| 18 | +> NOTE²: For 160MHz, `Country Code`, `Width` and `Channel` need to be set correctly. And wait 1 minute for radar detection, then the WiFi will be appeareed. |
| 19 | +> |
| 20 | +> ``` |
| 21 | +> uci -q batch <<-EOF |
| 22 | +> wireless.radio1.country='CN' |
| 23 | +> wireless.radio1.htmode='HE160' |
| 24 | +> wireless.radio1.channel='64' |
| 25 | +> EOF |
| 26 | +> ``` |
| 27 | +
|
| 28 | +## How to build |
| 29 | + |
| 30 | +OS: `Ubuntu 20.04 (focal)` |
| 31 | + |
| 32 | +```bash |
| 33 | +# Install dependencies |
| 34 | +sudo apt update |
| 35 | +sudo apt install build-essential clang flex g++ gawk gcc-multilib gettext \ |
| 36 | + git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev |
| 37 | + |
| 38 | +# Clone this repo |
| 39 | +git clone https://github.com/hzyitc/openwrt-redmi-ax3000 |
| 40 | +cd openwrt-redmi-ax3000 |
| 41 | + |
| 42 | +# Update and install feeds |
| 43 | +./scripts/feeds update -a |
| 44 | +./scripts/feeds install -a |
| 45 | + |
| 46 | +# Configure |
| 47 | +make menuconfig |
| 48 | + |
| 49 | +# Download |
| 50 | +make -j16 download |
| 51 | + |
| 52 | +# Build |
| 53 | +make -j$(nproc) |
| 54 | +``` |
| 55 | + |
| 56 | +## How to install |
| 57 | + |
| 58 | +### Get `UART` access |
| 59 | + |
| 60 | +> Input from `UART` will be allowed after a successful `TFTP recovery`. |
| 61 | +
|
| 62 | +1. Connect `UART` and `LAN`. |
| 63 | + |
| 64 | +2. Download the vendor firmware: |
| 65 | + |
| 66 | + Offical website: https://www.miwifi.com/miwifi_download.html |
| 67 | + |
| 68 | + | Device | URL | |
| 69 | + | :-: | :-: | |
| 70 | + | Redmi AX3000 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/ra81/miwifi_ra81_firmware_1dd69c_1.0.33.bin | |
| 71 | + | Xiaomi CR8806 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8806/miwifi_cr8806_firmware_fe70b_6.2.14.bin | |
| 72 | + | Xiaomi CR8808 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8808/miwifi_cr8808_firmware_9d216_6.2.11.bin | |
| 73 | + | Xiaomi CR8809 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8809/miwifi_cr8809_firmware_b814a_6.2.102.bin | |
| 74 | + |
| 75 | +3. Use [`MIWIFIRepairTool`](https://bigota.miwifi.com/xiaoqiang/tools/MIWIFIRepairTool.x86.zip) to recover the device's firmware. |
| 76 | + |
| 77 | + Offical tutorial: https://www.xiaomi.cn/post/19134127 |
| 78 | + |
| 79 | + > This tool simply does `TFTP recovery`. You can use other `DHCP` and `TFTP` server as well. |
| 80 | + > |
| 81 | + > Here are some useful links: |
| 82 | + > |
| 83 | + >> https://forum.openwrt.org/t/adding-openwrt-support-for-xiaomi-redmi-router-ax6s-xiaomi-router-ax3200/111085/513 |
| 84 | + >> |
| 85 | + >> https://github.com/mikeeq/xiaomi_ax3200_openwrt#uart-flash |
| 86 | + >> |
| 87 | + >> https://openwrt.org/inbox/toh/xiaomi/xiaomi_ax3600#tftp_recovery |
| 88 | + |
| 89 | +4. Hold the `reset` button and reboot the router until the `system` LED blink. |
| 90 | + |
| 91 | +5. Wait until the firmware being flashed. |
| 92 | + |
| 93 | +6. Unplug then plug back in the power. |
| 94 | + |
| 95 | +7. Send any key stroke to `UART` to interrupt the `U-boot`. |
| 96 | + |
| 97 | +8. Run the following command inside `U-boot`: |
| 98 | + |
| 99 | + ```shell |
| 100 | + setenv boot_wait on |
| 101 | + setenv uart_en 1 |
| 102 | + saveenv |
| 103 | + ``` |
| 104 | + |
| 105 | +Now we have enabled `UART`. |
| 106 | + |
| 107 | +### Flash Openwrt |
| 108 | + |
| 109 | +#### a. Use `U-boot` to flash |
| 110 | + |
| 111 | +Download [`openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi`](https://github.com/hzyitc/openwrt-redmi-ax3000/releases/latest/download/openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi) and put it into TFTP root. |
| 112 | + |
| 113 | +Then run the following command inside `U-boot`: |
| 114 | + |
| 115 | +```shell |
| 116 | +# This router ip |
| 117 | +setenv ipaddr 192.168.1.2 |
| 118 | +# TFTP server ip |
| 119 | +setenv serverip 192.168.1.1 |
| 120 | + |
| 121 | +# Download the firmware to the RAM |
| 122 | +tftpboot openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 123 | + |
| 124 | +# Flash it as system 2 |
| 125 | +flash rootfs_1 |
| 126 | +setenv flag_try_sys2_failed 0 |
| 127 | +setenv flag_boot_rootfs 1 |
| 128 | +setenv flag_last_success 1 |
| 129 | +saveenv |
| 130 | + |
| 131 | +# Flash it as system 1 |
| 132 | +# flash rootfs |
| 133 | +# setenv flag_try_sys1_failed 0 |
| 134 | +# setenv flag_boot_rootfs 0 |
| 135 | +# setenv flag_last_success 0 |
| 136 | +# saveenv |
| 137 | + |
| 138 | +# Reboot |
| 139 | +reset |
| 140 | +``` |
| 141 | + |
| 142 | +#### b. Use `miwifi` (the vendor firmware) to flash |
| 143 | + |
| 144 | +```bash |
| 145 | +cd /tmp |
| 146 | +wget https://github.com/hzyitc/openwrt-redmi-ax3000/releases/latest/download/openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 147 | + |
| 148 | +# Check your partition table |
| 149 | +# cat /proc/mtd |
| 150 | +[[ "$(grep '"rootfs"' /proc/mtd | cut -d':' -f1)" == "mtd18" ]] || exit |
| 151 | +[[ "$(grep '"rootfs_1"' /proc/mtd | cut -d':' -f1)" == "mtd19" ]] || exit |
| 152 | + |
| 153 | +# Detect the current system slot and flash into the other one |
| 154 | +# cat /proc/cmdline |
| 155 | +mtd="$(grep -oE 'ubi.mtd=[a-zA-Z0-9\-\_]*' /proc/cmdline | cut -d'=' -f2)" |
| 156 | +if [[ "$mtd" == "rootfs" ]]; then |
| 157 | + # Flash it as system 2 |
| 158 | + ubiformat /dev/mtd19 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 159 | + nvram set flag_try_sys2_failed=0 |
| 160 | + nvram set flag_boot_rootfs=1 |
| 161 | + nvram set flag_last_success=1 |
| 162 | + nvram commit |
| 163 | +else if [[ "$mtd" == "rootfs_1" ]]; then |
| 164 | + # Flash it as system 1 |
| 165 | + ubiformat /dev/mtd18 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 166 | + nvram set flag_try_sys1_failed=0 |
| 167 | + nvram set flag_boot_rootfs=0 |
| 168 | + nvram set flag_last_success=0 |
| 169 | + nvram commit |
| 170 | +fi |
| 171 | + |
| 172 | +# Reboot |
| 173 | +reboot |
| 174 | +``` |
| 175 | +
|
| 176 | +## Related links |
| 177 | +
|
| 178 | +[`openwrt/openwrt`](https://github.com/openwrt/openwrt) - Openwrt official repository |
| 179 | +
|
| 180 | +[`qsdk`](https://git.codelinaro.org/clo/qsdk) - QSDK official repository |
| 181 | +
|
| 182 | +[`quic/qca-sdk-nss-fw`](https://github.com/quic/qca-sdk-nss-fw) - NSS firmware |
| 183 | +
|
| 184 | +[`quic/upstream-wifi-fw`](https://github.com/quic/upstream-wifi-fw) - WiFi firmware |
| 185 | +
|
| 186 | +[`qca/qca-swiss-army-knife`](https://github.com/qca/qca-swiss-army-knife) - BDF tools |
| 187 | +
|
| 188 | +[`Telecominfraproject/wlan-ap`](https://github.com/Telecominfraproject/wlan-ap) - another Openwrt which support `ipq50xx` |
0 commit comments