From: Jamin Lin <jamin_lin@aspeedtech.com>
To: <openembedded-devel@lists.openembedded.org>
Cc: <troy_lee@aspeedtech.com>, <jamin_lin@aspeedtech.com>
Subject: [PATCH v4 1/3] uboot-sign: support to create TEE and ATF image tree source
Date: Mon, 18 Nov 2024 14:23:56 +0800 [thread overview]
Message-ID: <20241118062358.283666-2-jamin_lin@aspeedtech.com> (raw)
In-Reply-To: <20241118062358.283666-1-jamin_lin@aspeedtech.com>
Currently, uboot-sign.bbclass only supports to create Image Tree Source(ITS)
for "u-boot" and "flat_dt". However, users may want to support multiple images
such as ARM Trusted Firmware(ATF), Trusted Execution Environment(TEE) and
users private images for specific application and purpose.
To make this bbclass more flexible and support ATF and TEE, creates new
functions which are "uboot_fitimage_atf" and "uboot_fitimage_tee"
for ATF and TEE ITS file creation, respectively.
Add a variable "UBOOT_FIT_ARM_TRUSTED_FIRMWARE" to
enable ATF ITS generation and it is disable by default.
Add a variable "UBOOT_FIT_TEE" to enable TEE ITS generation
and it is disable by default.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
meta/classes-recipe/uboot-sign.bbclass | 80 +++++++++++++++++++++++++-
1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass
index a17be745ce..f1b3470127 100644
--- a/meta/classes-recipe/uboot-sign.bbclass
+++ b/meta/classes-recipe/uboot-sign.bbclass
@@ -88,6 +88,18 @@ UBOOT_FIT_ADDRESS_CELLS ?= "1"
# This is only necessary for determining the signing configuration
KERNEL_PN = "${PREFERRED_PROVIDER_virtual/kernel}"
+# ARM Trusted Firmware(ATF) is a reference implementation of secure world
+# software for Arm A-Profile architectures, (Armv8-A and Armv7-A), including
+# an Exception Level 3 (EL3) Secure Monitor.
+UBOOT_FIT_ARM_TRUSTED_FIRMWARE ?= "0"
+UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE ?= "bl31.bin"
+
+# A Trusted Execution Environment(TEE) is an environment for executing code,
+# in which those executing the code can have high levels of trust in the asset
+# management of that surrounding environment.
+UBOOT_FIT_TEE ?= "0"
+UBOOT_FIT_TEE_IMAGE ?= "tee-raw.bin"
+
UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}"
UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}"
@@ -234,9 +246,64 @@ do_uboot_generate_rsa_keys() {
addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
+# Create a ITS file for the atf
+uboot_fitimage_atf() {
+ cat << EOF >> ${UBOOT_ITS}
+ atf {
+ description = "ARM Trusted Firmware";
+ data = /incbin/("${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE}");
+ type = "firmware";
+ arch = "${UBOOT_ARCH}";
+ os = "arm-trusted-firmware";
+ load = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_LOADADDRESS}>;
+ entry = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT}>;
+ compression = "none";
+EOF
+ if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
+ cat << EOF >> ${UBOOT_ITS}
+ signature {
+ algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
+ key-name-hint = "${SPL_SIGN_KEYNAME}";
+ };
+EOF
+ fi
+
+ cat << EOF >> ${UBOOT_ITS}
+ };
+EOF
+}
+
+# Create a ITS file for the tee
+uboot_fitimage_tee() {
+ cat << EOF >> ${UBOOT_ITS}
+ tee {
+ description = "Trusted Execution Environment";
+ data = /incbin/("${UBOOT_FIT_TEE_IMAGE}");
+ type = "tee";
+ arch = "${UBOOT_ARCH}";
+ os = "tee";
+ load = <${UBOOT_FIT_TEE_LOADADDRESS}>;
+ entry = <${UBOOT_FIT_TEE_ENTRYPOINT}>;
+ compression = "none";
+EOF
+ if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
+ cat << EOF >> ${UBOOT_ITS}
+ signature {
+ algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
+ key-name-hint = "${SPL_SIGN_KEYNAME}";
+ };
+EOF
+ fi
+
+ cat << EOF >> ${UBOOT_ITS}
+ };
+EOF
+}
+
# Create a ITS file for the U-boot FIT, for use when
# we want to sign it so that the SPL can verify it
uboot_fitimage_assemble() {
+ conf_loadables="\"uboot\""
rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY}
# First we create the ITS script
@@ -289,13 +356,24 @@ EOF
cat << EOF >> ${UBOOT_ITS}
};
+EOF
+ if [ "${UBOOT_FIT_TEE}" = "1" ] ; then
+ conf_loadables="\"tee\", ${conf_loadables}"
+ uboot_fitimage_tee
+ fi
+
+ if [ "${UBOOT_FIT_ARM_TRUSTED_FIRMWARE}" = "1" ] ; then
+ conf_loadables="\"atf\", ${conf_loadables}"
+ uboot_fitimage_atf
+ fi
+ cat << EOF >> ${UBOOT_ITS}
};
configurations {
default = "conf";
conf {
description = "Boot with signed U-Boot FIT";
- loadables = "uboot";
+ loadables = ${conf_loadables};
fdt = "fdt";
};
};
--
2.25.1
next prev parent reply other threads:[~2024-11-18 6:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 6:23 [PATCH v4 0/3] uboot-sign: support ATF and TFE ITS generation Jamin Lin
2024-11-18 6:23 ` Jamin Lin [this message]
2024-11-18 6:23 ` [PATCH v4 2/3] uboot-sign: support to create users specific image tree source Jamin Lin
2024-11-18 6:23 ` [PATCH v4 3/3] oe-selftest: fitimage: add testcases to test ATF and TEE Jamin Lin
2024-11-18 6:27 ` [oe] [PATCH v4 0/3] uboot-sign: support ATF and TFE ITS generation Martin Jansa
2024-11-18 6:29 ` Jamin Lin
-- strict thread matches above, loose matches on Subject: below --
2024-11-18 6:32 Jamin Lin
2024-11-18 6:32 ` [PATCH v4 1/3] uboot-sign: support to create TEE and ATF image tree source Jamin Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241118062358.283666-2-jamin_lin@aspeedtech.com \
--to=jamin_lin@aspeedtech.com \
--cc=openembedded-devel@lists.openembedded.org \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.