[PATCH] firmware-utils: tplink-safeloader: support displaying fw info
Sander Vanheule
sander at svanheule.net
Sat Apr 10 19:02:20 BST 2021
Hi Rafał,
This looks like a useful addition to the safeloader tool.
On Thu, 2021-04-08 at 23:49 +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
>
> Add "-i" option for reading & displaying firmware info. First it lists
> in-firmware partitions ("fwup-ptn"). Then it checks for human
> understandable partitions and prints data found in each of them.
>
> This new feature is meant for development & debug purposes.
>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> ---
[...]
> +
> + e = find_partition(pointers, MAX_PARTITIONS, "soft-version", NULL);
> + if (e) {
> + struct soft_version s;
> +
> + if (fseek(fp, 0x1014 + e->base + sizeof(struct meta_header), SEEK_SET))
> + error(1, errno, "Can not seek in the firmware");
> +
> + if (fread(&s, sizeof(s), 1, fp) != 1)
> + error(1, errno, "Can not read fwup-ptn from
> the firmware");
> +
> + printf("\n[Software version]\n");
> + printf("Version: %d.%d.%d\n", s.version_major, s.version_minor, s.version_patch);
> + printf("Date: %02x%02x-%02x-%02x\n", s.year_hi, s.year_lo, s.month, s.day);
> + }
The soft-version part doesn't necessarily have this structured content. Then there are still two
versions: without and with the compatibility level at the end (seen on TP-Link's newer EAP devices).
Maybe you can use the data length of this partition to choose the 'most likely' layout?
Best,
Sander
More information about the openwrt-devel
mailing list