From 0e0fab0ca2190d75dd12b655e043ed8b6053221f Mon Sep 17 00:00:00 2001 From: Xialin Liu Date: Fri, 28 Jun 2024 12:52:29 -0500 Subject: [PATCH] feat(arm): makefile invoke CoT dt2c Change the makefile to call the cot-dt2c tool during the build for Arm platform Change-Id: Idb7c02cca6b9ddd87f575a42c88e7b2660b896e0 Signed-off-by: Xialin Liu --- Makefile | 5 +++++ plat/arm/common/arm_common.mk | 27 +++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index baf8431f6..2fc856afb 100644 --- a/Makefile +++ b/Makefile @@ -121,6 +121,9 @@ SPTOOL ?= ${SPTOOLPATH}/sptool.py SP_MK_GEN ?= ${SPTOOLPATH}/sp_mk_generator.py SP_DTS_LIST_FRAGMENT ?= ${BUILD_PLAT}/sp_list_fragment.dts +# Variables for use with Certificate Conversion (cot-dt2c) Tool +CERTCONVPATH ?= tools/cot_dt2c + # Variables for use with ROMLIB ROMLIBPATH ?= lib/romlib @@ -1582,6 +1585,7 @@ endif #(CHECKPATCH) clean: $(s)echo " CLEAN" $(call SHELL_REMOVE_DIR,${BUILD_PLAT}) + $(q)${MAKE} -C ${CERTCONVPATH} clean ifdef UNIX_MK $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean else @@ -1597,6 +1601,7 @@ realclean distclean: $(s)echo " REALCLEAN" $(call SHELL_REMOVE_DIR,${BUILD_BASE}) $(call SHELL_DELETE_ALL, ${CURDIR}/cscope.*) + $(q)${MAKE} -C ${CERTCONVPATH} clean ifdef UNIX_MK $(q)${MAKE} --no-print-directory -C ${FIPTOOLPATH} clean else diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 0b6b526d4..cff77712c 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -387,20 +387,25 @@ ifneq (${TRUSTED_BOARD_BOOT},0) BL1_SOURCES += drivers/auth/dualroot/bl1_cot.c ifneq (${COT_DESC_IN_DTB},0) BL2_SOURCES += lib/fconf/fconf_cot_getter.c - else - BL2_SOURCES += drivers/auth/dualroot/bl2_cot.c endif else ifeq (${COT},cca) BL1_SOURCES += drivers/auth/cca/bl1_cot.c ifneq (${COT_DESC_IN_DTB},0) BL2_SOURCES += lib/fconf/fconf_cot_getter.c - else - BL2_SOURCES += drivers/auth/cca/bl2_cot.c endif else $(error Unknown chain of trust ${COT}) endif + ifeq (${COT_DESC_IN_DTB},0) + ifeq (${COT},dualroot) + COTDTPATH := fdts/dualroot_cot_descriptors.dtsi + else ifeq (${COT},cca) + COTDTPATH := fdts/cca_cot_descriptors.dtsi + endif + bl2: cot-dt2c + endif + BL1_SOURCES += ${AUTH_SOURCES} \ bl1/tbbr/tbbr_img_desc.c \ plat/arm/common/arm_bl1_fwu.c \ @@ -472,3 +477,17 @@ ifeq (${TRANSFER_LIST}, 1) bl31: tl endif endif + +cot-dt2c: +ifneq ($(COTDTPATH),) + $(info COT CONVERSION FOR ${COTDTPATH}) + toolpath := $(shell which cot-dt2c) + ifeq (${toolpath},) + output := $(shell make -C ./${CERTCONVPATH} install) + $(info install output ${output}) + toolpath := $(shell which cot-dt2c) + endif + output := $(shell ${toolpath} convert-to-c ${COTDTPATH} ${BUILD_PLAT}/bl2_cot.c) + $(info ${output}) + BL2_SOURCES += ${BUILD_PLAT}/bl2_cot.c +endif