Skip to content

Conversation

@oskirby
Copy link

@oskirby oskirby commented Oct 3, 2025

This adds a new tool to create TP-Link Omada firmware files. This was created mostly by reverse engineering the firmware and bootloader on an ER8411. It also seems to be compatible with the firmware for the ER605 and possibly other models too.

Although the firmware contains an RSA signature, the bootloader's recovery mode doesn't seem to verify it, meaning that this can be used to create factory installation images through the recovery bootloader.

It's probably worth calling out that this adds the cJSON library to the project, which was used to parse/manipulate JSON partitions embedded in the firmware file. This library is licensed under the MIT license, which I believe is compatible with this project. If that's not the case, I can probably rewrite the JSON handling to use some other library that is more appropriate.

This adds a new tool to create and manipulate TP-Link Omada firmware
files. This was created mostly by reverse engineering the firmware
and bootloader on an the TP-Link ER8411. It also seems to be
compatible with the firmware for the ER605 and possibly other models
too.

Although the firmware contains an RSA signature, the bootloader doesn't
seem to verify it, meaning that this can be used to create factory
installation images via the bootloader's recovery mode.

Signed-off-by: Naomi Kirby <[email protected]>
@dangowrt
Copy link
Member

dangowrt commented Oct 4, 2025

Imho it would be better to add cJSON as tools library (ie. a dedicated package building the shared library, similar to eg. tools/libdeflate). This would prevent us from duplicating the code, and make maintenance easier in the long run (eg. automated tools we are using would point out the library being outdated, and all we'd have to do in this case would be to edit the version and hash in tools/cjson/Makefile).
Other than that the dkmgt tool itself looks fine in a quick scroll-over. Maybe the commenting style could be improved a bit, ie. no need for those whole lines of **********, and I'd say either use // comments or use /* */ style. But many of the tools in this repo look much worse, so I wouldn't hesitate to just merge it once cJSON is properly (tools-) packaged instead of embedding a copy of it.

@oskirby
Copy link
Author

oskirby commented Oct 6, 2025

Okay, I can get started packaging cJSON as a library instead.

In the meantime, is there a file or two that you would recommend as the canonical commenting style for this project that I should try to replicate? I wasn't sure which one to follow, because there are all so different.

@dangowrt
Copy link
Member

dangowrt commented Oct 6, 2025

In the meantime, is there a file or two that you would recommend as the canonical commenting style for this project that I should try to replicate?

Linux kernel style if the preferred commenting and formatting style.

By moving the default action handling to the end of the program, we
can ensure that an explicitly specified action (eg: '--print') always
takes precedence over an implicit one (eg: writing the firmware after
an update to some partition).

Signed-off-by: Naomi Kirby <[email protected]>
Some PR feedback was to try and match the Linux kernel commenting style
which means we should eliminate the full-line '*****' separators and
the use of C++ style comments.

Signed-off-by: Naomi Kirby <[email protected]>
This eliminates some duplicated code in handling JSON content embedded
in partitions, and suppresses some bogus error messages when extracting
firmware files.

Signed-off-by: Naomi Kirby <[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

Successfully merging this pull request may close these issues.

2 participants