[PATCH v3 11/11] sandbox: capsule: Generate capsule related files through binman
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 --- Changes since V2: * New patch for generating the capsules and capsule input files through binman. arch/sandbox/dts/u-boot.dtsi | 143 ++ test/py/tests/test_efi_capsule/conftest.py| 62 .../tests/test_efi_capsule/uboot_bin_env.its | 36 - 3 files changed, 143 insertions(+), 98 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..292fb86a50 100644 --- a/arch/sandbox/dts/u-boot.dtsi +++ b/arch/sandbox/dts/u-boot.dtsi @@ -13,5 +13,148 @@ 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"; + data = /incbin/("/tmp/capsules/u-boot.bin.new"); + compression = "none"; + type = "firmware"; + arch = "sandbox"; + load = <0>; + hash-1 { + algo = "sha1"; + }; + }; + u-boot-env { + description = "U-Boot environment on SPI Flash"; + data = /incbin/("/tmp/capsules/u-boot.env.new"); + compression = "none"; + type = "firmware"; + arch = "sandbox"; + load = <0>; + 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 = "09D7CF52-0720-4710-91D1-08469B7FE9C8"; + filename = "/tmp/capsules/u-boot.bin.new"; + capsule = "/tmp/capsules/Test01"; + }; + }; + + capsule3 { + capsule { + image-index = <0x2>; + image-type-id = "5A7021F5-FEF2-48B4-AABA-832E777418C0"; + filename = "/tmp/capsules/u-boot.env.new"; + capsule = "/tmp/capsules/Test02"; + }; + }; + + capsule4 { + capsule { + image-index = <0x1>; + image-type-id = "058B7D83-50D5-4C47-A195-60D86AD341C4"; + filename = "/tmp/capsules/u-boot.bin.new"; + capsule = "/tmp/capsules/Test03"; + }; + }; + + capsule5 { + capsule { + image-index = <0x1>; + image-type-id = "3673B45D-6A7C-46F3-9E60-ADABB03F7937"; + filename = "/tmp/capsules/uboot_bin_env.itb"; + capsule = "/tmp/capsules/Test04"; + }; + }; + + capsule6 { + capsule { + image-index = <0x1>; + image-type-id = "058B7D83-50D5-4C47-A195-60D86AD341C4"; + filename = "/tmp/capsules/uboot_bin_env.itb"; + capsule = "/tmp/capsules/Test05"; + }; + }; + +#ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE + capsule7 { + capsule { + im
Re: [PATCH v3 11/11] sandbox: capsule: Generate capsule related files through binman
Hi, On Sun, 9 Jul 2023 at 07:34, Sughosh Ganu 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 > --- > Changes since V2: > * New patch for generating the capsules and capsule input files > through binman. > > arch/sandbox/dts/u-boot.dtsi | 143 ++ > test/py/tests/test_efi_capsule/conftest.py| 62 > .../tests/test_efi_capsule/uboot_bin_env.its | 36 - > 3 files changed, 143 insertions(+), 98 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..292fb86a50 100644 > --- a/arch/sandbox/dts/u-boot.dtsi > +++ b/arch/sandbox/dts/u-boot.dtsi > @@ -13,5 +13,148 @@ > capsule-key = /incbin/(CONFIG_EFI_CAPSULE_ESL_FILE); > }; > #endif > + > + binman: binman { > + multiple-images; > + }; > +}; > + > +&binman { > + itb { > + filename = "/tmp/capsules/uboot_bin_env.itb"; You can't really do this, since that dir may not exist. Can you drop the path? > + > + fit { > + description = "Automatic U-Boot environment update"; > + #address-cells = <2>; > + > + images { > + u-boot-bin { > + description = "U-Boot binary on SPI > Flash"; > + data = > /incbin/("/tmp/capsules/u-boot.bin.new"); See FIT docs for how to include data in a FIT with binman. Basically you add it below * > + compression = "none"; > + type = "firmware"; > + arch = "sandbox"; > + load = <0>; > + hash-1 { > + algo = "sha1"; > + }; * blob { filename = "u-boot.bin.new"; } Please fix throughout. > + }; > + u-boot-env { > + description = "U-Boot environment on > SPI Flash"; > + data = > /incbin/("/tmp/capsules/u-boot.env.new"); > + compression = "none"; > + type = "firmware"; > + arch = "sandbox"; > + load = <0>; > + 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 = > "09D7CF52-0720-4710-91D1-08469B7FE9C8"; > + filename = "/tmp/capsules/u-boot.bin.new"; > + capsule = "/tmp/capsules/Test01"; > + }; > + }; > + > + capsule3 { > + capsule { > + image-index = <0x2>; > + image-type-id = > "5A7021F5-FEF2-48B4-AABA-832E777418C0"; > + filename = "/tmp/capsules/u-boot.env.new"; > + capsule = "/tmp/capsules/Test02"; > + }; > + }; > + > + capsule4 { > + capsule { > + image-index = <0x1>; > + image-type-id = > "058B7D83-50D5-4C47-A195-60D86AD341C4"; > + filename = "/tmp/capsules/u-boot.bin.new"; > + capsule = "/tmp/capsules/Test03"; > + }; > + }; > + > + capsule5 { > + capsule { > + image-index = <0x1>; > + image-type-id = > "3673B45D-6A7C-46F3-9E60-ADABB03F7937"; > + filename = "/tmp/capsules/u
Re: [PATCH v3 11/11] sandbox: capsule: Generate capsule related files through binman
hi Simon, On Tue, 11 Jul 2023 at 03:09, Simon Glass wrote: > > Hi, > > On Sun, 9 Jul 2023 at 07:34, Sughosh Ganu 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 > > --- > > Changes since V2: > > * New patch for generating the capsules and capsule input files > > through binman. > > > > arch/sandbox/dts/u-boot.dtsi | 143 ++ > > test/py/tests/test_efi_capsule/conftest.py| 62 > > .../tests/test_efi_capsule/uboot_bin_env.its | 36 - > > 3 files changed, 143 insertions(+), 98 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..292fb86a50 100644 > > --- a/arch/sandbox/dts/u-boot.dtsi > > +++ b/arch/sandbox/dts/u-boot.dtsi > > @@ -13,5 +13,148 @@ > > capsule-key = /incbin/(CONFIG_EFI_CAPSULE_ESL_FILE); > > }; > > #endif > > + > > + binman: binman { > > + multiple-images; > > + }; > > +}; > > + > > +&binman { > > + itb { > > + filename = "/tmp/capsules/uboot_bin_env.itb"; > > You can't really do this, since that dir may not exist. Can you drop the path? This directory does exist. I am adding logic to add the directory in patches 7 and 8 to ensure that the /tmp/capsules/ directory exists for the capsule updates testing, both for CI runs as well as local pytest test runs. > > > + > > + fit { > > + description = "Automatic U-Boot environment update"; > > + #address-cells = <2>; > > + > > + images { > > + u-boot-bin { > > + description = "U-Boot binary on SPI > > Flash"; > > + data = > > /incbin/("/tmp/capsules/u-boot.bin.new"); > > See FIT docs for how to include data in a FIT with binman. > > Basically you add it below * Okay. WIll change this. > > > + compression = "none"; > > + type = "firmware"; > > + arch = "sandbox"; > > + load = <0>; > > + hash-1 { > > + algo = "sha1"; > > + }; > > * >blob { > filename = "u-boot.bin.new"; >} > > Please fix throughout. > > > + }; > > + u-boot-env { > > + description = "U-Boot environment > > on SPI Flash"; > > + data = > > /incbin/("/tmp/capsules/u-boot.env.new"); > > + compression = "none"; > > + type = "firmware"; > > + arch = "sandbox"; > > + load = <0>; > > + 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 = > > "09D7CF52-0720-4710-91D1-08469B7FE9C8"; > > + filename = "/tmp/capsules/u-boot.bin.new"; > > + capsule = "/tmp/capsules/Test01"; > > + }; > > + }; > > + > > + capsule3 { > > + capsule { > > + image-index = <0x2>; > > + image-type-id = > > "5A7021F5-FEF2-48B4-AABA-832E777418C0"; > > + filename = "/tmp/capsules/u-boot.env.new"; > > + capsule = "/tmp/capsules/Test02"; > > + }; > > + }; > > + > > + capsule4 { > >
Re: [PATCH v3 11/11] sandbox: capsule: Generate capsule related files through binman
Hi Sughosh, On Tue, 11 Jul 2023 at 01:24, Sughosh Ganu wrote: > > hi Simon, > > On Tue, 11 Jul 2023 at 03:09, Simon Glass wrote: > > > > Hi, > > > > On Sun, 9 Jul 2023 at 07:34, Sughosh Ganu 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 > > > --- > > > Changes since V2: > > > * New patch for generating the capsules and capsule input files > > > through binman. > > > > > > arch/sandbox/dts/u-boot.dtsi | 143 ++ > > > test/py/tests/test_efi_capsule/conftest.py| 62 > > > .../tests/test_efi_capsule/uboot_bin_env.its | 36 - > > > 3 files changed, 143 insertions(+), 98 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..292fb86a50 100644 > > > --- a/arch/sandbox/dts/u-boot.dtsi > > > +++ b/arch/sandbox/dts/u-boot.dtsi > > > @@ -13,5 +13,148 @@ > > > capsule-key = /incbin/(CONFIG_EFI_CAPSULE_ESL_FILE); > > > }; > > > #endif > > > + > > > + binman: binman { > > > + multiple-images; > > > + }; > > > +}; > > > + > > > +&binman { > > > + itb { > > > + filename = "/tmp/capsules/uboot_bin_env.itb"; > > > > You can't really do this, since that dir may not exist. Can you drop the > > path? > > This directory does exist. I am adding logic to add the directory in > patches 7 and 8 to ensure that the /tmp/capsules/ directory exists for > the capsule updates testing, both for CI runs as well as local pytest > test runs. OK I see. Then you should use --toolpath to binman to add that directory, e.g. by setting BINMAN_TOOLPATHS. [..] > > > -check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid > > > 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test04' % > > > - (data_dir, u_boot_config.build_dir), > > > - shell=True) > > > -check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid > > > 058B7D83-50D5-4C47-A195-60D86AD341C4 uboot_bin_env.itb Test05' % > > > > Please put the GUIDs in variables or a dict and give them names. > > Do you mean for the code that is getting added in the binman nodes? > The above code is actually getting removed. Oops OK, I see. Regards, SImon