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 <[email protected]>
> 
> 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 <[email protected]>
> ---

[...]

> +
> +       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


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to