Add a config file that drives capsule generation through the
mkeficapsule config-file parser, and enable it on the sandbox variant.
These capsules are used to test the capsule update feature on
sandbox.

Fix Test05, which had two identical blocks (same image-guid and
image-index) that would now silently merge into an unintended
2-payload capsule under the parser's new grouping-by-filename
behavior; give the second block its own index and GUID so Test05
instead demonstrates multi-payload grouping on purpose.

Add Test116 to cover a multi-payload capsule with a signed first
payload and an unsigned second payload, and Test06/Test15 to cover
the same raw-image update path (rather than the existing FIT-image
examples), with Test06 unsigned and Test15 signing each payload
independently.

Signed-off-by: Sughosh Ganu <[email protected]>
Signed-off-by: Balaji Selvanathan <[email protected]>
---
 configs/sandbox_defconfig                          |   8 ++
 .../tests/test_efi_capsule/sandbox_capsule_cfg.txt | 118 +++++++++++++++++++++
 2 files changed, 126 insertions(+)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 79f46317e45..8fc3133522a 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -396,6 +396,14 @@ CONFIG_RSASSA_PSS=y
 CONFIG_TPM=y
 CONFIG_ERRNO_STR=y
 CONFIG_GETOPT=y
+CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_EFI_CAPSULE_AUTHENTICATE=y
+CONFIG_EFI_CAPSULE_ESL_FILE="board/sandbox/capsule_pub_esl_good.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_UTHREAD=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 00000000000..8b8530228a6
--- /dev/null
+++ b/test/py/tests/test_efi_capsule/sandbox_capsule_cfg.txt
@@ -0,0 +1,118 @@
+{
+       image-index: 1
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test04
+
+}
+{
+       image-index: 1
+       image-guid: 058B7D83-50D5-4C47-A195-60D86AD341C4
+       payload: u-boot_bin_env.itb
+       capsule: Test05
+
+}
+{
+       image-index: 2
+       image-guid: B0ECDF61-24BC-4A61-A0A9-095A77279E84
+       payload: u-boot_bin_env.itb
+       capsule: Test05
+}
+{
+       image-index: 1
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test13
+}
+{
+       image-index: 1
+       monotonic-count: 1
+       private-key: SIGNER2.key
+       pub-key-cert: SIGNER2.crt
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test14
+}
+{
+       image-index: 1
+       fw-version: 5
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test104
+}
+{
+       image-index: 1
+       fw-version: 2
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test105
+
+}
+{
+       image-index: 1
+       fw-version: 5
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test114
+}
+{
+       image-index: 1
+       fw-version: 2
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test115
+}
+{
+       image-index: 1
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 3673B45D-6A7C-46F3-9E60-ADABB03F7937
+       payload: u-boot_bin_env.itb
+       capsule: Test116
+}
+{
+       image-index: 2
+       image-guid: 339B1ED4-A9C4-4A4E-A3E4-04138A91734B
+       payload: u-boot_bin_env.itb
+       capsule: Test116
+}
+{
+       image-index: 1
+       image-guid: 985F2937-7C2E-5E9A-8A5E-8E063312964B
+       payload: u-boot.bin.new
+       capsule: Test06
+}
+{
+       image-index: 2
+       image-guid: 9E339473-C2EB-530A-A69B-0CD6BBBED40E
+       payload: u-boot.env.new
+       capsule: Test06
+}
+{
+       image-index: 1
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 985F2937-7C2E-5E9A-8A5E-8E063312964B
+       payload: u-boot.bin.new
+       capsule: Test15
+}
+{
+       image-index: 2
+       monotonic-count: 1
+       private-key: SIGNER.key
+       pub-key-cert: SIGNER.crt
+       image-guid: 9E339473-C2EB-530A-A69B-0CD6BBBED40E
+       payload: u-boot.env.new
+       capsule: Test15
+}

-- 
2.34.1

Reply via email to