|
1 | | - |
| 1 | +# openwrt-redmi-ax3000 |
| 2 | + |
| 3 | +`Openwrt` for `Redmi AX3000` / `Xiaomi CR8806` / `Xiaomi CR8808` / `Xiaomi CR8809` |
| 4 | + |
| 5 | +| Device | Boot | Switch | CPU Ethernet | NSS NAT | 2.4G WiFi | 5G WiFi | |
| 6 | +| :-: | :-: | :-: | :-: | :-: | :-: | :-: | |
| 7 | +| Redmi AX3000 | ❓ No test | |
| 8 | +| Xiaomi CR8806 | ✔️ | ✔️ | ✔️ | ✔️¹ | ⚠️ Unstable | ✔️¹² | |
| 9 | +| Xiaomi CR8808 | ✔️ | ✔️ | ✔️ | ✔️¹ | ⚠️ Unstable | ✔️¹² | |
| 10 | +| Xiaomi CR8809 | ❓ No test | |
| 11 | +> NOTE¹: For full speed NAT, you need to enable `qca-nss-ecm`, which will make Wifi `uplink` slower. |
| 12 | +
|
| 13 | +> NOTE²: For 160MHz, `Country Code` and `Width` need to be set correctly. And wait 1 minute for radar detection, then the WiFi will be appeareed. |
| 14 | +> |
| 15 | +> ``` |
| 16 | +> uci -q batch <<-EOF |
| 17 | +> wireless.radio1.country='CN' |
| 18 | +> wireless.radio1.channel='64' |
| 19 | +> EOF |
| 20 | +> ``` |
| 21 | +
|
| 22 | +## How to build |
| 23 | + |
| 24 | +OS: `Ubuntu 20.04 (focal)` |
| 25 | + |
| 26 | +```bash |
| 27 | +# Install dependencies |
| 28 | +sudo add-apt-repository ppa:npalix/coccinelle |
| 29 | +sudo apt update |
| 30 | +sudo apt install build-essential clang flex g++ gawk gcc-multilib gettext \ |
| 31 | + git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev \ |
| 32 | + coccinelle |
| 33 | + |
| 34 | +# Clone this repo |
| 35 | +git clone https://github.com/hzyitc/openwrt-redmi-ax3000 |
| 36 | +cd openwrt-redmi-ax3000 |
| 37 | + |
| 38 | +# Update and install feeds |
| 39 | +./scripts/feeds update -a |
| 40 | +./scripts/feeds install -a |
| 41 | + |
| 42 | +# Configure |
| 43 | +make menuconfig |
| 44 | + |
| 45 | +# Download |
| 46 | +make -j16 download |
| 47 | + |
| 48 | +# Build |
| 49 | +make -j$(nproc) |
| 50 | +``` |
2 | 51 |
|
3 | | -OpenWrt Project is a Linux operating system targeting embedded devices. Instead |
4 | | -of trying to create a single, static firmware, OpenWrt provides a fully |
5 | | -writable filesystem with package management. This frees you from the |
6 | | -application selection and configuration provided by the vendor and allows you |
7 | | -to customize the device through the use of packages to suit any application. |
8 | | -For developers, OpenWrt is the framework to build an application without having |
9 | | -to build a complete firmware around it; for users this means the ability for |
10 | | -full customization, to use the device in ways never envisioned. |
| 52 | +## How to install |
11 | 53 |
|
12 | | -Sunshine! |
| 54 | +### Get `UART` access |
13 | 55 |
|
14 | | -## Development |
| 56 | +> Input from `UART` will be allowed after a successful `TFTP recovery`. |
15 | 57 |
|
16 | | -To build your own firmware you need a GNU/Linux, BSD or MacOSX system (case |
17 | | -sensitive filesystem required). Cygwin is unsupported because of the lack of a |
18 | | -case sensitive file system. |
| 58 | +1. Connect `UART` and `LAN`. |
19 | 59 |
|
20 | | -### Requirements |
| 60 | +2. Download the vendor firmware: |
21 | 61 |
|
22 | | -You need the following tools to compile OpenWrt, the package names vary between |
23 | | -distributions. A complete list with distribution specific packages is found in |
24 | | -the [Build System Setup](https://openwrt.org/docs/guide-developer/build-system/install-buildsystem) |
25 | | -documentation. |
| 62 | + Offical website: https://www.miwifi.com/miwifi_download.html |
26 | 63 |
|
27 | | -``` |
28 | | -gcc binutils bzip2 flex python3 perl make find grep diff unzip gawk getopt |
29 | | -subversion libz-dev libc-dev rsync which |
30 | | -``` |
| 64 | + | Device | URL | |
| 65 | + | :-: | :-: | |
| 66 | + | Redmi AX3000 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/ra81/miwifi_ra81_firmware_1dd69c_1.0.33.bin | |
| 67 | + | Xiaomi CR8806 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8806/miwifi_cr8806_firmware_fe70b_6.2.14.bin | |
| 68 | + | Xiaomi CR8808 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8808/miwifi_cr8808_firmware_9d216_6.2.11.bin | |
| 69 | + | Xiaomi CR8809 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8809/miwifi_cr8809_firmware_b814a_6.2.102.bin | |
| 70 | + |
| 71 | +3. Use [`MIWIFIRepairTool`](https://bigota.miwifi.com/xiaoqiang/tools/MIWIFIRepairTool.x86.zip) to recover the device's firmware. |
| 72 | + |
| 73 | + Offical tutorial: https://www.xiaomi.cn/post/19134127 |
| 74 | + |
| 75 | + > This tool simply does `TFTP recovery`. You can use other `DHCP` and `TFTP` server as well. |
| 76 | + > |
| 77 | + > Here are some useful links: |
| 78 | + > |
| 79 | + >> https://forum.openwrt.org/t/adding-openwrt-support-for-xiaomi-redmi-router-ax6s-xiaomi-router-ax3200/111085/513 |
| 80 | + >> |
| 81 | + >> https://github.com/mikeeq/xiaomi_ax3200_openwrt#uart-flash |
| 82 | + >> |
| 83 | + >> https://openwrt.org/inbox/toh/xiaomi/xiaomi_ax3600#tftp_recovery |
31 | 84 |
|
32 | | -### Quickstart |
| 85 | +4. Hold the `reset` button and reboot the router until the `system` LED blink. |
33 | 86 |
|
34 | | -1. Run `./scripts/feeds update -a` to obtain all the latest package definitions |
35 | | - defined in feeds.conf / feeds.conf.default |
| 87 | +5. Wait until the firmware being flashed. |
36 | 88 |
|
37 | | -2. Run `./scripts/feeds install -a` to install symlinks for all obtained |
38 | | - packages into package/feeds/ |
| 89 | +6. Unplug then plug back in the power. |
39 | 90 |
|
40 | | -3. Run `make menuconfig` to select your preferred configuration for the |
41 | | - toolchain, target system & firmware packages. |
| 91 | +7. Send any key stroke to `UART` to interrupt the `U-boot`. |
42 | 92 |
|
43 | | -4. Run `make` to build your firmware. This will download all sources, build the |
44 | | - cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen |
45 | | - applications for your target system. |
| 93 | +8. Run the following command inside `U-boot`: |
46 | 94 |
|
47 | | -### Related Repositories |
| 95 | + ```shell |
| 96 | + setenv boot_wait on |
| 97 | + setenv uart_en 1 |
| 98 | + saveenv |
| 99 | + ``` |
48 | 100 |
|
49 | | -The main repository uses multiple sub-repositories to manage packages of |
50 | | -different categories. All packages are installed via the OpenWrt package |
51 | | -manager called `opkg`. If you're looking to develop the web interface or port |
52 | | -packages to OpenWrt, please find the fitting repository below. |
| 101 | +Now we have enabled `UART`. |
53 | 102 |
|
54 | | -* [LuCI Web Interface](https://github.com/openwrt/luci): Modern and modular |
55 | | - interface to control the device via a web browser. |
| 103 | +### Flash Openwrt |
56 | 104 |
|
57 | | -* [OpenWrt Packages](https://github.com/openwrt/packages): Community repository |
58 | | - of ported packages. |
| 105 | +#### a. Use `U-boot` to flash |
59 | 106 |
|
60 | | -* [OpenWrt Routing](https://github.com/openwrt/routing): Packages specifically |
61 | | - focused on (mesh) routing. |
| 107 | +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. |
62 | 108 |
|
63 | | -## Support Information |
| 109 | +Then run the following command inside `U-boot`: |
64 | 110 |
|
65 | | -For a list of supported devices see the [OpenWrt Hardware Database](https://openwrt.org/supported_devices) |
| 111 | +```shell |
| 112 | +# This router ip |
| 113 | +setenv ipaddr 192.168.1.2 |
| 114 | +# TFTP server ip |
| 115 | +setenv serverip 192.168.1.1 |
66 | 116 |
|
67 | | -### Documentation |
| 117 | +# Download the firmware to the RAM |
| 118 | +tftpboot openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 119 | + |
| 120 | +# Flash it as system 2 |
| 121 | +flash rootfs_1 |
| 122 | +setenv flag_try_sys2_failed 0 |
| 123 | +setenv flag_boot_rootfs 1 |
| 124 | +setenv flag_last_success 1 |
| 125 | +saveenv |
| 126 | + |
| 127 | +# Flash it as system 1 |
| 128 | +# flash rootfs |
| 129 | +# setenv flag_try_sys1_failed 0 |
| 130 | +# setenv flag_boot_rootfs 0 |
| 131 | +# setenv flag_last_success 0 |
| 132 | +# saveenv |
| 133 | + |
| 134 | +# Reboot |
| 135 | +reset |
| 136 | +``` |
| 137 | + |
| 138 | +#### b. Use `miwifi` (the vendor firmware) to flash |
| 139 | + |
| 140 | +```bash |
| 141 | +cd /tmp |
| 142 | +wget https://github.com/hzyitc/openwrt-redmi-ax3000/releases/latest/download/openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 143 | + |
| 144 | +# Check your partition table |
| 145 | +# cat /proc/mtd |
| 146 | +[[ "$(grep '"rootfs"' /proc/mtd | cut -d':' -f1)" == "mtd18" ]] || exit |
| 147 | +[[ "$(grep '"rootfs_1"' /proc/mtd | cut -d':' -f1)" == "mtd19" ]] || exit |
| 148 | + |
| 149 | +# Detect the current system slot and flash into the other one |
| 150 | +# cat /proc/cmdline |
| 151 | +mtd="$(grep -oE 'ubi.mtd=[a-zA-Z0-9\-\_]*' /proc/cmdline | cut -d'=' -f2)" |
| 152 | +if [[ "$mtd" == "rootfs" ]]; then |
| 153 | + # Flash it as system 2 |
| 154 | + ubiformat /dev/mtd19 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 155 | + nvram set flag_try_sys2_failed=0 |
| 156 | + nvram set flag_boot_rootfs=1 |
| 157 | + nvram set flag_last_success=1 |
| 158 | + nvram commit |
| 159 | +else if [[ "$mtd" == "rootfs_1" ]]; then |
| 160 | + # Flash it as system 1 |
| 161 | + ubiformat /dev/mtd18 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi |
| 162 | + nvram set flag_try_sys1_failed=0 |
| 163 | + nvram set flag_boot_rootfs=0 |
| 164 | + nvram set flag_last_success=0 |
| 165 | + nvram commit |
| 166 | +fi |
| 167 | + |
| 168 | +# Reboot |
| 169 | +reboot |
| 170 | +``` |
68 | 171 |
|
69 | | -* [Quick Start Guide](https://openwrt.org/docs/guide-quick-start/start) |
70 | | -* [User Guide](https://openwrt.org/docs/guide-user/start) |
71 | | -* [Developer Documentation](https://openwrt.org/docs/guide-developer/start) |
72 | | -* [Technical Reference](https://openwrt.org/docs/techref/start) |
| 172 | +## Related links |
73 | 173 |
|
74 | | -### Support Community |
| 174 | +[`openwrt/openwrt`](https://github.com/openwrt/openwrt) - Openwrt official repository |
75 | 175 |
|
76 | | -* [Forum](https://forum.openwrt.org): For usage, projects, discussions and hardware advise. |
77 | | -* [Support Chat](https://webchat.oftc.net/#openwrt): Channel `#openwrt` on **oftc.net**. |
| 176 | +[`qsdk`](https://git.codelinaro.org/clo/qsdk) - QSDK official repository |
78 | 177 |
|
79 | | -### Developer Community |
| 178 | +[`quic/qca-sdk-nss-fw`](https://github.com/quic/qca-sdk-nss-fw) - NSS firmware |
80 | 179 |
|
81 | | -* [Bug Reports](https://bugs.openwrt.org): Report bugs in OpenWrt |
82 | | -* [Dev Mailing List](https://lists.openwrt.org/mailman/listinfo/openwrt-devel): Send patches |
83 | | -* [Dev Chat](https://webchat.oftc.net/#openwrt-devel): Channel `#openwrt-devel` on **oftc.net**. |
| 180 | +[`quic/upstream-wifi-fw`](https://github.com/quic/upstream-wifi-fw) - WiFi firmware |
84 | 181 |
|
85 | | -## License |
| 182 | +[`qca/qca-swiss-army-knife`](https://github.com/qca/qca-swiss-army-knife) - BDF tools |
86 | 183 |
|
87 | | -OpenWrt is licensed under GPL-2.0 |
| 184 | +[`Telecominfraproject/wlan-ap`](https://github.com/Telecominfraproject/wlan-ap) - another Openwrt which support `ipq50xx` |
0 commit comments