[PATCH v5 12/12] sandbox: capsule: Generate capsule related files through binman

Simon Glass sjg at chromium.org
Wed Jul 26 00:52:41 CEST 2023


Hi Sughosh,

On Tue, 25 Jul 2023 at 02:58, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
>
> The EFI capsule files can now be generated as part of u-boot
> build. This is done through binman. Add capsule entry nodes in the
> u-boot.dtsi for the sandbox architecture for generating the
> capsules. Remove the corresponding generation of capsules from the
> capsule update conftest file.
>
> The capsules are generated through the config file for the sandbox
> variant, and through explicit parameters for the sandbox_flattree
> variant.
>
> Also generate the FIT image used for testing the capsule update
> feature on the sandbox_flattree variant through binman. Remove the now
> superfluous its file which was used for generating this FIT image.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> ---
> Changes since V4:
> * Define macros for the image GUIDs being used for generating the
>   capsules.
> * Use lower case for image GUIDs.
>
>  arch/sandbox/dts/u-boot.dtsi                  | 271 ++++++++++++++++++
>  test/py/tests/test_efi_capsule/conftest.py    | 127 --------
>  .../tests/test_efi_capsule/uboot_bin_env.its  |  36 ---
>  3 files changed, 271 insertions(+), 163 deletions(-)
>  delete mode 100644 test/py/tests/test_efi_capsule/uboot_bin_env.its
>
> diff --git a/arch/sandbox/dts/u-boot.dtsi b/arch/sandbox/dts/u-boot.dtsi
> index 60bd004937..7606db3764 100644
> --- a/arch/sandbox/dts/u-boot.dtsi
> +++ b/arch/sandbox/dts/u-boot.dtsi
> @@ -7,11 +7,282 @@
>   */
>
>  #ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
> +
> +#define SANDBOX_UBOOT_IMAGE_GUID       "09d7cf52-0720-4710-91d1-08469b7fe9c8"
> +#define SANDBOX_UBOOT_ENV_IMAGE_GUID   "5a7021f5-fef2-48b4-aaba-832e777418c0"
> +#define SANDBOX_FIT_IMAGE_GUID         "3673b45d-6a7c-46f3-9e60-adabb03f7937"
> +#define SANDBOX_INCORRECT_GUID         "058b7d83-50d5-4c47-a195-60d86ad341c4"

That looks better

> +
>  / {
>  #ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE
>         signature {
>                 capsule-key = /incbin/(CONFIG_EFI_CAPSULE_ESL_FILE);
>         };
>  #endif
> +
> +       binman: binman {
> +               multiple-images;
> +       };
> +};
> +
> +&binman {
> +       itb {
> +               filename = "/tmp/capsules/uboot_bin_env.itb";
> +
> +               fit {
> +                       description = "Automatic U-Boot environment update";
> +                       #address-cells = <2>;
> +
> +                       images {
> +                               u-boot-bin {
> +                                       description = "U-Boot binary on SPI Flash";
> +                                       compression = "none";
> +                                       type = "firmware";
> +                                       arch = "sandbox";
> +                                       load = <0>;
> +                                       blob {
> +                                               filename = "/tmp/capsules/u-boot.bin.new";
> +                                       };
> +
> +                                       hash-1 {
> +                                               algo = "sha1";
> +                                       };
> +                               };
> +                               u-boot-env {
> +                                       description = "U-Boot environment on SPI Flash";
> +                                       compression = "none";
> +                                       type = "firmware";
> +                                       arch = "sandbox";
> +                                       load = <0>;
> +                                       blob {
> +                                               filename = "/tmp/capsules/u-boot.env.new";
> +                                       };
> +
> +                                       hash-1 {
> +                                               algo = "sha1";
> +                                       };
> +                               };
> +                       };
> +               };
> +       };
> +
> +#ifdef CONFIG_EFI_USE_CAPSULE_CFG_FILE
> +       capsule1 {
> +               capsule {
> +                       cfg-file = CONFIG_EFI_CAPSULE_CFG_FILE;
> +               };
> +       };
> +#else
> +       capsule2 {
> +               capsule {
> +                       image-index = <0x1>;
> +                       image-type-id = SANDBOX_UBOOT_IMAGE_GUID;
> +                       filename = "/tmp/capsules/u-boot.bin.new";
> +                       capsule = "/tmp/capsules/Test01";

You can do:

   capsule-2 {
      type = "efi-capsule";
   }

and avoid the double nesting.

As per my other contents, you can't refer to filenames here...just put
the things you want in the capsule as subnodes of the capsule node.
[..]

Regards,
Simon


More information about the U-Boot mailing list