openwrt/target/linux
Mikhail Zhilkin f8b02130d2 ramips: add support for Beeline SmartBox Flash
Beeline SmartBox Flash is a wireless AC1300 (WiFi 5) router manufactured
by Arcadyan company.

Device specification
--------------------
SoC Type: MediaTek MT7621AT
RAM: 256 MiB, Winbond W632GU6NB
Flash: 128 MiB (NAND), Winbond W29N01HVSINF
Wireless 2.4 GHz (MT7615DN): b/g/n, 2x2
Wireless 5 GHz (MT7615DN): a/n/ac, 2x2
Ethernet: 3xGbE (WAN, LAN1, LAN2)
USB ports: 1xUSB3.0
Button: 1 (Reset/WPS)
LEDs: 1 RGB LED
Power: 12 VDC, 1.5 A
Connector type: Barrel
Bootloader: U-Boot (Ralink UBoot Version: 5.0.0.2)
OEM: Arcadyan WE42022

Installation
------------
1. Place *factory.trx on any web server (192.168.1.2 in this example)
2. Connect to the router using telnet shell (no password required)
3. Save MAC adresses to U-Boot environment:
   uboot_env --set --name eth2macaddr --value $(ifconfig | grep eth2 | \
    awk '{print $5}')
   uboot_env --set --name eth3macaddr --value $(ifconfig | grep eth3 | \
    awk '{print $5}')
   uboot_env --set --name ra0macaddr --value $(ifconfig | grep ra0 | \
    awk '{print $5}')
   uboot_env --set --name rax0macaddr --value $(ifconfig | grep rax0 | \
    awk '{print $5}')
4. Ensure that MACs were saved correctly:
   uboot_env --get --name eth2macaddr
   uboot_env --get --name eth3macaddr
   uboot_env --get --name ra0macaddr
   uboot_env --get --name rax0macaddr
5. Download and write the OpenWrt images:
   cd /tmp
   wget http://192.168.1.2/factory.trx
   mtd_write erase /dev/mtd4
   mtd_write write factory.trx /dev/mtd4
6. Set 1st boot partition and reboot:
   uboot_env --set --name bootpartition --value 0
   reboot

Back to Stock
-------------
1. Run in the OpenWrt shell:
   fw_setenv bootpartition 1
   reboot
2. Optional step. Upgrade the stock firmware with any version to
   overwrite the OpenWrt in Slot 1.

MAC addresses
-------------
+-----------+-------------------+----------------+
| Interface | MAC               | Source         |
+-----------+-------------------+----------------+
| label     | 30:xx:xx:51:xx:09 | No MACs was    |
| LAN       | 30:xx:xx:51:xx:09 | found on Flash |
| WAN       | 30:xx:xx:51:xx:06 | [1]            |
| WLAN_2g   | 30:xx:xx:51:xx:07 |                |
| WLAN_5g   | 32:xx:xx:41:xx:07 |                |
+-----------+-------------------+----------------+
[1]:
a. Label wasb't found neither in factory nor in other places.
b. MAC addresses are stored in encrypted partition "glbcfg". Encryption
   key hasn't known yet. To ensure the correct MACs in OpenWrt, a hack
   with saving of the MACs to u-boot-env during the installation was
   applied.
c. Default Ralink ethernet MAC address (00:0C:43:28:80:36) was found in
   "Factory" 0xfff0. It's the same for all Smartbox Flash devices. OEM
   firmware also uses this MAC when initialazes ethernet driver. In
   OpenWrt we use it only as internal GMAC (eth0), all other MACs are
   unique. Therefore, there is no any barriers to the operation of several
   Smartbox Flash devices even within the same broadcast domain.

Stock firmware image format
---------------------------
+--------------+---------------+----------------------------------------+
| Offset       | 1.0.15        | Description                            |
+==============+===============+========================================+
| 0x0          | 5d 43 6f 74   | TRX magic "]Cot"                       |
+--------------+---------------+----------------------------------------+
| 0x4          | 00 70 ff 00   | Length (reverse)                       |
+--------------+---------------+----------------------------------------+
|              |               | htonl(~crc) from 0xc ("flag_version")  |
| 0x8          | 72 b3 93 16   | to "Length"                            |
+--------------+---------------+----------------------------------------+
| 0xc          | 00 00 01 00   | Flags                                  |
+--------------+---------------+----------------------------------------+
|              |               | Offset (reverse) of Kernel partition   |
| 0x10         | 1c 00 00 00   | from the start of the header           |
+--------------+---------------+----------------------------------------+
|              |               | Offset (reverse) of RootFS partition   |
| 0x14         | 00 00 42 00   | from the start of the header           |
+--------------+---------------+----------------------------------------+
| 0x18         | 00 00 00 00   | Zeroes                                 |
+--------------+---------------+----------------------------------------+
| 0x1c         | 27 05 19 56 … | Kernel data + zero padding             |
+--------------+---------------+----------------------------------------+
|              |               | RootFS data (starting with "hsqs") +   |
| 0x420000     | 68 73 71 73 … | zero padding to "Length"               |
+--------------+---------------+----------------------------------------+
|              |               | Some signature data (format is         |
|              |               | unknown). Necessary for the fw         |
| "Lenght"     | 00 00 00 00 … | update via oem fw web interface.       |
+--------------+---------------+----------------------------------------+
| "Lenght" +   |               | TRX magic "HDR0". U-Boot is            |
| 0x10c        | 48 44 52 30   | checking it at every boot.             |
+--------------+---------------+----------------------------------------+
|              |               | 1.00:                                  |
|              |               |   Zero padding to ("Lenght" + 0x23000) |
|              |               | 1.0.12:                                |
|              |               |   Zero padding to ("Lenght" + 0x2a000) |
| "Lenght" +   |               | 1.0.13, 1.0.15, 1.0.16:                |
| 0x110        | 00 00 00 00   |   Zero padding to ("Lenght" + 0x10000) |
+--------------+---------------+----------------------------------------+

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2022-03-19 16:14:01 +01:00
..
apm821xx apm821xx: WNDR4700: use upstream tc654 cooling devices 2022-02-19 19:34:18 +01:00
archs38 kernel: 5.10: remove CONFIG_DEVTMPFS{,_MOUNT} from kconfigs 2022-03-01 22:57:40 +00:00
armvirt kernel: 5.10: consolidate mac80211 crypto options 2021-12-17 16:16:34 +01:00
at91 kernel: bump 5.10 to 5.10.106 2022-03-19 16:13:58 +01:00
ath25 ath25: drop Linux 5.4 support 2022-02-17 11:08:58 +01:00
ath79 ath79: improve support for GL.iNet GL-XE300 2022-03-17 21:55:10 +01:00
bcm27xx kernel: bump 5.10 to 5.10.106 2022-03-19 16:13:58 +01:00
bcm47xx bcm47xx: switch to kernel 5.10 2021-11-08 15:56:39 +01:00
bcm53xx kernel: bump 5.10 to 5.10.104 2022-03-13 19:24:13 +01:00
bcm63xx bcm63xx: switch to Kernel 5.10 2022-02-27 14:41:28 +01:00
bcm4908 bcm4908: include U-Boot DTB files for ASUS GT-AX6000 & Netgear RAX220 2022-03-15 18:43:42 +01:00
bmips kernel: 5.10: consolidate mac80211 crypto options 2021-12-17 16:16:34 +01:00
gemini kernel: bump 5.10 to 5.10.94 2022-02-01 23:34:07 +00:00
generic kernel: bump 5.10 to 5.10.106 2022-03-19 16:13:58 +01:00
imx imx: fix USB support 2022-03-11 00:04:05 +01:00
ipq40xx kernel: 5.10: allocate last level PTEs in high memory 2022-03-01 22:57:34 +00:00
ipq806x ipq806x: fix TP-Link Archer VR2600v bootlooping 2022-03-16 20:48:01 +01:00
kirkwood target/linux: replace egrep with grep -E 2022-02-07 00:03:27 +01:00
lantiq lantiq: fritz7362sl: add partition subnode for SPI flash 2022-03-16 20:48:01 +01:00
layerscape kernel: 5.10: remove CONFIG_DEVTMPFS{,_MOUNT} from kconfigs 2022-03-01 22:57:40 +00:00
malta kernel: 5.10: consolidate mac80211 crypto options 2021-12-17 16:16:34 +01:00
mediatek kernel: move parser_trx patches of custom magic to generic 2022-03-06 20:40:07 +01:00
mpc85xx mpc85xx: fix missing kernel config symbol and DTS whitespace issue 2022-03-17 08:05:03 +01:00
mvebu kernel: 5.10: allocate last level PTEs in high memory 2022-03-01 22:57:34 +00:00
mxs kernel: 5.10: consolidate mac80211 crypto options 2021-12-17 16:16:34 +01:00
octeon octeon: switch to Kernel 5.10 2022-02-11 14:24:01 +01:00
octeontx octeontx: switch to 5.10 Kernel 2022-02-05 14:39:20 +01:00
omap omap: make use of 'rootfs-part' feature 2022-01-23 19:48:20 +00:00
oxnas kernel: 5.10: remove CONFIG_DEVTMPFS{,_MOUNT} from kconfigs 2022-03-01 22:57:40 +00:00
pistachio kernel: bump 5.10 to 5.10.95 2022-02-01 23:34:07 +00:00
qoriq qoriq: enable I2C in target kernel config 2022-03-16 01:48:24 +02:00
ramips ramips: add support for Beeline SmartBox Flash 2022-03-19 16:14:01 +01:00
realtek kernel: bump 5.10 to 5.10.106 2022-03-19 16:13:58 +01:00
rockchip kernel: include CONFIG_KEXEC_SIG in configs 2022-03-15 08:33:45 +01:00
sunxi kernel: bump 5.10 to 5.10.101 2022-03-01 21:38:36 +01:00
tegra kernel: 5.10: consolidate mac80211 crypto options 2021-12-17 16:16:34 +01:00
uml uml: make use of 'rootfs-part' feature 2022-01-23 19:48:31 +00:00
x86 x86: legacy: enable pata_sis driver 2022-03-10 23:31:05 +01:00
zynq kernel: 5.10: allocate last level PTEs in high memory 2022-03-01 22:57:34 +00:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-10 15:47:18 +01:00