blob: 365a9607b2daa1044ca5be55f40a272440ff8f44 [file] [log] [blame]
Juan Castillo31a68f02015-04-14 12:49:03 +01001#
laurenw-arm7b7ebff2023-05-02 14:42:48 -05002# Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
Juan Castillo31a68f02015-04-14 12:49:03 +01003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Juan Castillo31a68f02015-04-14 12:49:03 +01005#
6
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +01007PLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
Yatharth Kocharf528faf2016-06-28 16:58:26 +01008 plat/arm/board/common/${ARCH}/board_arm_helpers.S
Juan Castillo31a68f02015-04-14 12:49:03 +01009
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +010010BL1_SOURCES += drivers/cfi/v2m/v2m_flash.c
Juan Castillo31a68f02015-04-14 12:49:03 +010011
Antonio Nino Diazd7da2f82018-10-10 11:14:44 +010012BL2_SOURCES += drivers/cfi/v2m/v2m_flash.c
Juan Castillo31a68f02015-04-14 12:49:03 +010013
14ifneq (${TRUSTED_BOARD_BOOT},0)
laurenw-arm2590dfd2022-12-13 09:42:40 -060015ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_dev_rotpk.S
Sandrine Bailleux2f37ce62023-10-26 15:14:42 +020016
Max Shvetsov06dba292019-12-06 11:50:12 +000017# ROTPK hash location
18ifeq (${ARM_ROTPK_LOCATION}, regs)
19 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
20else ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000021 CRYPTO_ALG=rsa
Max Shvetsov06dba292019-12-06 11:50:12 +000022 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID
23 ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin
24$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
25$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
26$(warning Development keys support for FVP is deprecated. Use `regs` \
27option instead)
28else ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000029 CRYPTO_ALG=ec
Max Shvetsov06dba292019-12-06 11:50:12 +000030 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID
31 ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin
32$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
33$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
34$(warning Development keys support for FVP is deprecated. Use `regs` \
35option instead)
laurenw-arm055199b2022-10-28 11:26:32 -050036else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_rsa_key)
37 CRYPTO_ALG=rsa
38 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID
39 ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_rsa_rotpk.S
40$(warning Development keys support for FVP is deprecated. Use `regs` \
41option instead)
laurenw-arm02169532023-08-15 14:57:56 -050042else ifeq (${ARM_ROTPK_LOCATION}, devel_full_dev_ecdsa_key)
43 CRYPTO_ALG=ec
44 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_FULL_DEV_ECDSA_KEY_ID
45ifeq (${KEY_SIZE},384)
46 ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p384_rotpk.S
47else
48 ARM_ROTPK_S = plat/arm/board/common/rotpk/arm_full_dev_ecdsa_p256_rotpk.S
49endif
50$(warning Development keys support for FVP is deprecated. Use `regs` \
51option instead)
Max Shvetsov06dba292019-12-06 11:50:12 +000052else
Sandrine Bailleux3e183f92021-04-16 16:08:46 +020053$(error "Unsupported ARM_ROTPK_LOCATION value")
Max Shvetsov06dba292019-12-06 11:50:12 +000054endif
55
56$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
57
laurenw-armd3449782022-04-21 16:50:49 -050058ifeq (${ENABLE_RME}, 1)
59COT := cca
60endif
61
Max Shvetsov06dba292019-12-06 11:50:12 +000062# Force generation of the new hash if ROT_KEY is specified
63ifdef ROT_KEY
64 HASH_PREREQUISITES = $(ROT_KEY) FORCE
Max Shvetsov06dba292019-12-06 11:50:12 +000065endif
66
67$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
68ifndef ROT_KEY
69 $(error Cannot generate hash: no ROT_KEY defined)
70endif
Salome Thirot0b35da32022-07-14 16:14:15 +010071 ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \
72 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@
Max Shvetsov06dba292019-12-06 11:50:12 +000073
74# Certificate NV-Counters. Use values corresponding to tied off values in
75# ARM development platforms
76TFW_NVCTR_VAL ?= 31
77NTFW_NVCTR_VAL ?= 223
laurenw-arm7b7ebff2023-05-02 14:42:48 -050078# The CCA Non-Volatile Counter only exists on some Arm development platforms.
79# On others, we mock it by aliasing it to the Trusted Firmware Non-Volatile counter,
80# hence we set both counters to the same default value.
81CCAFW_NVCTR_VAL ?= 31
Sandrine Bailleux2f37ce62023-10-26 15:14:42 +020082
Max Shvetsov06dba292019-12-06 11:50:12 +000083BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050084 ${ARM_ROTPK_S}
Max Shvetsov06dba292019-12-06 11:50:12 +000085BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050086 ${ARM_ROTPK_S}
Juan Castillo31a68f02015-04-14 12:49:03 +010087
Sandrine Bailleux012f8712020-02-06 14:59:33 +010088# Allows platform code to provide implementation variants depending on the
89# selected chain of trust.
90$(eval $(call add_define,ARM_COT_${COT}))
91
92ifeq (${COT},dualroot)
93# Platform Root of Trust key files.
94ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
95ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
96
97# Provide the private key to cert_create tool. It needs it to sign the images.
98PROT_KEY := ${ARM_PROT_KEY}
99
100$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
101
102BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
103BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
104
105$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500106$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
107endif
108
109ifeq (${COT},cca)
110# Platform and Secure World Root of Trust key files.
111ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
112ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
113ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
114ARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin
115
116# Provide the private keys to cert_create tool. It needs them to sign the images.
117PROT_KEY := ${ARM_PROT_KEY}
118SWD_ROT_KEY := ${ARM_SWD_ROT_KEY}
119
120$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
121$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"'))
122
123BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
124 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
125BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
126 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
127
128$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
129$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100130$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500131$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100132endif
133
Juan Castillo31a68f02015-04-14 12:49:03 +0100134endif