immortalwrt/target/linux
Mikhail Zhilkin a985eedd04 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-21 11:40:43 +08:00
..
apm821xx apm821xx: add missing export-dtb 2022-01-07 14:07:28 +08:00
archs38 archs38: update kernel version to 5.10 2021-11-10 23:59:07 +08:00
armvirt armvirt: enable MMIO_CMDLINE_DEVICES for firecracker support 2021-10-14 23:56:43 +08:00
at91 at91: add support for sam9x60-ek board 2022-03-17 11:23:53 +08:00
ath25 ath25: disable build for ubnt2/5 2022-01-07 19:40:34 +08:00
ath79 ath79: drop CSAC support 2022-03-08 12:18:14 +08:00
bcm27xx bcm27xx: update distroconfig.txt for faster RPi4 2022-02-10 12:40:18 +08:00
bcm47xx bcm47xx: fix bgmac regression present in 5.10 kernel 2021-11-14 23:56:20 +08:00
bcm53xx kernel: bump 5.10 to 5.10.82 2021-12-20 11:16:13 +08:00
bcm63xx kernel: bump 5.4 to 5.4.162 2021-12-20 11:16:52 +08:00
bcm4908 bcm4908: add uboot-envtools to default packages 2021-12-21 23:55:17 +08:00
bmips kernel: Deactivate B53 symbols in generic configuration 2021-12-03 00:03:50 +08:00
gemini gemini: splash banner on framebuffer console 2021-10-11 23:55:36 +08:00
generic kernel: Add extra configuration options 2022-03-17 11:24:36 +08:00
imx imx: update subtargets default kernel configs for 5.10 2021-12-22 11:32:14 +08:00
ipq40xx ipq40xx: use zImage for Cell-C RTL30VW 2022-02-08 12:38:00 +08:00
ipq806x ipq806x: add support for SURF G-NAT200 2022-02-25 11:36:09 +08:00
ipq807x kernel: Set CONFIG_RCU_CPU_STALL_TIMEOUT=21 2021-09-10 12:26:08 +08:00
kirkwood kirkwood: refresh kernel config 2021-10-06 23:56:13 +08:00
lantiq lantiq: increase fritz-cal-extract output limit 2022-01-17 12:26:45 +08:00
layerscape kernel: refresh kernel 5.4 patches 2021-12-28 14:26:58 +08:00
malta kernel: move two symbols to the generic kconfigs 2021-08-30 12:13:54 +08:00
mediatek kernel: move parser_trx patches of custom magic to generic 2022-03-11 23:37:36 +08:00
mpc85xx kernel: bump 5.10 to 5.10.80 2021-12-08 23:59:43 +08:00
mvebu base-files: rename 'sdcard' to 'legacy-sdcard' 2022-02-12 12:26:08 +08:00
mxs kernel: Set some options in generic configuration 2021-11-12 00:06:18 +08:00
octeon kernel: move two symbols to the generic kconfigs 2021-08-30 12:13:54 +08:00
octeontx octeontx: Refresh kernel configuration 2022-01-29 19:00:08 +08:00
omap omap: make use of 'rootfs-part' feature 2022-02-14 18:25:38 +08:00
oxnas kernel: refresh kernel 5.4 patches 2021-12-28 14:26:58 +08:00
pistachio kernel: bump 5.4 to 5.4.156 2021-12-08 23:56:51 +08:00
qoriq qoriq: add support for WatchGuard Firebox M300 2021-12-24 11:28:40 +08:00
ramips ramips: add support for Beeline SmartBox Flash 2022-03-21 11:40:43 +08:00
realtek kernel: bump 5.4 to 5.4.162 2021-12-20 11:16:52 +08:00
rockchip r8168: allow build for kernel 5.10 2022-03-14 15:28:33 +08:00
sunxi sunxi: make use of 'rootfs-part' feature 2022-02-14 18:28:21 +08:00
tegra kernel: Set CONFIG_RCU_CPU_STALL_TIMEOUT=21 2021-09-10 12:26:08 +08:00
uml uml: make use of 'rootfs-part' feature 2022-02-14 18:29:30 +08:00
x86 treewide: add missing kernel config for 5.10 2021-12-18 00:25:49 +08:00
zynq kernel: Set some options in generic configuration 2021-11-12 00:06:18 +08:00
Makefile target: use SPDX license identifiers on Makefiles 2021-02-11 12:05:39 +08:00