]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: capsule: binman: generate some capsules as part of build
authorSughosh Ganu <sughosh.ganu@linaro.org>
Wed, 27 Mar 2024 10:49:00 +0000 (16:19 +0530)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 8 Apr 2024 10:59:31 +0000 (12:59 +0200)
Currently, all the capsules for the sandbox platform are generated at
the time of running the capsule tests. To showcase generation of
capsules through binman, generate all raw(non FIT payload) capsules
needed for the sandbox platform as part of the build. This acts as an
illustrative example for generating capsules as part of a platform's
build.

Make corresponding change in the capsule test's configuration to get
these capsules from the build directory.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
arch/sandbox/dts/sandbox.dts
arch/sandbox/dts/sandbox_capsule.dtsi [new file with mode: 0644]
arch/sandbox/dts/test.dts
test/py/tests/test_efi_capsule/capsule_gen_binman.dts
test/py/tests/test_efi_capsule/conftest.py

index 12d3eff5fa73b2cbfa86498573ff3b7c69561ed3..8392206eea6ed266b00b4742105f2008551240ff 100644 (file)
 #if IS_ENABLED(CONFIG_SUPPORT_VPL)
 #include "sandbox_vpl.dtsi"
 #endif
+
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+#include "sandbox_capsule.dtsi"
+#endif
diff --git a/arch/sandbox/dts/sandbox_capsule.dtsi b/arch/sandbox/dts/sandbox_capsule.dtsi
new file mode 100644 (file)
index 0000000..34d2991
--- /dev/null
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Devicetree file with binman nodes needed for generating EFI
+ * capsules.
+ *
+ */
+
+#include <sandbox_efi_capsule.h>
+
+/ {
+       binman: binman {
+               multiple-images;
+       };
+};
+
+&binman {
+       capsule1 {
+               filename = "Test01";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule2 {
+               filename = "Test02";
+               efi-capsule {
+                       image-index = <0x2>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule3 {
+               filename = "Test03";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_INCORRECT_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule4 {
+               filename = "Test101";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule5 {
+               filename = "Test102";
+               efi-capsule {
+                       image-index = <0x2>;
+                       fw-version = <0xa>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule6 {
+               filename = "Test103";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule7 {
+               filename = "Test11";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule8 {
+               filename = "Test12";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_INVAL_KEY;
+                       public-key-cert = CAPSULE_INVAL_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule9 {
+               filename = "Test111";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule10 {
+               filename = "Test112";
+               efi-capsule {
+                       image-index = <0x2>;
+                       fw-version = <0xa>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule11 {
+               filename = "Test113";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+};
index e264b29554cf0c7b89f64751c0d862e88290fb57..a012f5c4c9ba7ec9f8748f8eaad26118275a4d2b 100644 (file)
 #include "sandbox_vpl.dtsi"
 #endif
 
+#if IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)
+#include "sandbox_capsule.dtsi"
+#endif
+
 #include "cedit.dtsi"
index e8a1858509279982d9d6685cf599ec9cc5687822..1a62c260474191c82038d0f73a8b2b7506b33936 100644 (file)
        };
 
        capsule1 {
-               filename = "Test01";
-               efi-capsule {
-                       image-index = <0x1>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule2 {
-               filename = "Test02";
-               efi-capsule {
-                       image-index = <0x2>;
-                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
-
-                       text {
-                               text = "u-boot-env:New";
-                       };
-               };
-       };
-
-       capsule3 {
-               filename = "Test03";
-               efi-capsule {
-                       image-index = <0x1>;
-                       image-guid = SANDBOX_INCORRECT_GUID;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule4 {
                filename = "Test04";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule5 {
+       capsule2 {
                filename = "Test05";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule6 {
-               filename = "Test101";
-               efi-capsule {
-                       image-index = <0x1>;
-                       fw-version = <0x5>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule7 {
-               filename = "Test102";
-               efi-capsule {
-                       image-index = <0x2>;
-                       fw-version = <0xa>;
-                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
-
-                       text {
-                               text = "u-boot-env:New";
-                       };
-               };
-       };
-
-       capsule8 {
-               filename = "Test103";
-               efi-capsule {
-                       image-index = <0x1>;
-                       fw-version = <0x2>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule9 {
+       capsule3 {
                filename = "Test104";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule10 {
+       capsule4 {
                filename = "Test105";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule11 {
-               filename = "Test11";
-               efi-capsule {
-                       image-index = <0x1>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-                       private-key = CAPSULE_PRIV_KEY;
-                       public-key-cert = CAPSULE_PUB_KEY;
-                       monotonic-count = <0x1>;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule12 {
-               filename = "Test12";
-               efi-capsule {
-                       image-index = <0x1>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-                       private-key = CAPSULE_INVAL_KEY;
-                       public-key-cert = CAPSULE_INVAL_PUB_KEY;
-                       monotonic-count = <0x1>;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule13 {
+       capsule5 {
                filename = "Test13";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule14 {
+       capsule6 {
                filename = "Test14";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule15 {
-               filename = "Test111";
-               efi-capsule {
-                       image-index = <0x1>;
-                       fw-version = <0x5>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-                       private-key = CAPSULE_PRIV_KEY;
-                       public-key-cert = CAPSULE_PUB_KEY;
-                       monotonic-count = <0x1>;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule16 {
-               filename = "Test112";
-               efi-capsule {
-                       image-index = <0x2>;
-                       fw-version = <0xa>;
-                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
-                       private-key = CAPSULE_PRIV_KEY;
-                       public-key-cert = CAPSULE_PUB_KEY;
-                       monotonic-count = <0x1>;
-
-                       text {
-                               text = "u-boot-env:New";
-                       };
-               };
-       };
-
-       capsule17 {
-               filename = "Test113";
-               efi-capsule {
-                       image-index = <0x1>;
-                       fw-version = <0x2>;
-                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
-                       private-key = CAPSULE_PRIV_KEY;
-                       public-key-cert = CAPSULE_PUB_KEY;
-                       monotonic-count = <0x1>;
-
-                       text {
-                               text = "u-boot:New";
-                       };
-               };
-       };
-
-       capsule18 {
+       capsule7 {
                filename = "Test114";
                efi-capsule {
                        image-index = <0x1>;
                };
        };
 
-       capsule19 {
+       capsule8 {
                filename = "Test115";
                efi-capsule {
                        image-index = <0x1>;
index dd41da9284e89a67384b0d3963815c102525215a..80b12977d6f2b8e7ecfb6f09c1cb22de63eb76b5 100644 (file)
@@ -85,6 +85,7 @@ def efi_capsule_data(request, u_boot_config):
         check_call('cd %s; '
                    './tools/binman/binman --toolpath %s/tools build -u -d %s/capsule_binman.dtb -O %s -m --allow-missing -I %s -I ./board/sandbox -I ./arch/sandbox/dts'
                    % (u_boot_config.source_dir, u_boot_config.build_dir, data_dir, data_dir, data_dir), shell=True)
+        check_call('cp %s/Test* %s' % (u_boot_config.build_dir, data_dir), shell=True)
         os.environ['PYTHONPATH'] = pythonpath
 
         # Create a disk image with EFI system partition