OpenWrt support for TP-Link CPE605

I found it and initiated as suggested, yet I found the first syntax change between versions in firmware-utils-2022-09-12-0c92b20a.tar.xz vs the previous version:

		.id     = "CPE605V1",
		.vendor = "CPE605(TP-LINK|UN|N150-5|00000000):1.0\r\n",
		.support_list =
		.part_trail = 0xff,
		.soft_ver = NULL,

the line ".soft_ver = NULL," gave a compilation error and I substituted by the same syntax as in the other models:

                .soft_ver = SOFT_VER_DEFAULT,

No longer have the error and compilation proceeds ...


This morning, I saw that the make failed:

 make[3] -C tools/llvm-bpf compile

    ERROR: tools/llvm-bpf failed to build.
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on make:

I will make it with the debug flags on ...


did try to compile, yet here the debug result:

[2101/3328] Building CXX object tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o
FAILED: tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o
/home/ruildias/openwrt/staging_dir/host/bin/g++ -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/build/tools/clang/lib/ASTMatchers/Dynamic -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/clang/lib/ASTMatchers/Dynamic -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/clang/include -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/build/tools/clang/include -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/build/include -I/home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/llvm/include -O2 -I/home/ruildias/openwrt/staging_dir/host/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -DNDEBUG  -fno-exceptions -fno-rtti -std=c++14 -MD -MT tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o -MF tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o.d -o tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/obj.clangDynamicASTMatchers.dir/Registry.cpp.o -c /home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/clang/lib/ASTMatchers/Dynamic/Registry.cpp
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[2102/3328] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/Sema.cpp.o
[2103/3328] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAttr.cpp.o
[2104/3328] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAvailability.cpp.o
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:57: /home/ruildias/openwrt/build_dir/host/llvm-project-13.0.0.src/.built] Error 1
make[3]: Leaving directory '/home/ruildias/openwrt/tools/llvm-bpf'
time: tools/llvm-bpf/compile#10030.85#781.12#3343.62
    ERROR: tools/llvm-bpf failed to build.
make[2]: *** [tools/Makefile:168: tools/llvm-bpf/compile] Error 1
make[2]: Leaving directory '/home/ruildias/openwrt'
make[1]: *** [tools/Makefile:164: /home/ruildias/openwrt/staging_dir/host/stamp/.tools_compile_yyyyyynnyyyyynyyyyyynyynnyyyyyyyyyyyyyyyyyyyyyynynyyyyyyyy] Error 2
make[1]: Leaving directory '/home/ruildias/openwrt'
make: *** [/home/ruildias/openwrt/include/ world] Error 2

Any hint ?

This is likely an Out of Memory error. Try allocating more memory to your VM

1 Like

This is expected as the code has the potential to change with each release as the developers add new features.

1 Like

back to "make" ..

make worked and created the images for the device.

When I tried the upgrade, I had the screen:

so it recognizes itself as a CPE610 not version CPE605.
I forced the upgrade and it WORKED ;-), smoothly ... now running 22.03.1.
Thank you @apcameron
Now, would you help me bringing this device to openwrt supported HW. (created the issue here)
I created an entry, but probably not with the "correct" information or format ... as I have no experience.
Here the status screen:

Again, thanks!

Just realized that "scan networks in Luci is not working", but with CLI works, even if it takes sometime:

iwinfo wlan1 scan

There is an issue description: LUCI wifi scan not working for 2.4 Mhz on ath79 for OpenWrt 22.03 #10158

OK. Let me start by creating a branch in my Repo from the master branch that we can use.
Once I have built an Image I will ask you to test and make sure it works.
Once we have done that, I will start the process to

  1. Update the firmware-utils
    Once it has been Updated then
  2. Create a PR to submit to get the device supported.

To make PRs involving firmware-utils and tplink-safeloader easier I submitted this request:

It looks like this partition table is copied from older CPE entries? New tplink-safeloader partition schemes should match the device's current firmware layout as close as possible to preserve device-specific data and keep open the possibility of using sysupgrade to revert back to OEM firmware (I know TFTP is the main way these are restored, and sysupgrade may not always work..).

In this case, serial-number, device-info and device-id are in unclaimed space and will all be zero'd:

$ grep -ao "partition .*$" CPE605\(UN\)_1.0-up-ver2-2-2-P1\[20201028-rel61457\].bin

  partition fs-uboot base 0x00000 size 0x20000
  partition partition-table base 0x20000 size 0x02000
  partition default-mac base 0x30000 size 0x00020
+ partition serial-number base 0x30100 size 0x00020
  partition product-info base 0x31100 size 0x00100
+ partition device-info base 0x31400 size 0x00400
  partition signature base 0x32000 size 0x00400
+ partition device-id base 0x33000 size 0x00100
  partition os-image base 0x40000 size 0x170000
  partition soft-version base 0x1b0000 size 0x00100
  partition support-list base 0x1b1000 size 0x01000
  partition file-system base 0x1c0000 size 0x600000
  partition user-config base 0x7c0000 size 0x10000
  partition default-config base 0x7d0000 size 0x10000
  partition log base 0x7e0000 size 0x10000
  partition radio base 0x7f0000 size 0x10000

I'd suggest just adding those 3 entries in (and maybe increasing support-list size to 0x1000).

 +			{"fs-uboot", 0x00000, 0x20000},
 +			{"partition-table", 0x20000, 0x02000},
 +			{"default-mac", 0x30000, 0x00020},
++			{"serial-number", 0x30100, 0x00020},
 +			{"product-info", 0x31100, 0x00100},
++			{"device-info", 0x31400, 0x00400},
 +			{"signature", 0x32000, 0x00400},
++			{"device-id", 0x33000, 0x00100},
 +			{"firmware", 0x40000, 0x770000},
 +			{"soft-version", 0x7b0000, 0x00100},
-+			{"support-list", 0x7b1000, 0x00400},
++			{"support-list", 0x7b1000, 0x01000},
 +			{"user-config", 0x7c0000, 0x10000},
 +			{"default-config", 0x7d0000, 0x10000},
 +			{"log", 0x7e0000, 0x10000},
 +			{"radio", 0x7f0000, 0x10000},
 +			{NULL, 0, 0}

But I don't have this device so I won't complain any more :slight_smile:

1 Like

@jwmullally We can add those entries and test that it still works when we work on the PR.
What is the current process to update the firmware-utils and tplink-safeloader while we wait for your request to be approved?

I wouldn't wait on that request, I brought it up on the list before and got no response. Maybe someone will make it this time.

AFAIK firmware-utils patches are just accepted on the openwrt-devel mailing list right now.

I sent one earlier in the year with this:

Some examples:

Hi @jwmullally ,

no issue to change it: if we can do it better why not ?
I will do it, but when question: should I re-flash it with the new compiled version as an upgrade or a base flash ?
I mean:

  • openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-squashfs-factory.bin
  • openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-initramfs-kernel.bin
  • openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-squashfs-sysupgrade.bin

(as it does a re-partition I wonder)
Thank you

referring to "AFAIK firmware-utils patches are just accepted on the openwrt-devel mailing list right now."

I am not sure I understood it but I will try ...

@ruildias To Test the Changed Partitions you should restore the vendor software first.
Then reinstall new openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-squashfs-factory.bin version and make sure it works correctly.
Then you can test a sysupgrade using the openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-squashfs-sysupgrade.bin as all this should be tested and working before creating a PR or submitting anything to the mailing list.

yes I understood that would enable the direct original firmware from the vendor, and this would mean that I would need to do tftp recover procedure. Correct ?
In order to avoid that what I was proposing is to flash with the openwrt FW (with the updated partitioning), then to check if I could go back to the original TPLINK FW.
Isn't this procedure possible as well ?

@ruildias Yes you can try a sysupgrade with the updated FW then try to sysupgrade to the TP Link firmware and see if it works.
If it does not work, you will need to follow the tftp recovery procedure and may need a switch in between your device and the computer.

1 Like

@back to the "make" factory ... this takes time!

So, will use the "openwrt-22.03.1-ath79-generic-tplink_cpe605-v1-squashfs-sysupgrade.bin" generated file after that is finished and then re-flash the original firmware.

With success (I mean with the same IP and responding :-)), is there a way to check if the parameters changed were effective ? Before re-flashing the original firmware ?