xref: /rk3399_ARM-atf/plat/arm/board/common/board_common.mk (revision 5f899286eac994b8337959ad924a43c1a4a543c9)
195cfd4adSJuan Castillo#
2f2423792Slaurenw-arm# Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
395cfd4adSJuan Castillo#
482cb2c1aSdp-arm# SPDX-License-Identifier: BSD-3-Clause
595cfd4adSJuan Castillo#
695cfd4adSJuan Castillo
71a0a3f06SYatharth KocharPLAT_BL_COMMON_SOURCES	+=	drivers/arm/pl011/${ARCH}/pl011_console.S	\
81a0a3f06SYatharth Kochar				plat/arm/board/common/${ARCH}/board_arm_helpers.S
995cfd4adSJuan Castillo
10aa7877c4SAntonio Nino DiazBL1_SOURCES		+=	drivers/cfi/v2m/v2m_flash.c
1195cfd4adSJuan Castillo
12aa7877c4SAntonio Nino DiazBL2_SOURCES		+=	drivers/cfi/v2m/v2m_flash.c
1395cfd4adSJuan Castillo
1495cfd4adSJuan Castilloifneq (${TRUSTED_BOARD_BOOT},0)
15f143cafeSSoby Mathewifneq (${ARM_CRYPTOCELL_INTEG}, 1)
1695cfd4adSJuan Castillo# ROTPK hash location
1795cfd4adSJuan Castilloifeq (${ARM_ROTPK_LOCATION}, regs)
1895cfd4adSJuan Castillo	ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
1995cfd4adSJuan Castilloelse ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
20698e231dSMax Shvetsov	CRYPTO_ALG=rsa
2195cfd4adSJuan Castillo	ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID
22a6ffddecSMax Shvetsov	ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin
23*5f899286Slaurenw-arm	ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
24a6ffddecSMax Shvetsov$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
25a6ffddecSMax Shvetsov$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
26a6ffddecSMax Shvetsov$(warning Development keys support for FVP is deprecated. Use `regs` \
27a6ffddecSMax Shvetsovoption instead)
289db9c65aSQixiang Xuelse ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa)
29698e231dSMax Shvetsov	CRYPTO_ALG=ec
309db9c65aSQixiang Xu	ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID
31a6ffddecSMax Shvetsov	ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin
32*5f899286Slaurenw-arm	ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
33a6ffddecSMax Shvetsov$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
34a6ffddecSMax Shvetsov$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
35a6ffddecSMax Shvetsov$(warning Development keys support for FVP is deprecated. Use `regs` \
36a6ffddecSMax Shvetsovoption instead)
37*5f899286Slaurenw-armelse ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_rsa_key)
38*5f899286Slaurenw-arm	CRYPTO_ALG=rsa
39*5f899286Slaurenw-arm	ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID
40*5f899286Slaurenw-arm	ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S
41*5f899286Slaurenw-arm$(warning Development keys support for FVP is deprecated. Use `regs` \
42*5f899286Slaurenw-armoption instead)
4395cfd4adSJuan Castilloelse
4495cfd4adSJuan Castillo$(error "Unsupported ARM_ROTPK_LOCATION value")
4595cfd4adSJuan Castilloendif
46a6ffddecSMax Shvetsov
4795cfd4adSJuan Castillo$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
4895cfd4adSJuan Castillo
49f2423792Slaurenw-armifeq (${ENABLE_RME}, 1)
50f2423792Slaurenw-armCOT	:=	cca
51f2423792Slaurenw-armendif
52f2423792Slaurenw-arm
53a6ffddecSMax Shvetsov# Force generation of the new hash if ROT_KEY is specified
54a6ffddecSMax Shvetsovifdef ROT_KEY
55a6ffddecSMax Shvetsov	HASH_PREREQUISITES = $(ROT_KEY) FORCE
56a6ffddecSMax Shvetsovelse
57a6ffddecSMax Shvetsov	HASH_PREREQUISITES = $(ROT_KEY)
58a6ffddecSMax Shvetsovendif
59a6ffddecSMax Shvetsov
60a6ffddecSMax Shvetsov$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
61a6ffddecSMax Shvetsovifndef ROT_KEY
62a6ffddecSMax Shvetsov	$(error Cannot generate hash: no ROT_KEY defined)
63a6ffddecSMax Shvetsovendif
64e95abc4cSSalome Thirot	${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \
65e95abc4cSSalome Thirot	${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@
66a6ffddecSMax Shvetsov
6748279d52SJuan Castillo# Certificate NV-Counters. Use values corresponding to tied off values in
6848279d52SJuan Castillo# ARM development platforms
6948279d52SJuan CastilloTFW_NVCTR_VAL	?=	31
7048279d52SJuan CastilloNTFW_NVCTR_VAL	?=	223
71f143cafeSSoby Mathewelse
72f143cafeSSoby Mathew# Certificate NV-Counters when CryptoCell is integrated. For development
73f143cafeSSoby Mathew# platforms we set the counter to first valid value.
74f143cafeSSoby MathewTFW_NVCTR_VAL	?=	0
75f143cafeSSoby MathewNTFW_NVCTR_VAL	?=	0
76f143cafeSSoby Mathewendif
77a6ffddecSMax ShvetsovBL1_SOURCES		+=	plat/arm/board/common/board_arm_trusted_boot.c \
78*5f899286Slaurenw-arm				${ARM_ROTPK_S}
79a6ffddecSMax ShvetsovBL2_SOURCES		+=	plat/arm/board/common/board_arm_trusted_boot.c \
80*5f899286Slaurenw-arm				${ARM_ROTPK_S}
81a6ffddecSMax Shvetsov
821035a706SSandrine Bailleux# Allows platform code to provide implementation variants depending on the
831035a706SSandrine Bailleux# selected chain of trust.
841035a706SSandrine Bailleux$(eval $(call add_define,ARM_COT_${COT}))
851035a706SSandrine Bailleux
861035a706SSandrine Bailleuxifeq (${COT},dualroot)
871035a706SSandrine Bailleux# Platform Root of Trust key files.
881035a706SSandrine BailleuxARM_PROT_KEY		:=	plat/arm/board/common/protpk/arm_protprivk_rsa.pem
891035a706SSandrine BailleuxARM_PROTPK_HASH		:=	plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
901035a706SSandrine Bailleux
911035a706SSandrine Bailleux# Provide the private key to cert_create tool. It needs it to sign the images.
921035a706SSandrine BailleuxPROT_KEY		:=	${ARM_PROT_KEY}
931035a706SSandrine Bailleux
941035a706SSandrine Bailleux$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
951035a706SSandrine Bailleux
961035a706SSandrine BailleuxBL1_SOURCES		+=	plat/arm/board/common/protpk/arm_dev_protpk.S
971035a706SSandrine BailleuxBL2_SOURCES		+=	plat/arm/board/common/protpk/arm_dev_protpk.S
981035a706SSandrine Bailleux
991035a706SSandrine Bailleux$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
1001035a706SSandrine Bailleux$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
1011035a706SSandrine Bailleuxendif
1021035a706SSandrine Bailleux
103f2423792Slaurenw-armifeq (${COT},cca)
104f2423792Slaurenw-arm# Platform and Secure World Root of Trust key files.
105f2423792Slaurenw-armARM_PROT_KEY		:=	plat/arm/board/common/protpk/arm_protprivk_rsa.pem
106f2423792Slaurenw-armARM_PROTPK_HASH		:=	plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
107f2423792Slaurenw-armARM_SWD_ROT_KEY		:=	plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
108f2423792Slaurenw-armARM_SWD_ROTPK_HASH	:=	plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin
109f2423792Slaurenw-arm
110f2423792Slaurenw-arm# Provide the private keys to cert_create tool. It needs them to sign the images.
111f2423792Slaurenw-armPROT_KEY		:=	${ARM_PROT_KEY}
112f2423792Slaurenw-armSWD_ROT_KEY		:=	${ARM_SWD_ROT_KEY}
113f2423792Slaurenw-arm
114f2423792Slaurenw-arm$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
115f2423792Slaurenw-arm$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"'))
116f2423792Slaurenw-arm
117f2423792Slaurenw-armBL1_SOURCES		+=	plat/arm/board/common/protpk/arm_dev_protpk.S \
118f2423792Slaurenw-arm				plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
119f2423792Slaurenw-armBL2_SOURCES		+=	plat/arm/board/common/protpk/arm_dev_protpk.S \
120f2423792Slaurenw-arm				plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
121f2423792Slaurenw-arm
122f2423792Slaurenw-arm$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
123f2423792Slaurenw-arm$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
124f2423792Slaurenw-arm$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
125f2423792Slaurenw-arm$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
126f2423792Slaurenw-armendif
127f2423792Slaurenw-arm
12895cfd4adSJuan Castilloendif
129