public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank
@ 2023-07-13 14:36 Michal Simek
  2023-07-13 15:59 ` Jassi Brar
  2023-07-25 21:13 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2023-07-13 14:36 UTC (permalink / raw)
  To: u-boot, git; +Cc: Jassi Brar, Masami Hiramatsu

Code rewrites the last char of size with adding &. It is visible from
dfu_alt_info print before this patch:

Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
8000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'

And after it:
Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
80000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'

Size for bank0 and bank1 must be the same because it is the same image.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 lib/fwu_updates/fwu_mtd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c
index b73111ae24da..69cd3d7001f9 100644
--- a/lib/fwu_updates/fwu_mtd.c
+++ b/lib/fwu_updates/fwu_mtd.c
@@ -175,8 +175,10 @@ int fwu_gen_alt_info_from_mtd(char *buf, size_t len, struct mtd_info *mtd)
 
 		l = strlen(buf);
 		/* Replace the last ';' with '&' if there is another image. */
-		if (i != CONFIG_FWU_NUM_IMAGES_PER_BANK - 1 && l)
-			buf[l - 1] = '&';
+		if (i != CONFIG_FWU_NUM_IMAGES_PER_BANK - 1 && l) {
+			buf[l] = '&';
+			buf++;
+		}
 		len -= l;
 		buf += l;
 	}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank
  2023-07-13 14:36 [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank Michal Simek
@ 2023-07-13 15:59 ` Jassi Brar
  2023-07-25 21:13 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Jassi Brar @ 2023-07-13 15:59 UTC (permalink / raw)
  To: Michal Simek; +Cc: u-boot, git, Masami Hiramatsu

On Thu, 13 Jul 2023 at 09:36, Michal Simek <michal.simek@amd.com> wrote:
>
> Code rewrites the last char of size with adding &. It is visible from
> dfu_alt_info print before this patch:
>
> Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
> 8000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'
>
> And after it:
> Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
> 80000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'
>
> Size for bank0 and bank1 must be the same because it is the same image.
>
> Signed-off-by: Michal Simek <michal.simek@amd.com>

Acked-by: Jassi Brar <jaswinder.singh@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank
  2023-07-13 14:36 [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank Michal Simek
  2023-07-13 15:59 ` Jassi Brar
@ 2023-07-25 21:13 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-07-25 21:13 UTC (permalink / raw)
  To: Michal Simek; +Cc: u-boot, git, Jassi Brar, Masami Hiramatsu

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

On Thu, Jul 13, 2023 at 04:36:27PM +0200, Michal Simek wrote:

> Code rewrites the last char of size with adding &. It is visible from
> dfu_alt_info print before this patch:
> 
> Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
> 8000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'
> 
> And after it:
> Make dfu_alt_info: 'mtd nor0=bank0 raw 2320000 80000;bank1 raw 27a0000
> 80000&mtd nor0=bank0 raw 23a0000 4000000;bank1 raw 2820000 4000000'
> 
> Size for bank0 and bank1 must be the same because it is the same image.
> 
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> Acked-by: Jassi Brar <jaswinder.singh@linaro.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-25 21:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-13 14:36 [PATCH] fwu: mtd: Fix dfu_alt_info generation for 2 images per bank Michal Simek
2023-07-13 15:59 ` Jassi Brar
2023-07-25 21:13 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox