ramips: add support for Sercomm CPJ routers openwrt-23.05
authorMikhail Zhilkin <csharper2005@gmail.com>
Sun, 12 Nov 2023 07:58:26 +0000 (07:58 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 27 Nov 2023 01:02:35 +0000 (02:02 +0100)
commitebdaee7194a30372d00b4675bfe9dfae0c59147f
tree10b6a65989eefab6d812852b7e3cd6a99acaf20f
parentfd277ee49054584f9a064eb339c65ff492a53765
ramips: add support for Sercomm CPJ routers

This commit adds support for following wireless routers:
 - Rostelecom RT-FL-1 (Serсomm RT-FL-1)
 - Rostelecom S1010 (Serсomm S1010.RT)

The devices are almost identical and the only difference is one bit in the
factory image PID (thanks to Maximilian Weinmann <x1@disroot.org>
(@MaxS0niX) for the info and idea to make one PR for two devices at once).

Devices specification
---------------------
   SoC:          MediaTek MT7620A, MIPS
   RAM:          64 MB
   Flash:        16 MB SPI NOR
   Wireless 2.4: MT7620 (b/g/n, 2x2)
   Wireless 5:   MT7612EN (a/n/ac, 2x2)
   Ethernet:     5xFE (WAN, LAN1-4)
   BootLoader:   U-Boot
   Buttons:      2 (wps, reset)
   LEDs:         1 amber and 1 green status GPIO leds
                 5 green ethernet GPIO leds
                 1 green GPIO 2.4 GHz WLAN led
                 1 green PHY 5 GHz WLAN led
                 1 green unmanaged power led
   USB ports:    No
   Power:        12 VDC, 1 A
   Connector:    Barrel

OEM easy installation
---------------------
1. Remove all dots from the factory image filename (except the dot
   before file extension)
2. Upload and update the firmware via the original web interface
3. Wait until green status led stops blinking (can take several minutes)
4. Login to OpenWrt initramsfs. It's recommended to make a backup of the
   mtd partitions at this point.
4. Perform sysupgrade using the following command (or use Luci):
   sysupgrade -n sysupgrade.bin
5. Wait until green status les stops blinking (can take several minutes)
6. Mission acomplished

Return to Stock
---------------
Option 1. Restore firmware Slot1 from a backup (firmware2.bin):
   cd /tmp
   mtd -e Firmware2 write firmware2.bin Firmware2
   printf 1 | dd bs=1 seek=$((0x18007)) count=1 of=/dev/mtdblock2
   reboot

Option 2. Decrypt, ungzip and split stock firmware image into the parts,
take Slot1 parts (kernel2.bin, rootfs2.bin) and write them:
   cd /tmp
   mtd -e Kernel2 write kernel2.bin Kernel2
   mtd -e RootFS2 write rootfs2.bin RootFS2
   printf 1 | dd bs=1 seek=$((0x18007)) count=1 of=/dev/mtdblock2
   reboot
More about stock firmware decryption:
Link: https://github.com/Psychotropos/sercomm_fwutils/
Debricking
----------
Use sercomm-recovery tool. You can use "ALL" mtd partition backup as a
recovery image.
Link: https://github.com/danitool/sercomm-recovery
MAC addresses
-------------
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| label   | 48:3e:xx:xx:xx:1e | label     |
| LAN     | 48:3e:xx:xx:xx:1e | label     |
| WAN     | 48:3e:xx:xx:xx:28 | label+10  |
| WLAN 2g | 48:3e:xx:xx:xx:20 | label+2   |
| WLAN 5g | 48:3e:xx:xx:xx:24 | label+6   |
+---------+-------------------+-----------+

Co-authored-by: Vadzim Vabishchevich <bestmc2009@gmail.com>
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
(cherry picked from commit 1b091311aafc59db576a51b3d2b5febaac45d522)
[fix rt2800_wmac eeprom load]
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
target/linux/ramips/dts/mt7620a_rostelecom_rt-fl-1.dts [new file with mode: 0644]
target/linux/ramips/dts/mt7620a_rostelecom_s1010.dts [new file with mode: 0644]
target/linux/ramips/dts/mt7620a_sercomm_cpj.dtsi [new file with mode: 0644]
target/linux/ramips/image/common-sercomm.mk
target/linux/ramips/image/mt7620.mk
target/linux/ramips/mt7620/base-files/etc/board.d/01_leds
target/linux/ramips/mt7620/base-files/etc/board.d/02_network
target/linux/ramips/mt7620/base-files/lib/upgrade/platform.sh