diff mbox series

[v5,2/3] uboot-sign: support to add users specific image tree source

Message ID 20241211023515.2108415-3-jamin_lin@aspeedtech.com
State New
Headers show
Series uboot-sign: support ATF and TFE ITS generation | expand

Commit Message

Jamin Lin Dec. 11, 2024, 2:35 a.m. UTC
Currently, uboot-sign.bbclass only supports to create Image Tree Source(ITS)
for "u-boot" and "flat_dt". However, users may want to add their private
images into u-boot FIT image for specific application and purpose.

To make this bbclass more flexible and support to add users specific snippet
ITS, creates a new "UBOOT_FIT_USER_SETTINGS" variable. Users can add their
specific snippet ITS into this variable.

Example:

```
UBOOT_FIT_MY_ITS = '\
       myfw {\n\
            description = \"MY Firmware\";\n\
            data = /incbin/(\"myfw.bin\");\n\
            type = \"mytype\";\n\
            arch = \"myarch\";\n\
            os = \"myos\";\n\
            load = <0xb2000000>;\n\
            entry = <0xb2000000>;\n\
            compression = \"none\";\n\
        };\n\
'

UBOOT_FIT_USER_SETTINGS = "${UBOOT_FIT_MY_ITS}"
```

The generated ITS

```
       myfw {
            description = "My Firmware";
            data = /incbin/("myfw.bin");
            type = "mytype";
            arch = "myarch";
            os = "myos";
            load = <0xb2000000>;
            entry = <0xb2000000>;
            compression = "none";
       };
```

Add a variable "UBOOT_FIT_CONF_USER_LOADABLES" to load users specific images
and it is an empty by default.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 meta/classes-recipe/uboot-sign.bbclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass
index f1b3470127..4a2dc99037 100644
--- a/meta/classes-recipe/uboot-sign.bbclass
+++ b/meta/classes-recipe/uboot-sign.bbclass
@@ -100,6 +100,13 @@  UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE ?= "bl31.bin"
 UBOOT_FIT_TEE ?= "0"
 UBOOT_FIT_TEE_IMAGE ?= "tee-raw.bin"
 
+# User specific settings
+UBOOT_FIT_USER_SETTINGS ?= ""
+
+# Unit name containing a list of users additional binaries to be loaded.
+# It is a comma-separated list of strings.
+UBOOT_FIT_CONF_USER_LOADABLES ?= ''
+
 UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}"
 UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}"
 
@@ -366,6 +373,15 @@  EOF
 		conf_loadables="\"atf\", ${conf_loadables}"
 		uboot_fitimage_atf
 	fi
+
+	if [ -n "${UBOOT_FIT_USER_SETTINGS}" ] ; then
+		echo -e "${UBOOT_FIT_USER_SETTINGS}" >> ${UBOOT_ITS}
+	fi
+
+	if [ -n "${UBOOT_FIT_CONF_USER_LOADABLES}" ] ; then
+		conf_loadables="${conf_loadables}${UBOOT_FIT_CONF_USER_LOADABLES}"
+	fi
+
 	cat << EOF >> ${UBOOT_ITS}
     };