forked from openwrt/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
156 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,183 @@ | ||
![OpenWrt logo](include/logo.png) | ||
# openwrt-redmi-ax3000 | ||
|
||
`Openwrt` for `Redmi AX3000` / `Xiaomi CR8806` / `Xiaomi CR8808` / `Xiaomi CR8809` | ||
|
||
| Device | Boot | Switch | CPU Ethernet | NSS NAT | 2.4G WiFi | 5G WiFi | | ||
| :-: | :-: | :-: | :-: | :-: | :-: | :-: | | ||
| Redmi AX3000 | ❓ No test | | ||
| Xiaomi CR8806 | ✔️ | ✔️ | ✔️ | ✔️¹ | ⚠️ Unstable | ✔️¹ | | ||
| Xiaomi CR8808 | ✔️ | ✔️ | ✔️ | ✔️¹ | ⚠️ Unstable | ✔️¹ | | ||
| Xiaomi CR8809 | ❓ No test | | ||
> 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. | ||
> | ||
> ``` | ||
> uci -q batch <<-EOF | ||
> wireless.radio1.country='CN' | ||
> wireless.radio1.htmode='HE160' | ||
> wireless.radio1.channel='64' | ||
> EOF | ||
> ``` | ||
## How to build | ||
|
||
OS: `Ubuntu 20.04 (focal)` | ||
|
||
```bash | ||
# Install dependencies | ||
sudo add-apt-repository ppa:npalix/coccinelle | ||
sudo apt update | ||
sudo apt install build-essential clang flex g++ gawk gcc-multilib gettext \ | ||
git libncurses5-dev libssl-dev python3-distutils rsync unzip zlib1g-dev \ | ||
coccinelle | ||
|
||
# Clone this repo | ||
git clone https://github.com/hzyitc/openwrt-redmi-ax3000 | ||
cd openwrt-redmi-ax3000 | ||
|
||
# Update and install feeds | ||
./scripts/feeds update -a | ||
./scripts/feeds install -a | ||
|
||
# Configure | ||
make menuconfig | ||
|
||
# Download | ||
make -j16 download | ||
|
||
# Build | ||
make -j$(nproc) | ||
``` | ||
|
||
OpenWrt Project is a Linux operating system targeting embedded devices. Instead | ||
of trying to create a single, static firmware, OpenWrt provides a fully | ||
writable filesystem with package management. This frees you from the | ||
application selection and configuration provided by the vendor and allows you | ||
to customize the device through the use of packages to suit any application. | ||
For developers, OpenWrt is the framework to build an application without having | ||
to build a complete firmware around it; for users this means the ability for | ||
full customization, to use the device in ways never envisioned. | ||
## How to install | ||
|
||
Sunshine! | ||
### Get `UART` access | ||
|
||
## Development | ||
> Input from `UART` will be allowed after a successful `TFTP recovery`. | ||
To build your own firmware you need a GNU/Linux, BSD or MacOSX system (case | ||
sensitive filesystem required). Cygwin is unsupported because of the lack of a | ||
case sensitive file system. | ||
1. Connect `UART` and `LAN`. | ||
|
||
### Requirements | ||
2. Download the vendor firmware: | ||
|
||
You need the following tools to compile OpenWrt, the package names vary between | ||
distributions. A complete list with distribution specific packages is found in | ||
the [Build System Setup](https://openwrt.org/docs/guide-developer/build-system/install-buildsystem) | ||
documentation. | ||
Offical website: https://www.miwifi.com/miwifi_download.html | ||
|
||
``` | ||
gcc binutils bzip2 flex python3 perl make find grep diff unzip gawk getopt | ||
subversion libz-dev libc-dev rsync which | ||
``` | ||
| Device | URL | | ||
| :-: | :-: | | ||
| Redmi AX3000 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/ra81/miwifi_ra81_firmware_1dd69c_1.0.33.bin | | ||
| Xiaomi CR8806 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8806/miwifi_cr8806_firmware_fe70b_6.2.14.bin | | ||
| Xiaomi CR8808 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8808/miwifi_cr8808_firmware_9d216_6.2.11.bin | | ||
| Xiaomi CR8809 | https://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/cr8809/miwifi_cr8809_firmware_b814a_6.2.102.bin | | ||
|
||
3. Use [`MIWIFIRepairTool`](https://bigota.miwifi.com/xiaoqiang/tools/MIWIFIRepairTool.x86.zip) to recover the device's firmware. | ||
|
||
Offical tutorial: https://www.xiaomi.cn/post/19134127 | ||
|
||
> This tool simply does `TFTP recovery`. You can use other `DHCP` and `TFTP` server as well. | ||
> | ||
> Here are some useful links: | ||
> | ||
>> https://forum.openwrt.org/t/adding-openwrt-support-for-xiaomi-redmi-router-ax6s-xiaomi-router-ax3200/111085/513 | ||
>> | ||
>> https://github.com/mikeeq/xiaomi_ax3200_openwrt#uart-flash | ||
>> | ||
>> https://openwrt.org/inbox/toh/xiaomi/xiaomi_ax3600#tftp_recovery | ||
|
||
### Quickstart | ||
4. Hold the `reset` button and reboot the router until the `system` LED blink. | ||
|
||
1. Run `./scripts/feeds update -a` to obtain all the latest package definitions | ||
defined in feeds.conf / feeds.conf.default | ||
5. Wait until the firmware being flashed. | ||
|
||
2. Run `./scripts/feeds install -a` to install symlinks for all obtained | ||
packages into package/feeds/ | ||
6. Unplug then plug back in the power. | ||
|
||
3. Run `make menuconfig` to select your preferred configuration for the | ||
toolchain, target system & firmware packages. | ||
7. Send any key stroke to `UART` to interrupt the `U-boot`. | ||
|
||
4. Run `make` to build your firmware. This will download all sources, build the | ||
cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen | ||
applications for your target system. | ||
8. Run the following command inside `U-boot`: | ||
|
||
### Related Repositories | ||
```shell | ||
setenv boot_wait on | ||
setenv uart_en 1 | ||
saveenv | ||
``` | ||
|
||
The main repository uses multiple sub-repositories to manage packages of | ||
different categories. All packages are installed via the OpenWrt package | ||
manager called `opkg`. If you're looking to develop the web interface or port | ||
packages to OpenWrt, please find the fitting repository below. | ||
Now we have enabled `UART`. | ||
|
||
* [LuCI Web Interface](https://github.com/openwrt/luci): Modern and modular | ||
interface to control the device via a web browser. | ||
### Flash Openwrt | ||
|
||
* [OpenWrt Packages](https://github.com/openwrt/packages): Community repository | ||
of ported packages. | ||
#### a. Use `U-boot` to flash | ||
|
||
* [OpenWrt Routing](https://github.com/openwrt/routing): Packages specifically | ||
focused on (mesh) routing. | ||
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. | ||
|
||
## Support Information | ||
Then run the following command inside `U-boot`: | ||
|
||
For a list of supported devices see the [OpenWrt Hardware Database](https://openwrt.org/supported_devices) | ||
```shell | ||
# This router ip | ||
setenv ipaddr 192.168.1.2 | ||
# TFTP server ip | ||
setenv serverip 192.168.1.1 | ||
|
||
### Documentation | ||
# Download the firmware to the RAM | ||
tftpboot openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi | ||
|
||
# Flash it as system 2 | ||
flash rootfs_1 | ||
setenv flag_try_sys2_failed 0 | ||
setenv flag_boot_rootfs 1 | ||
setenv flag_last_success 1 | ||
saveenv | ||
|
||
# Flash it as system 1 | ||
# flash rootfs | ||
# setenv flag_try_sys1_failed 0 | ||
# setenv flag_boot_rootfs 0 | ||
# setenv flag_last_success 0 | ||
# saveenv | ||
|
||
# Reboot | ||
reset | ||
``` | ||
|
||
#### b. Use `miwifi` (the vendor firmware) to flash | ||
|
||
```bash | ||
cd /tmp | ||
wget https://github.com/hzyitc/openwrt-redmi-ax3000/releases/latest/download/openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi | ||
|
||
# Check your partition table | ||
# cat /proc/mtd | ||
[[ "$(grep '"rootfs"' /proc/mtd | cut -d':' -f1)" == "mtd18" ]] || exit | ||
[[ "$(grep '"rootfs_1"' /proc/mtd | cut -d':' -f1)" == "mtd19" ]] || exit | ||
|
||
# Detect the current system slot and flash into the other one | ||
# cat /proc/cmdline | ||
mtd="$(grep -oE 'ubi.mtd=[a-zA-Z0-9\-\_]*' /proc/cmdline | cut -d'=' -f2)" | ||
if [[ "$mtd" == "rootfs" ]]; then | ||
# Flash it as system 2 | ||
ubiformat /dev/mtd19 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi | ||
nvram set flag_try_sys2_failed=0 | ||
nvram set flag_boot_rootfs=1 | ||
nvram set flag_last_success=1 | ||
nvram commit | ||
else if [[ "$mtd" == "rootfs_1" ]]; then | ||
# Flash it as system 1 | ||
ubiformat /dev/mtd18 -f openwrt-ipq50xx-arm-redmi_ax3000-squashfs-nand-factory.ubi | ||
nvram set flag_try_sys1_failed=0 | ||
nvram set flag_boot_rootfs=0 | ||
nvram set flag_last_success=0 | ||
nvram commit | ||
fi | ||
|
||
# Reboot | ||
reboot | ||
``` | ||
* [Quick Start Guide](https://openwrt.org/docs/guide-quick-start/start) | ||
* [User Guide](https://openwrt.org/docs/guide-user/start) | ||
* [Developer Documentation](https://openwrt.org/docs/guide-developer/start) | ||
* [Technical Reference](https://openwrt.org/docs/techref/start) | ||
## Related links | ||
### Support Community | ||
[`openwrt/openwrt`](https://github.com/openwrt/openwrt) - Openwrt official repository | ||
* [Forum](https://forum.openwrt.org): For usage, projects, discussions and hardware advise. | ||
* [Support Chat](https://webchat.oftc.net/#openwrt): Channel `#openwrt` on **oftc.net**. | ||
[`qsdk`](https://git.codelinaro.org/clo/qsdk) - QSDK official repository | ||
### Developer Community | ||
[`quic/qca-sdk-nss-fw`](https://github.com/quic/qca-sdk-nss-fw) - NSS firmware | ||
* [Bug Reports](https://bugs.openwrt.org): Report bugs in OpenWrt | ||
* [Dev Mailing List](https://lists.openwrt.org/mailman/listinfo/openwrt-devel): Send patches | ||
* [Dev Chat](https://webchat.oftc.net/#openwrt-devel): Channel `#openwrt-devel` on **oftc.net**. | ||
[`quic/upstream-wifi-fw`](https://github.com/quic/upstream-wifi-fw) - WiFi firmware | ||
## License | ||
[`qca/qca-swiss-army-knife`](https://github.com/qca/qca-swiss-army-knife) - BDF tools | ||
OpenWrt is licensed under GPL-2.0 | ||
[`Telecominfraproject/wlan-ap`](https://github.com/Telecominfraproject/wlan-ap) - another Openwrt which support `ipq50xx` |