blob: 777784d9a0dbbcb87d100b0f76e70267a30261ec [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
Max Shvetsov06dba292019-12-06 11:50:12 +000016ifneq (${ARM_CRYPTOCELL_INTEG}, 1)
17# 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)
Max Shvetsov06dba292019-12-06 11:50:12 +000042else
Sandrine Bailleux3e183f92021-04-16 16:08:46 +020043$(error "Unsupported ARM_ROTPK_LOCATION value")
Max Shvetsov06dba292019-12-06 11:50:12 +000044endif
45
46$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
47
laurenw-armd3449782022-04-21 16:50:49 -050048ifeq (${ENABLE_RME}, 1)
49COT := cca
50endif
51
Max Shvetsov06dba292019-12-06 11:50:12 +000052# Force generation of the new hash if ROT_KEY is specified
53ifdef ROT_KEY
54 HASH_PREREQUISITES = $(ROT_KEY) FORCE
Max Shvetsov06dba292019-12-06 11:50:12 +000055else
56 HASH_PREREQUISITES = $(ROT_KEY)
57endif
58
59$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
60ifndef ROT_KEY
61 $(error Cannot generate hash: no ROT_KEY defined)
62endif
Salome Thirot0b35da32022-07-14 16:14:15 +010063 ${OPENSSL_BIN_PATH}/openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | \
64 ${OPENSSL_BIN_PATH}/openssl dgst -sha256 -binary > $@
Max Shvetsov06dba292019-12-06 11:50:12 +000065
66# Certificate NV-Counters. Use values corresponding to tied off values in
67# ARM development platforms
68TFW_NVCTR_VAL ?= 31
69NTFW_NVCTR_VAL ?= 223
laurenw-arm7b7ebff2023-05-02 14:42:48 -050070# The CCA Non-Volatile Counter only exists on some Arm development platforms.
71# On others, we mock it by aliasing it to the Trusted Firmware Non-Volatile counter,
72# hence we set both counters to the same default value.
73CCAFW_NVCTR_VAL ?= 31
Max Shvetsov06dba292019-12-06 11:50:12 +000074else
75# Certificate NV-Counters when CryptoCell is integrated. For development
76# platforms we set the counter to first valid value.
77TFW_NVCTR_VAL ?= 0
78NTFW_NVCTR_VAL ?= 0
laurenw-arm7b7ebff2023-05-02 14:42:48 -050079CCAFW_NVCTR_VAL ?= 0
Max Shvetsov06dba292019-12-06 11:50:12 +000080endif
81BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050082 ${ARM_ROTPK_S}
Max Shvetsov06dba292019-12-06 11:50:12 +000083BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
laurenw-arm055199b2022-10-28 11:26:32 -050084 ${ARM_ROTPK_S}
Juan Castillo31a68f02015-04-14 12:49:03 +010085
Sandrine Bailleux012f8712020-02-06 14:59:33 +010086# Allows platform code to provide implementation variants depending on the
87# selected chain of trust.
88$(eval $(call add_define,ARM_COT_${COT}))
89
90ifeq (${COT},dualroot)
91# Platform Root of Trust key files.
92ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
93ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
94
95# Provide the private key to cert_create tool. It needs it to sign the images.
96PROT_KEY := ${ARM_PROT_KEY}
97
98$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
99
100BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
101BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
102
103$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500104$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
105endif
106
107ifeq (${COT},cca)
108# Platform and Secure World Root of Trust key files.
109ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
110ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
111ARM_SWD_ROT_KEY := plat/arm/board/common/swd_rotpk/arm_swd_rotprivk_rsa.pem
112ARM_SWD_ROTPK_HASH := plat/arm/board/common/swd_rotpk/arm_swd_rotpk_rsa_sha256.bin
113
114# Provide the private keys to cert_create tool. It needs them to sign the images.
115PROT_KEY := ${ARM_PROT_KEY}
116SWD_ROT_KEY := ${ARM_SWD_ROT_KEY}
117
118$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
119$(eval $(call add_define_val,ARM_SWD_ROTPK_HASH,'"$(ARM_SWD_ROTPK_HASH)"'))
120
121BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
122 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
123BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S \
124 plat/arm/board/common/swd_rotpk/arm_dev_swd_rotpk.S
125
126$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
127$(BUILD_PLAT)/bl1/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100128$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
laurenw-armd3449782022-04-21 16:50:49 -0500129$(BUILD_PLAT)/bl2/arm_dev_swd_rotpk.o: $(ARM_SWD_ROTPK_HASH)
Sandrine Bailleux012f8712020-02-06 14:59:33 +0100130endif
131
Juan Castillo31a68f02015-04-14 12:49:03 +0100132endif