OpenWrt support for TP-Link CPE605

Dear all,

is there someone that tried an image to the new TP-LINK CPE 605, apparently this is a new low cost model based on the CPE610 but without mimo antenna. I have such device and would like to use openwrt instead of the exiting original FW.

I have access to the device via Telnet: can anyone explain how to initiate a new build for this device.

Thanks in advance

1 Like

Check if both have the same hardware and the same partition table. If they are the same, you can flash CPE610's firmware on CPE605.

Assuming the image is accepted by the device.

That is the problem, unfortunately it is not accepted ...

@apcameron,
Dear Apcameron
I have seen that you helped to create the build for the CPE610, could you give a hand with this one 605 please ?
Thanks in advance

Unfortunately I do not have one.
As a starting point you can do the following.
Download the code for Openwrt 21.02
Edit tools/firmware-utils/src/tplink-safeloader.c
In the section for the for the CPE610V2
Under "SupportList:\r\n"
If you have enables ssh you can get this string from the following command
cat /dev/mtdblock2 | grep CPE605
Add the support string for your device and then build the System and test using the image for the CPE610V2

If it works then you should create a new device using the as an example
https://github.com/openwrt/openwrt/pull/3120

Thanks a lot and I am sorry if, from now on, I ask basic questions: :slight_smile:
downloaded the:
openwrt-imagebuilder-22.03.1-ath79-generic.Linux-x86_64; this is ok ? or you would think the the 21.02 would give an advantage ?
I will compile in a Debian base vm. ? Would you advice for another option ?

I did login in the CPE605 and did the command:

login as: admin
admin@192.168.10.254's password:


BusyBox v1.01 (2020.10.28-07:57+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

$ cat /dev/mtdblock2 | grep CPE605
CPE605(TP-LINK|UN|N150-5|00000000):1.0

Is this the expected result ?

Thanks in advance
Rui

@ruildias You will need to build the system using the method below
https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem
CPE605(TP-LINK|UN|N150-5|00000000):1.0 is the expected result and what you need to add to tools/firmware-utils/src/tplink-safeloader.c as described in me previous post

Yes you can compile on a Debian VM once you have installed all the prerequisites.
See the Debian Section in this Link https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem

Additionally, if you log on to your device
Please send me the output of the following two commands
cat /proc/cpuinfo
and
dmesg

Hi again,

here it is:

$ cat /proc/cpuinfo
system type             : Atheros AR934x
processor               : 0
cpu model               : MIPS 74Kc V4.12
BogoMIPS                : 279.55
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented        : mips16 dsp
shadow register sets    : 1
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

and dmesg:

$ dmesg
Linux version 2.6.31 (root@ubuntu) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Wed Oct 28 15:57:10 CST 2020
flash_size passed from bootloader = 0
CPU revision is: 0001974c (MIPS 74Kc)
ath_sys_frequency: cpu srif ddr srif cpu 560 ddr 450 ahb 225
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
User-defined physical RAM map:
 memory: 04000000 @ 00000000 (usable)
Zone PFN ranges:
  Normal   0x00000000 -> 0x00004000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00004000
On node 0 totalpages: 16384
free_area_init_node: node 0, pgdat 802a7230, node_mem_map 81000000
  Normal zone: 128 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 16256 pages, LIFO batch:3
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: 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
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
Writing ErrCtl register=00000000
Readback ErrCtl register=00000000
Memory: 60968k/65536k available (2122k kernel code, 4496k reserved, 590k data, 120k init, 0k highmem)
Hierarchical RCU implementation.
NR_IRQS:128
plat_time_init: plat time init done
Calibrating delay loop... 279.55 BogoMIPS (lpj=559104)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
Switched to high resolution mode on CPU 0
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
net_link: create socket ok.
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
ATH GPIOC major 0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
NTFS driver 2.1.29 [Flags: R/O].
msgmni has been set to 119
alg: No test for lzma (lzma-generic)
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xb8020000 (irq = 19) is a 16550A
console [ttyS0] enabled
PPP generic driver version 2.4.2
NET: Registered protocol family 24
7 cmdlinepart partitions found on MTD device ath-nor0
Creating 7 MTD partitions on "ath-nor0":
0x000000000000-0x000000020000 : "u-boot"
0x000000020000-0x000000030000 : "pation-table"
0x000000030000-0x000000040000 : "product-info"
0x000000040000-0x0000001c0000 : "kernel"
0x0000001c0000-0x0000007c0000 : "rootfs"
0x0000007c0000-0x0000007f0000 : "config"
0x0000007f0000-0x000000800000 : "ART"
TCP cubic registered
NET: Registered protocol family 10
lo: Disabled Privacy Extensions
IPv6 over IPv4 tunneling driver
sit0: Disabled Privacy Extensions
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
athwdt_init: Registering WDT success
athwdt_timer_init: Starting WDT.
ath_otp_init: Registering OTP success
ath_clksw_init: Registering Clock Switch Interface success
VFS: Mounted root (squashfs filesystem) readonly on device 31:4.
Freeing unused kernel memory: 120k freed
xt_time: kernel timezone is -0000
nf_conntrack version 0.5.0 (1024 buckets, 30720 max)
ip_tables: (C) 2000-2006 Netfilter Core Team

Register vlan_manage hooks success.
PPPoL2TP kernel driver, V1.0
PPTP driver version 0.8.3
ATHR_GMAC: Length per segment 1536
ATHR_GMAC: fifo cfg 3 01f00140
mac:0 Registering S27....
ATHR_GMAC: RX TASKLET - Pkts per Intr:100
ATHR_GMAC: Mac address for unit 0:bfff0000
ATHR_GMAC: ff:ff:ff:ff:ff:ff
ATHR_GMAC: Max segments per packet :   1
ATHR_GMAC: Max tx descriptor count :   128
ATHR_GMAC: Max rx descriptor count :   128
ATHR_GMAC: Mac capability flags    :   2580
mac:1 Registering S27....
ATHR_GMAC: RX TASKLET - Pkts per Intr:100
ATHR_GMAC: Mac address for unit 1:bfff0006
ATHR_GMAC: ff:ff:ff:ff:ff:ff
ATHR_GMAC: Max segments per packet :   1
ATHR_GMAC: Max tx descriptor count :   128
ATHR_GMAC: Max rx descriptor count :   128
ATHR_GMAC: Mac capability flags    :   2D80
device eth1 entered promiscuous mode
device eth0 entered promiscuous mode
athr_gmac_ring_alloc Allocated 2048 at 0x83be2800
athr_gmac_ring_alloc Allocated 2048 at 0x83be2000
WASP ----> S27 PHY MDIO
Setting Drop CRC Errors, Pause Frames and Length Error frames
Setting PHY...
ATHR_GMAC: Enet Unit:0 PHY:4 is UP RGMii 100Mbps full duplex
ATHR_GMAC: done cfg2 0x7115 ifctl 0x10000 miictrl
Setting Drop CRC Errors, Pause Frames and Length Error frames
athr_gmac_ring_alloc Allocated 2048 at 0x83072000
athr_gmac_ring_alloc Allocated 2048 at 0x83bfa800
WASP ----> S27 PHY MDIO
ATHRS27: resetting s27
ATHRS27: s27 reset done
Setting Drop CRC Errors, Pause Frames and Length Error frames
Setting PHY...
ADDRCONF(NETDEV_UP): eth1: link is not ready
br0: port 2(eth0) entering forwarding state
nf_conntrack_rtsp v0.6.21 loading
nf_nat_rtsp v0.6.21 loading

Disable VlanManage, data.enable(0), data.vid(0)
Jumbo Frame disabled in Mac:1
Jumbo Frame sz val:5ee
athr_gmac_ring_free Freeing at 0x83072000
athr_gmac_ring_free Freeing at 0x83bfa800
athr_gmac_ring_alloc Allocated 2048 at 0x83bfa800
athr_gmac_ring_alloc Allocated 2048 at 0x8314a800
WASP ----> S27 PHY MDIO
Setting Drop CRC Errors, Pause Frames and Length Error frames
Setting PHY...
eth0: no IPv6 routers present
Jumbo Frame disabled in Mac:0
Jumbo Frame sz val:5ee
athr_gmac_ring_free Freeing at 0x83be2800
athr_gmac_ring_free Freeing at 0x83be2000
athr_gmac_ring_alloc Allocated 2048 at 0x83be2000
athr_gmac_ring_alloc Allocated 2048 at 0x830ff000
WASP ----> S27 PHY MDIO
Setting Drop CRC Errors, Pause Frames and Length Error frames
Setting PHY...
ATHR_GMAC: Enet Unit:0 PHY:4 is UP RGMii 100Mbps full duplex
ATHR_GMAC: done cfg2 0x7115 ifctl 0x10000 miictrl
Setting Drop CRC Errors, Pause Frames and Length Error frames
athr_gmac_ring_free Freeing at 0x83be2000
athr_gmac_ring_free Freeing at 0x830ff000
athr_gmac_ring_alloc Allocated 2048 at 0x830ff000
athr_gmac_ring_alloc Allocated 2048 at 0x83be2000
WASP ----> S27 PHY MDIO
Setting Drop CRC Errors, Pause Frames and Length Error frames
Setting PHY...
ATHR_GMAC: Enet Unit:0 PHY:4 is UP RGMii 100Mbps full duplex
ATHR_GMAC: done cfg2 0x7115 ifctl 0x10000 miictrl
Setting Drop CRC Errors, Pause Frames and Length Error frames
DMA STATUS disabled in Mac:0
adf: module license 'Proprietary' taints kernel.
Disabling lock debugging due to kernel taint
ath_hal: 0.9.17.1 (AR9380, REGOPS_FUNC, WRITE_EEPROM, 11D)
ath_rate_atheros: Copyright (c) 2001-2005 Atheros Communications, Inc, All Rights Reserved
ath_spectral: Version 2.0.0
Copyright (c) 2005-2009 Atheros Communications, Inc. All Rights Reserved
SPECTRAL module built on Oct 28 2020 16:05:43
ath_dfs: Version 2.0.0
Copyright (c) 2005-2006 Atheros Communications, Inc. All Rights Reserved
ath_dev: Copyright (c) 2001-2007 Atheros Communications, Inc, All Rights Reserved
ath_ahb: 9.5.2.18 (Atheros/multi-bss)
Enterprise mode: 0x00000000
Restoring Cal data from Flash
ar9300_convert_eeprom templateVersion = 82
===>>>[ar9300_eeprom_cover_ctl:5143] cover_ctl_flag: 2.
===>>>[ar9300_eeprom_cover_ctl:5172] cover ctl done.
ath_get_caps[6210] rx chainmask mismatch actual 1 sc_chainmak 0
ath_get_caps[6185] tx chainmask mismatch actual 1 sc_chainmak 0
wifi0: Atheros 9340: mem=0xb8100000, irq=2
===>>>[ar9300_eeprom_cover_ctl:5143] cover_ctl_flag: 2.
===>>>[ar9300_eeprom_cover_ctl:5172] cover ctl done.
dfs is NULL dfs_init_radar_filtersieee80211_wifipos_vattach: 3572: Wifipos intialization starting
ieee80211_wifipos_vattach: 3585: Wifipos intialization mem alloc complete
ieee80211_wifipos_vattach:3599 Netlink socket created for wifipos:827c5000

ieee80211_wifipos_vattach: 3615: Wifipos intialization sock alloc complete
ieee80211_wifipos_vattach:3618 Registered WIFIPOS netlink family
ieee80211_wifipos_vattach: 3669: Wifipos intialization time alloc complete
ieee80211_wifipos_vattach: 3688: Wifipos intialization data store 1 alloc complete
ieee80211_wifipos_vattach: 3698: Wifipos intialization data store 2 alloc complete
ieee80211_wifipos_vattach: 3712: Wifipos intialization complete
VAP device ath7 created
ic->ic_set_special_chwidth(ic, 20)
dfs is NULL dfs_init_radar_filtersieee80211_wifipos_automeas_calc_timer() 2713: No client, need not measure, return.
device ath7 entered promiscuous mode
br0: port 3(ath7) entering forwarding state
 Scan in progress.. Cancelling it
dfs_attach: use DFS enhancements
DFS min filter rssiThresh = 15
DFS max pulse dur = 151 ticks
dfs_attach enable detects
br0: port 3(ath7) entering disabled state
device ath7 left promiscuous mode
br0: port 3(ath7) entering disabled state
ADDRCONF(NETDEV_UP): ath7: link is not ready
$

Is this ok ? Something more ?
I am currently preparing the building system.

Thank you

@ruildias Please make sure you have a copy of the vendor firmware and know how to recover if it does not work.

Based on the assumption that the hardware is almost the same as the TP Link CPE610 I have created a build for the CPE605 for you to look at.
You can download it here
https://andynet.duckdns.org/nextcloud/index.php/s/QWRg74NytX75cwQ
I will delete this link after one week.

If you decide to try it let me know if it works.

1 Like

@apcameron Just tried that and gives me an error:

uploaded file was: openwrt-21.02.5-ath79-generic-tplink_cpe605-v1-initramfs-kernel.bin
Any suggestion ?

The image to use when your device still has the factory software is
openwrt-21.02.5-ath79-generic-tplink_cpe605-v1-squashfs-factory.bin

1 Like

:slight_smile: it seems to work fine:


any specific test recommendations ?

Just test and make sure it functions as expected and is stable.
If it is stable, you may want to consider working on a PR to get it fully supported by OpenWrt

Here is the Complete Patch I applied to OpenWrt 21.0.2.5

diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 146470855d..804f135008 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -19,6 +19,7 @@ glinet,6416|\
 glinet,gl-ar300m-lite|\
 glinet,gl-ar300m16|\
 pcs,cap324|\
+tplink,cpe605-v1|\
 tplink,cpe610-v1|\
 tplink,cpe610-v2)
 	ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index b01dfa41d1..8d32964798 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -62,6 +62,7 @@ ath79_setup_interfaces()
 	tplink,cpe210-v3|\
 	tplink,cpe510-v2|\
 	tplink,cpe510-v3|\
+	tplink,cpe605-v1|\
 	tplink,cpe610-v1|\
 	tplink,cpe610-v2|\
 	tplink,eap225-outdoor-v1|\
diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk
index fceebdaaf3..77b3be9efb 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -342,6 +342,16 @@ define Device/tplink_cpe510-v3
 endef
 TARGET_DEVICES += tplink_cpe510-v3
 
+define Device/tplink_cpe605-v1
+  $(Device/tplink-safeloader-okli)
+  SOC := ar9344
+  IMAGE_SIZE := 7680k
+  DEVICE_MODEL := CPE605
+  DEVICE_VARIANT := v1
+  TPLINK_BOARD_ID := CPE605V1
+endef
+TARGET_DEVICES += tplink_cpe605-v1
+
 define Device/tplink_cpe610-v1
   $(Device/tplink-safeloader-okli)
   SOC := ar9344
diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c
index 3a7d8d912e..39952ab161 100644
--- a/tools/firmware-utils/src/tplink-safeloader.c
+++ b/tools/firmware-utils/src/tplink-safeloader.c
@@ -453,6 +453,39 @@ static struct device_info boards[] = {
 		.last_sysupgrade_partition = "support-list",
 	},
 
+	/** Firmware layout for the CPE605V1 */
+	{
+		.id     = "CPE605V1",
+		.vendor = "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n",
+		.support_list =
+			"SupportList:\r\n"
+			"CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n"
+			"CPE605(TP-LINK|EU|N150-5|45550000):1.0\r\n"
+			"CPE605(TP-LINK|US|N150-5|55530000):1.0\r\n"
+			"CPE605(TP-LINK|US|N150-5):1.0\r\n",
+		.part_trail = 0xff,
+		.soft_ver = NULL,
+
+		.partitions = {
+			{"fs-uboot", 0x00000, 0x20000},
+			{"partition-table", 0x20000, 0x02000},
+			{"default-mac", 0x30000, 0x00020},
+			{"product-info", 0x31100, 0x00100},
+			{"signature", 0x32000, 0x00400},
+			{"firmware", 0x40000, 0x770000},
+			{"soft-version", 0x7b0000, 0x00100},
+			{"support-list", 0x7b1000, 0x00400},
+			{"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 = "support-list",
+	},
+
 	/** Firmware layout for the CPE610V1 */
 	{
 		.id     = "CPE610V1",

I also had to create a DTS File which I will upload later tonight

@ruildias I created the DTS file called target/linux/ath79/dts/ar9344_tplink_cpe605-v1.dts
Which had the following contents

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "ar9344_tplink_cpe.dtsi"

/ {
	model = "TP-Link CPE605 v1";
	compatible = "tplink,cpe605-v1", "qca,ar9344";

	aliases {
		led-boot = &led_lan;
		led-failsafe = &led_lan;
		led-upgrade = &led_lan;
	};

	leds {
		compatible = "gpio-leds";

		led_lan: lan {
			label = "green:lan";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
		};

		wlan5g {
			label = "green:wlan5g";
			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "phy0tpt";
		};
	};
};

&eth1 {
	compatible = "syscon", "simple-mfd";
};

Thank you very much @apcameron!!
CP605 is running for some hours without a glitch, so quite stable.
In order to bring this device to be supported (as standard on the openwrt community, as well, to benefit from further updates and patches) , what should I do ?

Hi again,

I am trying to do a build system based on the version 22.03.1 and I cannot find this folder: /tools/firmware-utils/src (there is no src there - suppose source)
So cannot change the tplink-safeloader.c code ...
What am I missing ?
I did all other changes you referenced within your answer (based on diff). Now I am stuck ...
Any suggestion ?

Thanks again ...

Unfortunately, the openwrt team decided to move that code to another repository for 22.03
That code is now located at https://git.openwrt.org/project/firmware-utils.git
This complicates the process as in the previous version the code was still in the openwrt branch
What you can try is to enter the following command in the openwrt folder
make tools/firmware-utils/prepare
That should populate that folder
If that does not work, try
make download
after that look in the openwrt/dl folder and you should see a tar file there with the firmware-utils source code

I ran a make download and it placed firmware-utils-2022-09-12-0c92b20a.tar.xz in the openwrt/dl folder
As a workaround you can extract that file to a temp folder and then make your changes to it.
Then recreate the tar file and place it back in the openwrt/dl folder overwriting the original file.