mediatek: Add support for Acer Predator Connect W6x
Product name: Acer Predator Connect W6x
link: https://www.acer.com/us-en/predator/networking/wi-fi/predator-connect-w6x/pdp/FF.G2TTA.001
* Specifications:
SOC: MT7986AV
RAM: 1024MB
Flash: 256 MB SPI NAND
Ports: 4 LAN (1G) & 1 WAN (2.5G)
WIFI: MT7976GN + MT7976AN
LED: 1, ws2812b controller
* Installation via UART:
1. Configure TFTP server with IP 192.168.1.66. Copy `openwrt-mediatek-filogic-acer_predator-w6x-initramfs-kernel.bin` to TFTP root and rename to `predator.bin`
2. Interrupt boot by pressing 0 on startup or select `U-Boot Console` in U-Boot Boot Menu.
3. Run setenv `serverip 192.168.1.66; setenv ipaddr 192.168.1.1; tftpboot 0x46000000 predator.bin; fdt addr $(fdtcontroladdr); fdt rm /signature; bootm` in uboot console.
4. Wait for boot complete on Openwrt initramfs env.
** You can back up the MTD partitions at this point. Refer to Backup Instructions section.
5. On client PC, transfer `openwrt-mediatek-filogic-acer_predator-w6x-squashfs-sysupgrade.bin` to /tmp/ - `scp -O openwrt-mediatek-filogic-acer_predator-w6x-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/sysupgrade.bin`
6. On router, run sysupgrade - `sysupgrade -n /tmp/sysupgrade.bin`
Should now boot to Openwrt. Ensure it boots automatically to Openwrt by replugging the power.
* Backup Instructions:
Layout from stock firmware:
```
[ 0.968731] Creating 10 MTD partitions on "nmbm_spim_nand":
[ 0.974297] 0x000000000000-0x000000100000 : "BL2"
[ 0.979424] 0x000000100000-0x000000180000 : "u-boot-env"
[ 0.985032] 0x000000180000-0x000000380000 : "Factory"
[ 0.990379] 0x000000380000-0x000000580000 : "FIP"
[ 0.995378] 0x000000580000-0x000000600000 : "prod"
[ 1.000461] 0x000000600000-0x000000700000 : "dual"
[ 1.005527] 0x000000700000-0x000000800000 : "pot"
[ 1.010516] 0x000000800000-0x000006c00000 : "ubi"
[ 1.015626] 0x000006c00000-0x00000d000000 : "ubi1"
[ 1.020801] 0x00000d000000-0x00000d800000 : "storage"
```
Mapping in initramfs env:
```
dev: size erasesize name
mtd0:
00100000 00020000 "bl2"
mtd1:
00080000 00020000 "u-boot-env"
mtd2:
00200000 00020000 "factory"
mtd3:
00200000 00020000 "fip"
mtd4:
00020000 00020000 "prod"
mtd5:
00100000 00020000 "dual"
mtd6:
00100000 00020000 "pot"
mtd7:
06400000 00020000 "ubi"
mtd8:
06400000 00020000 "ubi1"
mtd9:
00800000 00020000 "storage"
```
1. While in openwrt initramfs environment, back up all the partitions by running the following:
```
cat /dev/mtd0 > /tmp/bl2.bin
cat /dev/mtd1 > /tmp/u-boot-env.bin
cat /dev/mtd2 > /tmp/factgory.bin
cat /dev/mtd3 > /tmp/fip.bin
cat /dev/mtd4 > /tmp/prod.bin
cat /dev/mtd5 > /tmp/dual.bin
cat /dev/mtd6 > /tmp/pot.bin
cat /dev/mtd7 > /tmp/ubi.bin
cat /dev/mtd8 > /tmp/ubi1.bin
cat /dev/mtd9 > /tmp/storage.bin
```
2. Transfer files to client PC for safekeeping. On client PC, run `scp -O root@192.168.1.1:/tmp/*.bin ./`
* Restore to Stock Firmware:
1. Boot to openwrt initramfs env.
2. Confirm layout matches as follows by running `cat /proc/mtd`. Ensure dev `mtd7` is named `ubi`:
```
dev: size erasesize name
mtd0:
00100000 00020000 "bl2"
mtd1:
00080000 00020000 "u-boot-env"
mtd2:
00200000 00020000 "factory"
mtd3:
00200000 00020000 "fip"
mtd4:
00020000 00020000 "prod"
mtd5:
00100000 00020000 "dual"
mtd6:
00100000 00020000 "pot"
mtd7:
06400000 00020000 "ubi"
mtd8:
06400000 00020000 "ubi1"
mtd9:
00800000 00020000 "storage"
```
3. Detach `ubi` partition - `ubidetach -p /dev/mtd7`
4. Transfer stock firmware's `ubi.bin` to router from client PC: `scp -O ubi.bin root@192.168.1.1/tmp/`
5. Format and replace with backup `ubiformat /dev/mtd7 -y -f /tmp/ubi.bin`
6. Reboot and you should now be back on stock firmware.
* LEDS:
LED color can be controlled by specifying values in GRB format in `/sys/class/leds/rgb:status/multi_intensity`. Default is `255 255 255` (white).
Example: `echo '75 0 130' > /sys/class/leds/rgb:status/multi_intensity`
LED brightness can be changed by specifying the value from 0-255 in /sys/class/leds/rgb:status/brightness. Default is `255` (full brightness).
Example: `echo 100 > /sys/class/leds/rgb:status/brightness`
For persistence across reboots, put the relevant command(s) in /etc/rc.local.
* Notes:
root access on stock firmware:
Before flashing openwrt, and while in openwrt initramfs env:
1. Mount /dev/ubi0_2: `mkdir /tmp/ubi0_2; mount -t ubifs /dev/ubi0_2 /tmp/ubi0_2`
2. Modify `/tmp/ubi0_2/upper/etc/passwd` and change line with `root:x:0:0...` to `root::0:0...`, remove the `x`.
3. Save and reboot.
4. You should now be able to log in with root and empty password while booted in stock firmware.
While on Openwrt, subsequent upgrades can be made by sysupgrade, or via Luci. UART should not be necessary unless you want to revert to stock firmeware.
Signed-off-by: Qing W <ses1er@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19754
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>