Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oversized support list on TPLink Archer C60 devices #15

Open
lfdominguez-servinfo opened this issue Sep 22, 2023 · 2 comments
Open

Oversized support list on TPLink Archer C60 devices #15

lfdominguez-servinfo opened this issue Sep 22, 2023 · 2 comments

Comments

@lfdominguez-servinfo
Copy link

lfdominguez-servinfo commented Sep 22, 2023

On file tplink-safeloader.c, at the definitions of C60 devices (line 1404, 1439, 1476), there is a string for supported-list that is bigger than 256 bytes (0x100), but on the partitions definitions right there the limit is 0x100. So how is openwrt compiling this firmware using these definitions, if changing is needed why is not reflected in the code? I've tried to compile the firmware to my C60 v3 and of course shows an error that the support-list exceeds the 256 limit.

@lfdominguez-servinfo
Copy link
Author

image

@svanheule
Copy link
Member

It looks like the firmware partition ends at 0x7d0000, while soft-version only starts at 0x79d9500. That leaves a bit of empty space (0x9500 or 38k bytes). Normally stock firmware is able to handle "re-partitioning", so I think it might be possible to resize soft-version to start at 0x7d9000 with a size of 0x600 bytes. (or e.g. 0x9400/0x200). Only one way to find out: just try it.

My approach would be to first dump the original flash contents, and validate that the empty space in the partition table is indeed unused. (Empty flash is all 0xff).
Then you could try with a custom modified factory image. You can make a change firmware-utils, then use git format-patch to export it and place it in your openwrt tree at tools/firmware-utils/patches/ (you will probably need to create this directory).

Please make sure you have way to dump and write flash using external means like an SOIC-8 clip, or you may end up with a bricked device if this approach doesn't work.

svanheule added a commit to svanheule/firmware-utils that referenced this issue Mar 17, 2024
Latest firmwares for the TP-Link Archer C60 v3 contain an updated
partition table. Stock firmware images relocate the following partitions
and simultaneously provide updated contents for them:
    OFFSET   SIZE     NAME              OPERATION
    007d9500 00000100 soft-version      Not moved
    007d9600 00000200 support-list	Not moved, grows by 0x100 bytes
    007d9800 00000100 extra-para	Moved by 0x100
    007d9900 00003000 profile		ibid.
    007dc900 00002900 default-config    ibid., shrunk by 0x100 bytes

This re-partitioning is done to allow for a larger 'support-list'
partition. As noted in commit 2987b53 ("ath79: add support for
TP-Link Archer C60 v3"), the differing partition layout at the start of
flash is due to another reason.

Factory images generated by this tool do not provide the 'profile' and
'default-config' partitions, meaning they cannot safely relocate them.
Between the 'firmware' and 'soft-version' partitions, there is however a
gap of 0x9500 bytes. Instead of moving the partitions following
'support-list' down by 0x100 bytes, we can move the preceding one up.
Since the latest stock firmware image is over 3 years old, this resize
should be sufficient and not needed again in the future.

This should not impact users reverting back from OpenWrt to stock, as
the running firmware will read the partition table to correctly locate
any needed partitions.

Link: openwrt#15
Signed-off-by: Sander Vanheule <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants