2020-01-29 17:21:53 +00:00
|
|
|
DEVICE_VARS += TPLINK_FLASHLAYOUT TPLINK_HWID TPLINK_HWREV TPLINK_HWREVADD
|
|
|
|
DEVICE_VARS += TPLINK_HVERSION TPLINK_BOARD_ID TPLINK_HEADER_VERSION
|
|
|
|
|
ramips: add basic support for TP-Link EC330-G5u v1
This adds basic support for TP-Link EC330-G5u Ver:1.0 router (also known
as TP-Link Archer C9ERT).
Device specification
--------------------
SoC Type: MediaTek MT7621AT
RAM: 128 MiB, Nanya NT5CC64M16GP-DI
Flash: 128 MiB NAND, ESMT F59L1G81MA-25T
Wireless 2.4 GHz (MediaTek MT7615N): b/g/n, 4x4
Wireless 5 GHz (MediaTek MT7615N): a/n/ac, 4x4
Ethernet: 5xGbE (WAN, LAN1, LAN2, LAN3, LAN4)
USB ports: 1xUSB3.0
Button: 4 (Led, WiFi On/Off, Reset, WPS)
LEDs: 7 blue LEDs, 1 orange(amber) LED, 1 white(non-gpio) LED
Power: 12 VDC, 2 A
Connector type: Barrel
Bootloader: First U-Boot (1.1.3), Main U-Boot (1.1.3). Additionally,
original TP-Link firmware contains Image U-Boot (1.1.3).
Serial console (UART)
---------------------
V
+-------+-------+-------+-------+
| +3.3V | GND | TX | RX |
+---+---+-------+-------+-------+
| J2
|
+--- Don't connect
Installation
------------
1. Rename OpenWrt initramfs image to test.bin and place it on tftp server
with IP 192.168.0.5
2. Attach UART, switch on the router and interrupt the boot process by
pressing 't'
3. Load and run OpenWrt initramfs image:
tftpboot
bootm
4. Once inside OpenWrt, switch to the first boot image:
fw_setenv BootImage 0
5. Run 'sysupgrade -n' with the sysupgrade OpenWrt image
Back to Stock
-------------
1. Run in the OpenWrt shell:
fw_setenv BootImage 1
reboot
Recovery
--------
1. Press Reset button and power on the router
2. Navigate to U-Boot recovery web server (http://192.168.0.1/) and upload
the OEM firmware
MAC addresses
-------------
+---------+-------------------+-------------------+-------------+
| | MAC example 1 | MAC example 2 | Algorithm |
+---------+-------------------+-------------------+-------------+
| label | 68:ff:7b:xx:xx:f4 | 50:d4:f7:xx:xx:da | label |
| LAN | 68:ff:7b:xx:xx:f4 | 50:d4:f7:xx:xx:da | label |
| WAN | 72:ff:7b:xx:xx:f5 | 54:d4:f7:xx:xx:db | label+1 [1] |
| WLAN 2g | 68:ff:7b:xx:xx:f4 | 50:d4:f7:xx:xx:da | label |
| WLAN 5g | 68:ff:7b:xx:xx:f6 | 50:d4:f7:xx:xx:dc | label+2 |
+---------+-------------------+-------------------+-------------+
label MAC address was found in factory at 0x165 (text format
xx:xx:xx:xx:xx:xx).
Notes
-----
[1] WAN MAC address:
a. First octet of WAN MAC is differ than others and OUI is not related
to TP-Link company. This probably should be fixed.
b. Flipping bits in first octet and hex delta are different for the
different MAC examples:
+-----------------+----------------+----------------+
| | Example 1 | Example 2 |
+-----------------+----------------+----------------+
| LAN | 68 = 0110 1000 | 50 = 0101 0000 |
| MAC (1st octet) | ^ ^ ^ | |
+-----------------+----------------+----------------+
| WAN | 72 = 0111 0010 | 54 = 0101 0100 |
| MAC (1st octet) | ^ ^ ^ | ^ |
+-----------------+----------------+----------------+
| HEX delta | 0xa | 0x4 |
+-----------------+----------------+----------------+
| DEC delta | 4 | 4 |
+-----------------+----------------+----------------+
c. DEC delta is a constant (4). This looks like a mistake in OEM
firmware and probably should be fixed.
Based on the above, I decided to keep correct OUI and make WAN MAC =
label + 1.
[2] Bootloaders
The device contains 3 bootloaders:
- First U-Boot: U-Boot 1.1.3 (Mar 18 2019 - 12:50:24). The First U-Boot
located on NAND Flash to load next full-feature Uboot.
- Main U-Boot + its backup: U-Boot 1.1.3 (Mar 18 2019 - 12:50:29). This
bootloader includes recovery webserver. Requires special uImages to
continue the boot process:
0x00 (os0, os1) - firmware uImage
0x40 (os0, os1) - standalone uImage (OpenWrt kernel is here)
- Additionally, both slots of the original TP-Link firmware contains
Image U-Boot: U-Boot 1.1.3 (Oct 16 2019 - 08:14:45). It checks image
magics and CRCs. We don't use this U-Boot with OpenWrt.
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-01-06 15:47:58 +00:00
|
|
|
define Build/uImage-tplink-c9
|
|
|
|
mkimage \
|
|
|
|
-A $(LINUX_KARCH) \
|
|
|
|
-O linux \
|
|
|
|
-T $(word 1,$(1)) \
|
|
|
|
-C none \
|
|
|
|
-a $(KERNEL_LOADADDR) \
|
|
|
|
-e $(KERNEL_LOADADDR) \
|
|
|
|
-n $(wordlist 2,$(words $(1)),$(1)) \
|
|
|
|
-d $@ $@.new
|
|
|
|
mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2020-01-29 17:21:53 +00:00
|
|
|
define Device/tplink-v1
|
|
|
|
DEVICE_VENDOR := TP-Link
|
|
|
|
TPLINK_FLASHLAYOUT :=
|
|
|
|
TPLINK_HWID :=
|
|
|
|
TPLINK_HWREV := 0x1
|
|
|
|
TPLINK_HEADER_VERSION := 1
|
|
|
|
KERNEL := $(KERNEL_DTB)
|
|
|
|
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v1-header -e -O
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := tplink-v1-image factory -e -O
|
2021-06-20 16:54:36 +00:00
|
|
|
IMAGE/sysupgrade.bin := tplink-v1-image sysupgrade -e -O | check-size | \
|
|
|
|
append-metadata
|
2020-01-29 17:21:53 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Device/tplink-v2
|
|
|
|
DEVICE_VENDOR := TP-Link
|
|
|
|
TPLINK_FLASHLAYOUT :=
|
|
|
|
TPLINK_HWID :=
|
|
|
|
TPLINK_HWREV := 0x1
|
|
|
|
TPLINK_HWREVADD := 0x0
|
|
|
|
TPLINK_HVERSION := 3
|
|
|
|
KERNEL := $(KERNEL_DTB)
|
|
|
|
KERNEL_INITRAMFS := $(KERNEL_DTB) | tplink-v2-header -e
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := tplink-v2-image -e
|
2021-06-20 16:54:36 +00:00
|
|
|
IMAGE/sysupgrade.bin := tplink-v2-image -s -e | check-size | \
|
|
|
|
append-metadata
|
2020-01-29 17:21:53 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Device/tplink-safeloader
|
|
|
|
DEVICE_VENDOR := TP-Link
|
|
|
|
TPLINK_BOARD_ID :=
|
|
|
|
TPLINK_HWID := 0x0
|
|
|
|
TPLINK_HWREV := 0x0
|
|
|
|
TPLINK_HEADER_VERSION := 1
|
|
|
|
KERNEL := $(KERNEL_DTB) | tplink-v1-header -e -O
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade | \
|
2021-06-20 16:54:36 +00:00
|
|
|
check-size | append-metadata
|
2020-01-29 17:21:53 +00:00
|
|
|
IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
|
|
|
|
endef
|