diff mbox series

[v5,11/12] sandbox: capsule: Add a config file for generating capsules

Message ID 20230725085725.350917-12-sughosh.ganu@linaro.org
State New
Headers show
Series Integrate EFI capsule tasks into u-boot's build flow | expand

Commit Message

Sughosh Ganu July 25, 2023, 8:57 a.m. UTC
Support has been added to the mkeficapsule tool to generate capsules
by parsing the capsule parameters through a config file. Add a config
file for generating capsules. These capsules will be used for testing
the capsule update feature on sandbox platform.

Enable generation of capsules through the config file on the sandbox
variant.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
Changes since V4:
* Use a relative path for CONFIG_EFI_CAPSULE_CFG_FILE.
* Remove logic to copy capsule config file to /tmp/capsules/
  directory, as the capsule entry can handle relative paths.
* Add a comment in the capsule config file for the image GUIDs being
  used.
* Use lower case for image GUIDs.

 configs/sandbox_defconfig                     |   2 +
 .../test_efi_capsule/sandbox_capsule_cfg.txt  | 175 ++++++++++++++++++
 2 files changed, 177 insertions(+)
 create mode 100644 test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt

Comments

Simon Glass July 25, 2023, 10:52 p.m. UTC | #1
Hi Sughosh,

On Tue, 25 Jul 2023 at 02:58, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Support has been added to the mkeficapsule tool to generate capsules
> by parsing the capsule parameters through a config file. Add a config
> file for generating capsules. These capsules will be used for testing
> the capsule update feature on sandbox platform.
>
> Enable generation of capsules through the config file on the sandbox
> variant.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V4:
> * Use a relative path for CONFIG_EFI_CAPSULE_CFG_FILE.
> * Remove logic to copy capsule config file to /tmp/capsules/
>   directory, as the capsule entry can handle relative paths.
> * Add a comment in the capsule config file for the image GUIDs being
>   used.
> * Use lower case for image GUIDs.
>
>  configs/sandbox_defconfig                     |   2 +
>  .../test_efi_capsule/sandbox_capsule_cfg.txt  | 175 ++++++++++++++++++
>  2 files changed, 177 insertions(+)
>  create mode 100644 test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt

Please just drop the config file, at least for now. It is a whole
other can of worms and we have enough of those already,

Regards,
Simon
diff mbox series

Patch

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 53e342b3fa..49ca6f5f61 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -343,6 +343,8 @@  CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_EFI_CAPSULE_AUTHENTICATE=y
 CONFIG_EFI_CAPSULE_ESL_FILE="/tmp/capsules/SIGNER.esl"
+CONFIG_EFI_CAPSULE_CFG_FILE="test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt"
+CONFIG_EFI_USE_CAPSULE_CFG_FILE=y
 CONFIG_EFI_SECURE_BOOT=y
 CONFIG_TEST_FDTDEC=y
 CONFIG_UNIT_TEST=y
diff --git a/test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt b/test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt
new file mode 100644
index 0000000000..bfce3bbb5f
--- /dev/null
+++ b/test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt
@@ -0,0 +1,175 @@ 
+# This is a config file used for generating EFI capsules for the
+# sandbox platform. The image GUIDs used in this file are as
+# follows
+#
+# 09d7cf52-0720-4710-91d1-08469b7fe9c8 - u-boot image GUID
+#
+# 5a7021f5-fef2-48b4-aaba-832e777418c0 - u-boot env image GUID
+#
+# 3673b45d-6a7c-46f3-9e60-adabb03f7937 - FIT image GUID
+#
+# 058b7d83-50d5-4c47-a195-60d86ad341c4 - Incorrect GUID for the platform
+#
+
+{
+	image-index: 1
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test01
+}
+{
+	image-index: 2
+	image-guid: 5a7021f5-fef2-48b4-aaba-832e777418c0
+	payload: /tmp/capsules/u-boot.env.new
+	capsule: /tmp/capsules/Test02
+}
+{
+	image-index: 1
+	image-guid: 058b7d83-50d5-4c47-a195-60d86ad341c4
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test03
+
+}
+{
+	image-index: 1
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test04
+
+}
+{
+	image-index: 1
+	image-guid: 058b7d83-50d5-4c47-a195-60d86ad341c4
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test05
+
+}
+{
+	image-index: 1
+	image-guid: 058b7d83-50d5-4c47-a195-60d86ad341c4
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test05
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test11
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER2.key
+	pub-key-cert: /tmp/capsules/SIGNER2.crt
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test12
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test13
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER2.key
+	pub-key-cert: /tmp/capsules/SIGNER2.crt
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test14
+}
+{
+	image-index: 1
+	fw-version: 5
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test101
+}
+{
+	image-index: 2
+	fw-version: 10
+	image-guid: 5a7021f5-fef2-48b4-aaba-832e777418c0
+	payload: /tmp/capsules/u-boot.env.new
+	capsule: /tmp/capsules/Test102
+}
+{
+	image-index: 1
+	fw-version: 2
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test103
+
+}
+{
+	image-index: 1
+	fw-version: 5
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test104
+}
+{
+	image-index: 1
+	fw-version: 2
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test105
+
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	fw-version: 5
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test111
+}
+{
+	image-index: 2
+	monotonic-count: 1
+	fw-version: 10
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 5a7021f5-fef2-48b4-aaba-832e777418c0
+	payload: /tmp/capsules/u-boot.env.new
+	capsule: /tmp/capsules/Test112
+}
+{
+	image-index: 1
+	monotonic-count: 1
+	fw-version: 2
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 09d7cf52-0720-4710-91d1-08469b7fe9c8
+	payload: /tmp/capsules/u-boot.bin.new
+	capsule: /tmp/capsules/Test113
+}
+{
+	image-index: 1
+	fw-version: 5
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test114
+}
+{
+	image-index: 1
+	fw-version: 2
+	monotonic-count: 1
+	private-key: /tmp/capsules/SIGNER.key
+	pub-key-cert: /tmp/capsules/SIGNER.crt
+	image-guid: 3673b45d-6a7c-46f3-9e60-adabb03f7937
+	payload: /tmp/capsules/uboot_bin_env.itb
+	capsule: /tmp/capsules/Test115
+}