From 467dc9a44b7b5654089ea1334a14ffd20c028916 Mon Sep 17 00:00:00 2001 From: Austin Shirley Date: Wed, 6 May 2026 16:37:58 -0600 Subject: configs: stm32mp13: add SPI-NAND UBI boot support The STM32MP13 default environment only handles MMC and serial/USB boot. When TF-A reports BOOT_FLASH_SPINAND the boot_device variable is set to 'spi-nand' but bootcmd_stm32mp never redirects boot_targets to ubifs0, so distro_bootcmd falls through to MMC/USB. This change mirrors the STM32MP15 logic: - Add a BOOT_TARGET_UBIFS entry to BOOT_TARGET_DEVICES so that bootcmd_ubifs0 is defined (ubi part UBI; ubifsmount ubi0:boot). - Add the 'spi-nand' / 'nand' clause to bootcmd_stm32mp so that boot_targets is set to 'ubifs0' when booting from NAND. Signed-off-by: Austin Shirley Cc: Patrick Delaunay Cc: Patrice Chotard Cc: Tom Rini Cc: uboot-stm32@st-md-mailman.stormreply.com --- include/configs/stm32mp13_common.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/configs/stm32mp13_common.h b/include/configs/stm32mp13_common.h index 3e3f49abae0..e707b146f90 100644 --- a/include/configs/stm32mp13_common.h +++ b/include/configs/stm32mp13_common.h @@ -33,6 +33,12 @@ #define BOOT_TARGET_MMC1(func) #endif +#ifdef CONFIG_CMD_UBIFS +#define BOOT_TARGET_UBIFS(func) func(UBIFS, ubifs, 0, UBI, boot) +#else +#define BOOT_TARGET_UBIFS(func) +#endif + #ifdef CONFIG_CMD_USB #define BOOT_TARGET_USB(func) func(USB, usb, 0) #else @@ -41,12 +47,14 @@ #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_MMC1(func) \ + BOOT_TARGET_UBIFS(func) \ BOOT_TARGET_MMC0(func) \ BOOT_TARGET_USB(func) /* * default bootcmd for stm32mp13: * for serial/usb: execute the stm32prog command + * for nand or spi-nand boot, distro boot with ubifs on UBI partition * for mmc boot (eMMC, SD card), distro boot on the same mmc device */ #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \ @@ -56,7 +64,10 @@ "else " \ "run env_check;" \ "if test ${boot_device} = mmc;" \ - "then env set boot_targets \"mmc${boot_instance}\"; fi;" \ + "then env set boot_targets \"mmc${boot_instance}\"; fi; " \ + "if test ${boot_device} = nand ||" \ + " test ${boot_device} = spi-nand ;" \ + "then env set boot_targets ubifs0; fi;" \ "run distro_bootcmd;" \ "fi;\0" -- cgit v1.2.3 From 2a55938b42b90eb656fe32384294318e37305830 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Thu, 30 Apr 2026 10:06:02 +0200 Subject: lib: uuid: add partition type GUID for extended bootloader The Extended Boot Loader Partition (XBOOTLDR) is a standard defined by the Discoverable Partitions Specification (DPS) to host boot loader resources outside of the EFI System Partition ([1], [2]). Defining this GUID (bc13c2ff-59e6-4262-a352-b275fd6f7172) allows U-Boot to correctly identify and label these partitions using the "xbootldr" shorthand. [1] https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#extended-boot-loader-partition:~:text=UEFI%20Specification.-,Extended%20Boot%20Loader%20Partition,-bc13c2ff%2D59e6%2D4262 [2] https://uapi-group.org/specifications/specs/boot_loader_specification/ Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass --- include/part_efi.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/part_efi.h b/include/part_efi.h index 2cea5088046..5713b3018f4 100644 --- a/include/part_efi.h +++ b/include/part_efi.h @@ -60,6 +60,9 @@ #define PARTITION_U_BOOT_ENVIRONMENT \ EFI_GUID( 0x3de21764, 0x95bd, 0x54bd, \ 0xa5, 0xc3, 0x4a, 0xbe, 0x78, 0x6f, 0x38, 0xa8) +#define PARTITION_XBOOTLDR \ + EFI_GUID( 0xbc13c2ff, 0x59e6, 0x4262, \ + 0xa3, 0x52, 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72) /* Special ChromiumOS things */ #define PARTITION_CROS_KERNEL \ -- cgit v1.2.3 From 97cdde6dfad31341d5efc9a8030b90049577ab90 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Thu, 30 Apr 2026 10:06:07 +0200 Subject: fwu: add helper to get image GUID by type and bank index Introduce fwu_mdata_get_image_guid() to retrieve a specific image GUID from the FWU metadata based on the bank index and image type GUID. This allows identifying the correct partition in multi-bank (A/B) scenarios, ensuring the correct image is targeted depending on the current bank. Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass Acked-by: Ilias Apalodimas --- include/fwu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/fwu.h b/include/fwu.h index 9cee8fb085c..68a51fb4296 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -396,6 +396,17 @@ void fwu_populate_mdata_image_info(struct fwu_data *data); */ int fwu_get_mdata_size(uint32_t *mdata_size); +/** + * fwu_mdata_get_image_guid() - Get image GUID for a type and bank + * @image_guid: Pointer to be filled with the found image GUID + * @image_type_guid: Pointer to the image type GUID to search for + * @bank_index: Index of the bank + * + * Return: 0 if OK, -ve on error + */ +int fwu_mdata_get_image_guid(efi_guid_t *image_guid, + const efi_guid_t *image_type_guid, u32 bank_index); + /** * fwu_state_machine_updates() - Update FWU state of the platform * @state: FWU bank state -- cgit v1.2.3 From 4300f9f4c5d709c86297c8a8702b92af604ed7c3 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Thu, 30 Apr 2026 10:06:09 +0200 Subject: board: st: stm32mp25: support dynamic A/B bank bootup Enable automatic detection of the active A/B bank by retrieving partition GUIDs from FWU metadata. This ensures the system correctly identifies the bootable partitions even in multi-bank scenarios, falling back to a standard bootable flag scan if the UUIDs are missing. To enable A/B bank bootup on stm32mp25 boards, add the following Kconfig options to the stm32mp25_defconfig: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_NUM_BANKS=2 CONFIG_FWU_NUM_IMAGES_PER_BANK=3 CONFIG_CMD_FWU_METADATA=y CONFIG_FWU_MDATA_V2=y Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass Reviewed-by: Patrice Chotard --- include/configs/stm32mp25_st_common.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h index cb679eb1be2..0b0267ae99b 100644 --- a/include/configs/stm32mp25_st_common.h +++ b/include/configs/stm32mp25_st_common.h @@ -8,7 +8,22 @@ #ifndef __CONFIG_STM32MP25_ST_COMMON_H__ #define __CONFIG_STM32MP25_ST_COMMON_H__ +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE +#define SCAN_DEV_FOR_BOOT_PARTS \ + "setenv devplist; " \ + "env exists boot_partuuid && " \ + "part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \ + "env exists devplist || " \ + "part list ${devtype} ${devnum} -bootable devplist; " + +#define ST_STM32MP25_FWU_ENV \ + "altbootcmd=${bootcmd}\0" +#else +#define ST_STM32MP25_FWU_ENV +#endif + #define STM32MP_BOARD_EXTRA_ENV \ + ST_STM32MP25_FWU_ENV \ "usb_pgood_delay=2000\0" \ "console=ttySTM0\0" -- cgit v1.2.3