openwrt/target/linux
Evgeniy Isaev 6c148116f7 ath79: add support for Xiaomi AIoT Router AC2350
Device specifications
* SoC: QCA9563 @ 775MHz (MIPS 74Kc)
* RAM: 128MiB DDR2
* Flash: 16MiB SPI-NOR (EN25QH128)
* Wireless 2.4GHz (SoC): b/g/n, 3x3
* Wireless 5Ghz (QCA9988): a/n/ac, 4x4 MU-MIMO
* IoT Wireless 2.4GHz (QCA6006): currently unusable
* Ethernet (AR8327): 3 LAN × 1GbE, 1 WAN × 1GbE
* LEDs: Internet (blue/orange), System (blue/orange)
* Buttons: Reset
* UART: through-hole on PCB ([VCC 3.3v](RX)(GND)(TX) 115200, 8n1)
* Power: 12VDC, 1,5A

MAC addresses map (like in OEM firmware)
  art@0x0     88:C3:97:*:57  wan/label
  art@0x1002  88:C3:97:*:2D  lan/wlan2g
  art@0x5006  88:C3:97:*:2C  wlan5g

Obtain SSH Access
1. Download and flash the firmware version 1.3.8 (China).
2. Login to the router web interface and get the value of `stok=` from the
   URL
3. Open a new tab and go to the following URL (replace <STOK> with the stok
   value gained above; line breaks are only for easier handling, please put
   together all four lines into a single URL without any spaces):
     http://192.168.31.1/cgi-bin/luci/;stok=<STOK>/api/misystem/set_config_iotdev
       ?bssid=any&user_id=any&ssid=-h%0Anvram%20set%20ssh_en%3D1%0Anvram%20commit
       %0Ased%20-i%20%27s%2Fchannel%3D.%2A%2Fchannel%3D%5C%5C%22debug%5C%5C%22%2F
       g%27%20%2Fetc%2Finit.d%2Fdropbear%0A%2Fetc%2Finit.d%2Fdropbear%20start%0A
4. Wait 30-60 seconds (this is the time required to generate keys for the
   SSH server on the router).

Create Full Backup
1. Obtain SSH Access.
2. Create backup of all flash (on router):
    dd if=/dev/mtd0 of=/tmp/ALL.backup
3. Copy backup to PC (on PC):
    scp root@192.168.31.1:/tmp/ALL.backup ./
Tip: backup of the original firmware, taken three times, increases the
chances of recovery :)

Calculate The Password
* Locally using shell (replace "12345/E0QM98765" with your router's serial
  number):
  On Linux
    printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \
    md5sum - | head -c8 && echo
  On macOS
    printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | \
    md5 | head -c8
* Locally using python script (replace "12345/E0QM98765" with your
  router's serial number):
    wget https://raw.githubusercontent.com/eisaev/ax3600-files/master/scripts/calc_passwd.py
    python3.7 -c 'from calc_passwd import calc_passwd; print(calc_passwd("12345/E0QM98765"))'
* Online
    https://www.oxygen7.cn/miwifi/

Debricking (lite)
If you have a healthy bootloader, you can use recovery via TFTP using
programs like TinyPXE on Windows or dnsmasq on Linux. To switch the router
to TFTP recovery mode, hold down the reset button, connect the power
supply, and release the button after about 10 seconds. The router must be
connected directly to the PC via the LAN port.

Debricking
You will need a full dump of your flash, a CH341 programmer, and a clip
for in-circuit programming.

Install OpenWRT
1. Obtain SSH Access.
2. Create script (on router):
    echo '#!/bin/sh' > /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    echo '. /bin/boardupgrade.sh' >> /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    echo 'board_prepare_upgrade' >> /tmp/flash_fw.sh
    echo 'mtd erase rootfs_data' >> /tmp/flash_fw.sh
    echo 'mtd write /tmp/openwrt.bin firmware' >> /tmp/flash_fw.sh
    echo 'sleep 3' >> /tmp/flash_fw.sh
    echo 'reboot' >> /tmp/flash_fw.sh
    echo >> /tmp/flash_fw.sh
    chmod +x /tmp/flash_fw.sh
3. Copy `openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin`
   to the router (on PC):
    scp openwrt-ath79-generic-xiaomi_aiot-ac2350-squashfs-sysupgrade.bin \
    root@192.168.31.1:/tmp/openwrt.bin
4. Flash OpenWRT (on router):
    /bin/ash /tmp/flash_fw.sh &
5. SSH connection will be interrupted - this is normal.
6. Wait for the indicator to turn blue.

Signed-off-by: Evgeniy Isaev <isaev.evgeniy@gmail.com>
[improve commit message formatting slightly]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-07-05 00:28:04 +02:00
..
apm821xx apm821xx: move CONFIG_REGULATOR to target config 2021-06-13 11:32:49 +02:00
arc770 treewide: do not quote compatible in shell scripts 2021-06-06 19:17:47 +02:00
archs38 treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
armvirt treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
at91 kernel: move some drm symbols to generic config 2021-06-13 23:30:10 +02:00
ath25 kernel: Activate FORTIFY_SOURCE for MIPS kernel 5.4 2021-04-30 23:51:19 +02:00
ath79 ath79: add support for Xiaomi AIoT Router AC2350 2021-07-05 00:28:04 +02:00
bcm27xx kernel: bump 5.4 to 5.4.128 2021-06-26 12:49:15 +02:00
bcm47xx bcm47xx: make WGT634U NVRAM patch apply again 2021-03-12 21:09:11 +01:00
bcm53xx kernel: bump 5.4 to 5.4.118 2021-05-23 15:09:06 +02:00
bcm63xx bcm63xx: drop USB LEDs for Technicolor TG582N / ADB P.DG A4001N 2021-06-05 23:39:14 +02:00
bcm4908 bcm4908: fix Ethernet broken state after interface restart 2021-06-22 08:06:13 +02:00
bmips bmips: remove duplicated brcmnand patch 2021-05-17 12:25:34 +02:00
gemini base-files: generate network config with "device" options 2021-05-27 10:58:49 +02:00
generic generic: at803x: mask 1000 Base-X link mode 2021-06-27 13:19:20 +02:00
imx6 imx6: image: drop BOOT_SCRIPT and fix DEVICE_NAME 2021-05-26 14:12:46 +02:00
ipq40xx ipq40xx: add missing case closing symbol 2021-06-28 01:06:08 +02:00
ipq806x ipq806x: fix dedicated cpufreq driver 2021-06-30 23:14:43 +02:00
ipq807x treewide: remove redundant ubifs kconfig symbols 2021-04-21 10:31:07 +01:00
kirkwood treewide: do not quote compatible in shell scripts 2021-06-06 19:17:47 +02:00
lantiq ltq-deu: Mark lantiq DEU broken 2021-06-30 23:14:43 +02:00
layerscape kernel: bump 5.4 to 5.4.128 2021-06-26 12:49:15 +02:00
malta treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
mediatek kernel: bump 5.4 to 5.4.126 2021-06-26 12:49:15 +02:00
mpc85xx treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
mvebu kernel: bump 5.4 to 5.4.128 2021-06-26 12:49:15 +02:00
mxs treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
octeon octeon: use shared function for platform_copy_config() 2021-05-17 01:01:32 +02:00
octeontx kernel: bump 5.4 to 5.4.128 2021-06-26 12:49:15 +02:00
omap kernel: move some drm symbols to generic config 2021-06-13 23:30:10 +02:00
oxnas treewide: remove redundant ubifs kconfig symbols 2021-04-21 10:31:07 +01:00
pistachio treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
ramips ramips: add support for Tenbay T-MB5EU-V01 2021-06-27 21:40:27 +02:00
realtek realtek: Fix failsafe mode 2021-06-22 23:23:00 +02:00
rockchip kernel: bump 5.10 to 5.10.43 2021-06-14 01:36:36 +02:00
sunxi linux-firmware: update to version 20210315 and trim down broadcom FW 2021-06-06 00:26:13 +02:00
tegra kernel: move some drm symbols to generic config 2021-06-13 23:30:10 +02:00
uml treewide: switch the timer frequency to 100 Hz 2021-04-21 10:31:10 +01:00
x86 x86: add upgrade support to diag.sh 2021-06-10 10:34:44 +02:00
zynq kernel: move some drm symbols to generic config 2021-06-13 23:30:10 +02:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00