tplink-safeloader support-list on CPE/WBS devices
Sander Vanheule
sander at svanheule.net
Mon Aug 31 05:18:32 EDT 2020
Hi Adrian,
On Sun, 2020-08-30 at 22:43 +0200, Adrian Schmutzler wrote:
> Hi,
>
> while increasing the kernel partition for the TP-Link CPE devices, I
> found that the partitions called "soft-version" and "support-list"
> are handled as a part of the file-system/firmware partition, in
> contrast to all other tplink-safeloader devices where it is part of a
> read-only partition. Examples:
>
> CPE210 v1 (ar9344-based with okli loader, but without firmware-
> splitter):
>
> tplink-safeloader.c:
>
> {"os-image", 0x40000, 0x300000},
> {"file-system", 0x340000, 0x470000},
> {"soft-version", 0x7b0000, 0x00100},
> {"support-list", 0x7b1000, 0x00400},
> {"user-config", 0x7c0000, 0x10000},
>
> .first_sysupgrade_partition = "os-image",
> .last_sysupgrade_partition = "support-list",
Looking at the stock firmware partition table of the CPE210 v1/v2, I
see the following:
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
The order of the file-system and 'device-info' partitions have been
swapped, (probably) to allow for larger kernels.
> DTSI:
>
> partition at 40000 {
> label = "firmware";
> reg = <0x040000 0x780000>;
>
> compatible = "fixed-partitions";
> #address-cells = <1>;
> #size-cells = <1>;
>
> partition at 0 {
> label = "kernel";
> reg = <0x000000 0x300000>;
> };
>
> partition at 300000 {
> label = "rootfs";
> reg = <0x300000 0x480000>;
> };
> };
If my ELF mtdsplitter ever gets merged, you can replace this with a
single firmware partition, and you don't need to resize the kernel
partition any more.
> partition at 7c0000 {
> label = "config";
> reg = <0x7c0000 0x030000>;
> read-only;
> };
>
> CPE210 v2 (qca9533-based with firmware-splitter):
>
> tplink-safeloader.c:
>
> {"firmware", 0x40000, 0x770000},
> {"soft-version", 0x7b0000, 0x00100},
> {"support-list", 0x7b1000, 0x01000},
> {"user-config", 0x7c0000, 0x10000},
>
> .first_sysupgrade_partition = "os-image",
> .last_sysupgrade_partition = "support-list",
>
> DTSI:
>
> partition at 40000 {
> label = "firmware";
> reg = <0x040000 0x780000>;
> compatible = "tplink,firmware";
> };
>
> config: partition at 7c0000 {
> label = "config";
> reg = <0x7c0000 0x030000>;
> read-only;
> };
> .first_sysupgrade_partition = "os-image",
> .last_sysupgrade_partition = "file-system",
>
> So, I wonder whether:
> 1. the areas should really be rw for CPE devices, or whether it would
> be better to just include them in the config partition
> 2. support-list/soft-version should really be between
> first_sysupgrade_partition and last_sysupgrade_partition
>
> Any hints/ideas?
The above reordering means that, when converting the device to OpenWrt,
the following partitions need to be written:
* partition-table
* os-image (firmware)
* file-system (firmware)
* soft-version
* support-list
I don't know the behaviour TP-Link's upgrade code on these devices, but
soft-version is normally rewritten to update the FW version info. I'm
not sure about support-list and partition-table. At least the newly
provided partition-table is honoured, otherwise file-system would end
up in the wrong place.
When you use the current sysupgrade images to perform the initial
OpenWrt flash (e.g. flashing from u-boot), partition-table would be
left untouched and out-of-sync with the flash layout. So this scenario
doesn't sound like a good way of upgrading.
For OpenWrt to OpenWrt upgrades (after a factory upgrade), I think you
are right that soft-version and support-list can be left untouched.
last_sysupgrade_partition could then be 'file-system', given the
modified partition table for these devices.
Best,
Sander
More information about the openwrt-devel
mailing list