[PATCH RFC 4/4] sandbox: switch to dynamic UUIDs
Ilias Apalodimas
ilias.apalodimas at linaro.org
Fri May 24 08:13:39 CEST 2024
On Fri, 26 Apr 2024 at 17:19, Caleb Connolly <caleb.connolly at linaro.org> wrote:
>
> Migrate sandbox over to generating it's capsule update image GUIDs
> dynamically rather than using a set of hardcoded ones.
>
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
> arch/Kconfig | 1 +
> board/sandbox/sandbox.c | 28 +++++++++++++++-------------
> 2 files changed, 16 insertions(+), 13 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index abd406d48841..0558c90540b6 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -164,8 +164,9 @@ config SANDBOX
> select SYS_CACHE_SHIFT_4
> select IRQ
> select SUPPORT_EXTENSION_SCAN if CMDLINE
> select SUPPORT_ACPI
> + select EFI_CAPSULE_DYNAMIC_UUIDS if EFI_HAVE_CAPSULE_SUPPORT
> imply BITREVERSE
> select BLOBLIST
> imply LTO
> imply CMD_DM
> diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
> index 802596569c64..68a99ce1fc07 100644
> --- a/board/sandbox/sandbox.c
> +++ b/board/sandbox/sandbox.c
> @@ -31,36 +31,24 @@
> */
> gd_t *gd;
>
> #if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
> -/* GUIDs for capsule updatable firmware images */
> -#define SANDBOX_UBOOT_IMAGE_GUID \
> +#define SANDBOX_CAPSULE_UPDATE_SALT \
> EFI_GUID(0x09d7cf52, 0x0720, 0x4710, 0x91, 0xd1, \
> 0x08, 0x46, 0x9b, 0x7f, 0xe9, 0xc8)
>
> -#define SANDBOX_UBOOT_ENV_IMAGE_GUID \
> - EFI_GUID(0x5a7021f5, 0xfef2, 0x48b4, 0xaa, 0xba, \
> - 0x83, 0x2e, 0x77, 0x74, 0x18, 0xc0)
> -
> -#define SANDBOX_FIT_IMAGE_GUID \
> - EFI_GUID(0x3673b45d, 0x6a7c, 0x46f3, 0x9e, 0x60, \
> - 0xad, 0xab, 0xb0, 0x3f, 0x79, 0x37)
> -
> struct efi_fw_image fw_images[] = {
> #if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)
> {
> - .image_type_id = SANDBOX_UBOOT_IMAGE_GUID,
> .fw_name = u"SANDBOX-UBOOT",
> .image_index = 1,
> },
> {
> - .image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID,
> .fw_name = u"SANDBOX-UBOOT-ENV",
> .image_index = 2,
> },
> #elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)
> {
> - .image_type_id = SANDBOX_FIT_IMAGE_GUID,
> .fw_name = u"SANDBOX-FIT",
> .image_index = 1,
> },
> #endif
> @@ -122,8 +110,22 @@ int dram_init(void)
> }
>
> int board_init(void)
> {
> + int ret;
> +
> + if (CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)) {
> + efi_guid_t salt_guid = SANDBOX_CAPSULE_UPDATE_SALT;
> +
> + ret = efi_capsule_update_info_gen_ids(&salt_guid,
> + "sandbox",
> + ofnode_read_string(ofnode_root(), "model"),
> + ofnode_read_string(ofnode_root(), "compatible"));
> + if (ret) {
> + printf("Failed to generate GUIDs: %d\n", ret);
> + return ret;
> + }
> + }
> return 0;
> }
>
> int ft_board_setup(void *fdt, struct bd_info *bd)
>
> --
> 2.44.0
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
More information about the U-Boot
mailing list