summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes-recipe/uboot-sign.bbclass80
1 files changed, 79 insertions, 1 deletions
diff --git a/meta/classes-recipe/uboot-sign.bbclass b/meta/classes-recipe/uboot-sign.bbclass
index 5c579a9fb0..598a89c816 100644
--- a/meta/classes-recipe/uboot-sign.bbclass
+++ b/meta/classes-recipe/uboot-sign.bbclass
@@ -86,6 +86,18 @@ UBOOT_FIT_KEY_SIGN_PKCS ?= "-x509"
86# ex: 1 32bits address, 2 64bits address 86# ex: 1 32bits address, 2 64bits address
87UBOOT_FIT_ADDRESS_CELLS ?= "1" 87UBOOT_FIT_ADDRESS_CELLS ?= "1"
88 88
89# ARM Trusted Firmware(ATF) is a reference implementation of secure world
90# software for Arm A-Profile architectures, (Armv8-A and Armv7-A), including
91# an Exception Level 3 (EL3) Secure Monitor.
92UBOOT_FIT_ARM_TRUSTED_FIRMWARE ?= "0"
93UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE ?= "bl31.bin"
94
95# A Trusted Execution Environment(TEE) is an environment for executing code,
96# in which those executing the code can have high levels of trust in the asset
97# management of that surrounding environment.
98UBOOT_FIT_TEE ?= "0"
99UBOOT_FIT_TEE_IMAGE ?= "tee-raw.bin"
100
89UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}" 101UBOOT_FIT_UBOOT_LOADADDRESS ?= "${UBOOT_LOADADDRESS}"
90UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}" 102UBOOT_FIT_UBOOT_ENTRYPOINT ?= "${UBOOT_ENTRYPOINT}"
91 103
@@ -282,9 +294,64 @@ do_uboot_generate_rsa_keys() {
282 294
283addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile 295addtask uboot_generate_rsa_keys before do_uboot_assemble_fitimage after do_compile
284 296
297# Create a ITS file for the atf
298uboot_fitimage_atf() {
299 cat << EOF >> ${UBOOT_ITS}
300 atf {
301 description = "ARM Trusted Firmware";
302 data = /incbin/("${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_IMAGE}");
303 type = "firmware";
304 arch = "${UBOOT_ARCH}";
305 os = "arm-trusted-firmware";
306 load = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_LOADADDRESS}>;
307 entry = <${UBOOT_FIT_ARM_TRUSTED_FIRMWARE_ENTRYPOINT}>;
308 compression = "none";
309EOF
310 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
311 cat << EOF >> ${UBOOT_ITS}
312 signature {
313 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
314 key-name-hint = "${SPL_SIGN_KEYNAME}";
315 };
316EOF
317 fi
318
319 cat << EOF >> ${UBOOT_ITS}
320 };
321EOF
322}
323
324# Create a ITS file for the tee
325uboot_fitimage_tee() {
326 cat << EOF >> ${UBOOT_ITS}
327 tee {
328 description = "Trusted Execution Environment";
329 data = /incbin/("${UBOOT_FIT_TEE_IMAGE}");
330 type = "tee";
331 arch = "${UBOOT_ARCH}";
332 os = "tee";
333 load = <${UBOOT_FIT_TEE_LOADADDRESS}>;
334 entry = <${UBOOT_FIT_TEE_ENTRYPOINT}>;
335 compression = "none";
336EOF
337 if [ "${SPL_SIGN_ENABLE}" = "1" ] ; then
338 cat << EOF >> ${UBOOT_ITS}
339 signature {
340 algo = "${UBOOT_FIT_HASH_ALG},${UBOOT_FIT_SIGN_ALG}";
341 key-name-hint = "${SPL_SIGN_KEYNAME}";
342 };
343EOF
344 fi
345
346 cat << EOF >> ${UBOOT_ITS}
347 };
348EOF
349}
350
285# Create a ITS file for the U-boot FIT, for use when 351# Create a ITS file for the U-boot FIT, for use when
286# we want to sign it so that the SPL can verify it 352# we want to sign it so that the SPL can verify it
287uboot_fitimage_assemble() { 353uboot_fitimage_assemble() {
354 conf_loadables="\"uboot\""
288 rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY} 355 rm -f ${UBOOT_ITS} ${UBOOT_FITIMAGE_BINARY}
289 356
290 # First we create the ITS script 357 # First we create the ITS script
@@ -337,13 +404,24 @@ EOF
337 404
338 cat << EOF >> ${UBOOT_ITS} 405 cat << EOF >> ${UBOOT_ITS}
339 }; 406 };
407EOF
408 if [ "${UBOOT_FIT_TEE}" = "1" ] ; then
409 conf_loadables="\"tee\", ${conf_loadables}"
410 uboot_fitimage_tee
411 fi
412
413 if [ "${UBOOT_FIT_ARM_TRUSTED_FIRMWARE}" = "1" ] ; then
414 conf_loadables="\"atf\", ${conf_loadables}"
415 uboot_fitimage_atf
416 fi
417 cat << EOF >> ${UBOOT_ITS}
340 }; 418 };
341 419
342 configurations { 420 configurations {
343 default = "conf"; 421 default = "conf";
344 conf { 422 conf {
345 description = "Boot with signed U-Boot FIT"; 423 description = "Boot with signed U-Boot FIT";
346 loadables = "uboot"; 424 loadables = ${conf_loadables};
347 fdt = "fdt"; 425 fdt = "fdt";
348 }; 426 };
349 }; 427 };