[PATCH v4] tplink-safeloader: Patch to handle partitions with alternate names.
Ole Kristian Lona
ole.kristian at lona.name
Mon May 23 00:43:28 PDT 2022
Thanks!
I agree! In the end, this turned into a patch that ended up making some of the original code better, by moving all the hard-coded partition names into "defaults" that are all gathered in one function. Of course, further improvement could be to move the defaults into #define - statements in the beginning, but I guess tplink-safeloader will see a limited number of new devices going forward, as my newest devices, the X60, use UBI, with a different format for wrapping the image.
Best regards,
Ole Kristian
On 20/05/2022, 20:50, "Sander Vanheule" <sander at svanheule.net> wrote:
Hi Ole Kristian,
Thanks for the updates, this has turned into a pretty clean patch :)
On Mon, 2022-05-16 at 15:50 +0200, Ole Kristian Lona wrote:
> Some devices, specifically Deco M4R-v3 / M5 have partition names that
> deviate from the scheme other devices use. They have an added "@0"
> and "@1" for some partition names.
>
> The devices have fallback partitions which will be used in case the
> device determines that the primary partition set is unbootable.
>
> This patch introduces an option to set these alternate partition names
> in the device definition of tplink-safeloader.
>
> Signed-off-by: Ole Kristian Lona <oklo at oklona.net>
With one minor comment below:
Reviewed-by: Sander Vanheule <sander at svanheule.net>
> ---
>
> @@ -2993,9 +3022,9 @@ static struct image_partition_entry make_partition_table(const struct
> flash_part
> *(s++) = 0x00;
>
> size_t i;
> - for (i = 0; p[i].name; i++) {
> + for (i = 0; p->partitions[i].name; i++) {
> size_t len = end-s;
> - size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n", p[i].name,
> p[i].base, p[i].size);
> + size_t w = snprintf(s, len, "partition %s base 0x%05x size 0x%05x\n", p-
> >partitions[i].name, p->partitions[i].base, p->partitions[i].size);
If feel it would be better to split this line. There are long lines in this file, but 155 characters
seems a bit excessive.
As far as I'm concerned, you don't have to resubmit this patch if this is the only comment left.
Reflowing a single line can be done when merging.
Best,
Sander
More information about the openwrt-devel
mailing list