Hi,
I am trying to add LEDE support to my CPE210v2 device. I did some changes to the LEDE source, compiled and flashed it to the device. Unfortunately, it won't boot the new firmware. Returning to the stock fw is no problem, it can be flashed via TFTP. My target is to boot LEDE.
This is bootloader output via serial port:
U-Boot 1.1.4-g30d8afa8-dirty (Nov 1 2016 - 17:38:05)
ap143-2.0 - Honey Bee 2.0
DRAM: 64 MB
Flash Manuf Id 0xc�, DeviceId0 0x40, DeviceId1 0x17
flash size 8MB, sector count = 128
Flash: 8 MB
Using default environment
In: serial
Out: serial
Err: serial
Net: ath_gmac_enet_in�tialize...
a�h_gmac_enet_initialize: reset mask:c02200
Scorpion ---->S27 PHY�
S27 reg init
: cfg1 0x800c0000 cfg2 0x7114
eth0: ba:be:fa�ce:08:41
athrs27_phy_setup ATHR_PHY_CONTROL 4 :1000
athrs27_p�y_setup ATHR_PHY_SPEC_STAUS 4 :10
eth0 up
Honey Bee ----> MAC 1 S27 PHY *
S27 reg init
ATHRS27: resetting s27
ATHRS27: s27 reset do�e
: cfg1 0x800c0000 cfg2 0x7214
eth1: ba:be:fa:ce:08:41
athrs27_phy_setup ATHR_PHY_CONTROL 0 :1000
athrs27_phy_setup ATHR_PHY_�PEC_STAUS 0 :10
athrs27_phy_setup ATHR_PHY_CONTROL 1 :1000
at�rs27_phy_setup ATHR_PHY_SPEC_STAUS 1 :10
athrs27_phy_setup ATH�_PHY_CONTROL 2 :1000
athrs27_phy_setup ATHR_PHY_SPEC_STAUS 2 :�0
athrs27_phy_setup ATHR_PHY_CONTROL 3 :1000
athrs27_phy_setu� ATHR_PHY_SPEC_STAUS 3 :10
eth1 up
eth0, eth1
Setting 0x�81162c0 to 0x4081a100
is button pressed? 0
Autobooting in 1 seconds
## Booting ima�e at 9f040000 ...
Uncompressing Kernel Image ... OK
�
Starting kernel ...
Nothing happens afterwards. Only the LAN-LED is lit. I assume the bootloader tries to jump to the kernel at an incorrect start address. This is what I would like to resolve in this thread.
These are my changes to the LEDE source:
[lededir]/target/linux/ar71xx/image/tp-link.mk:
--- a/target/linux/ar71xx/image/tp-link.mk
+++ b/target/linux/ar71xx/image/tp-link.mk
@@ -224,6 +224,14 @@ define Device/cpe210-220-v1
TPLINK_BOARD_ID := CPE210
endef
+define Device/cpe210-220-v2
+ $(Device/cpe510-520-v1)
+ MTDPARTS := "ath-nor0:128k(u-boot),64k(pation-table),64k(product-info),1536k(kernel),6144k(rootfs),192k(config),64k(ART)"
+ DEVICE_TITLE := TP-LINK CPE210/220 v2
+ BOARDNAME := CPE210
+ TPLINK_BOARD_ID := CPE210v2
+endef
+
define Device/wbs210-v1
$(Device/cpe510-520-v1)
DEVICE_TITLE := TP-LINK WBS210 v1
@@ -237,7 +245,7 @@ define Device/wbs510-v1
BOARDNAME := WBS510
TPLINK_BOARD_ID := WBS510
endef
-TARGET_DEVICES += cpe210-220-v1 cpe510-520-v1 wbs210-v1 wbs510-v1
+TARGET_DEVICES += cpe210-220-v1 cpe210-220-v2 cpe510-520-v1 wbs210-v1 wbs510-v1
I read the MTDPARTS
variable from the stock firmware. The LEDE definition for CPE210v1 starts with MTDPARTS := spi0.0:128k(u-boot)ro ...
In [lededir]/tools/firmware-utils/src/tplink-safeloader.c I added this:
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -154,6 +154,38 @@ static struct device_info boards[] = {
.last_sysupgrade_partition = "file-system",
},
+ {
+ .id = "CPE210v2",
+ .vendor = "CPE210(TP-LINK|EU|N300-2):2.0",
+ .support_list =
+ "SupportList:\r\n"
+ "CPE210(TP-LINK|EU|N300-2|45550000):2.0\r\n",
+ .support_trail = '\xff',
+ .soft_ver = NULL,
+
+ .partitions = {
+ {"fs-uboot", 0x00000, 0x20000},
+ {"partition-table", 0x20000, 0x02000},
+ {"default-mac", 0x30000, 0x00020},
+ {"product-info", 0x31100, 0x00100},
+ {"device-info",0x31400, 0x00400},
+ {"signature", 0x32000, 0x00400},
+ {"device-id", 0x33000, 0x00100},
+ {"os-image", 0x40000, 0x170000},
+ {"soft-version", 0x1b0000, 0x00100},
+ {"support-list", 0x1b1000, 0x01000},
+ {"file-system", 0x1c0000, 0x600000},
+ {"user-config", 0x7c0000, 0x10000},
+ {"default-config", 0x7d0000, 0x10000},
+ {"log", 0x7e0000, 0x10000},
+ {"radio", 0x7f0000, 0x10000},
+ {NULL, 0, 0}
+ },
+
+ .first_sysupgrade_partition = "os-image",
+ .last_sysupgrade_partition = "file-system",
+ },
+
/** Firmware layout for the CPE510/520 */
{
.id = "CPE510",
I read the partition table from /dev/mtd2 which is the "partition table" partition. It does not differ much from the partition table used in CPE210v1.
What I am still unsure about
-
In tp-link.mk: Does the
BOARDNAME
orTPLINK_BOARD_ID
variable refer to the corresponding entry intplink-safeloader.c
? -
Is it necessary to change the tplink-safeloader.c anyway? According to the OpenWrt wiki the CPE210v1 bootloader identifies itself with:
TP-LINK SafeLoader (Build time: Jan 14 2015 - 11:01:05) CPU: 560MHz AHB: 225MHz DDR: 64MB Performing LED check.. PASS Press CTRL+B to enter SafeLoader
-
The CPE210v2 bootloader however starts with a plain Uboot message:
U-Boot 1.1.4-g30d8afa8-dirty (Nov 1 2016 - 17:38:05)
ap143-2.0 - Honey Bee 2.0
More info
Log of the OEM firmware booting: https://nopaste.me/view/0ffded29
#Output of /proc/cmdline:
# cat /proc/cmdline
console=ttyS0,115200 root=31:04 rootfstype=squashfs init=/init mtdparts=ath-nor0:128k(u-boot),64k(pation-table),64k(product-info),1536k(kernel),6144k(rootfs),192k(config),64k(ART) mem=64M
Output of /proc/cpuinfo
# cat /proc/cpuinfo
system type : QCA953x
processor : 0
cpu model : MIPS 24Kc V7.4
BogoMIPS : 432.12
wait instruction : yes
microsecond timers : yes
tlb_entries : 16
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ff8, 0x02b4, 0x0a50, 0x0490]
ASEs implemented : mips16
shadow register sets : 1
core : 0
VCED exceptions : not available
VCEI exceptions : not available
Output of /proc/devices:
# cat /proc/devices
Character devices:
1 mem
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
10 misc
77 ATH_GPIOC
90 mtd
108 ppp
128 ptm
136 pts
238 ar7100_gpio_chrdev
239 ar7240_flash_chrdev
Block devices:
259 blkext
31 mtdblock
What to do now?
I would like to understand how this works, so I can maybe add support to another device in the future. Are there any tips you can give me on how to proceed? I would love to see my CPE210v2 running with LEDE.
Thanks in advance.