hi Etienne, On Wed, 8 Dec 2021 at 18:44, Etienne Carriere <[email protected]> wrote:
> On Thu, 25 Nov 2021 at 08:03, Sughosh Ganu <[email protected]> > wrote: > > > > With the FWU multi bank update feature enabled, the dfu alt no that is > > used to identify the partition to be updated is derived at runtime and > > should match the partition number on the storage media. Achieve this > > by moving the ram partitions to the end of the dfu_alt_info variable. > > > > Signed-off-by: Sughosh Ganu <[email protected]> > > --- > > board/st/common/stm32mp_dfu.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/board/st/common/stm32mp_dfu.c > b/board/st/common/stm32mp_dfu.c > > index 00d1fb8f59..394a2704ee 100644 > > --- a/board/st/common/stm32mp_dfu.c > > +++ b/board/st/common/stm32mp_dfu.c > > @@ -102,6 +102,7 @@ static void board_get_alt_info_mtd(struct mtd_info > *mtd, char *buf) > > > > void set_dfu_alt_info(char *interface, char *devstr) > > { > > + int len; > > struct udevice *dev; > > struct mtd_info *mtd; > > > > @@ -112,9 +113,6 @@ void set_dfu_alt_info(char *interface, char *devstr) > > > > memset(buf, 0, sizeof(buf)); > > > > - snprintf(buf, DFU_ALT_BUF_LEN, > > - "ram 0=%s", CONFIG_DFU_ALT_RAM0); > > - > > if (CONFIG_IS_ENABLED(MMC)) { > > if (!uclass_get_device(UCLASS_MMC, 0, &dev)) > > board_get_alt_info_mmc(dev, buf); > > @@ -151,6 +149,13 @@ void set_dfu_alt_info(char *interface, char *devstr) > > strncat(buf, "&virt 1=PMIC", DFU_ALT_BUF_LEN); > > } > > > > + len = strlen(buf); > > + if (buf[0] != '\0') > > + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, "&"); > > + > > + snprintf(buf + len, DFU_ALT_BUF_LEN, > > + "ram 0=%s", CONFIG_DFU_ALT_RAM0); > > s/DFU_ALT_BUF_LEN/DFU_ALT_BUF_LEN - len/ > > Should check snprintf() return value. > This patch would not be needed, if what Patrick suggested[1] works. -sughosh [1] - https://lists.denx.de/pipermail/u-boot/2021-December/469256.html > > + > > env_set("dfu_alt_info", buf); > > puts("DFU alt info setting: done\n"); > > } > > -- > > 2.17.1 > > >

