blob: 1885a600a7b27b61ed263f86490c37153057dbb0 [file] [log] [blame]
Juan Castillo31a68f02015-04-14 12:49:03 +01001#
Max Shvetsov06dba292019-12-06 11:50:12 +00002# Copyright (c) 2015-2020, 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)
Max Shvetsov06dba292019-12-06 11:50:12 +000015ifneq (${ARM_CRYPTOCELL_INTEG}, 1)
16# ROTPK hash location
17ifeq (${ARM_ROTPK_LOCATION}, regs)
18 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_REGS_ID
19else ifeq (${ARM_ROTPK_LOCATION}, devel_rsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000020 CRYPTO_ALG=rsa
Max Shvetsov06dba292019-12-06 11:50:12 +000021 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_RSA_ID
22 ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_rsa_sha256.bin
23$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
24$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
25$(warning Development keys support for FVP is deprecated. Use `regs` \
26option instead)
27else ifeq (${ARM_ROTPK_LOCATION}, devel_ecdsa)
Max Shvetsov7b753d92020-02-11 12:41:08 +000028 CRYPTO_ALG=ec
Max Shvetsov06dba292019-12-06 11:50:12 +000029 ARM_ROTPK_LOCATION_ID = ARM_ROTPK_DEVEL_ECDSA_ID
30 ARM_ROTPK_HASH = plat/arm/board/common/rotpk/arm_rotpk_ecdsa_sha256.bin
31$(eval $(call add_define_val,ARM_ROTPK_HASH,'"$(ARM_ROTPK_HASH)"'))
32$(BUILD_PLAT)/bl2/arm_dev_rotpk.o : $(ARM_ROTPK_HASH)
33$(warning Development keys support for FVP is deprecated. Use `regs` \
34option instead)
35else
36 $(error "Unsupported ARM_ROTPK_LOCATION value")
37endif
38
39$(eval $(call add_define,ARM_ROTPK_LOCATION_ID))
40
41# Force generation of the new hash if ROT_KEY is specified
42ifdef ROT_KEY
43 HASH_PREREQUISITES = $(ROT_KEY) FORCE
44FORCE:
45else
46 HASH_PREREQUISITES = $(ROT_KEY)
47endif
48
49$(ARM_ROTPK_HASH) : $(HASH_PREREQUISITES)
50ifndef ROT_KEY
51 $(error Cannot generate hash: no ROT_KEY defined)
52endif
Max Shvetsov7b753d92020-02-11 12:41:08 +000053 openssl ${CRYPTO_ALG} -in $< -pubout -outform DER | openssl dgst \
Max Shvetsov06dba292019-12-06 11:50:12 +000054 -sha256 -binary > $@
55
56# Certificate NV-Counters. Use values corresponding to tied off values in
57# ARM development platforms
58TFW_NVCTR_VAL ?= 31
59NTFW_NVCTR_VAL ?= 223
60else
61# Certificate NV-Counters when CryptoCell is integrated. For development
62# platforms we set the counter to first valid value.
63TFW_NVCTR_VAL ?= 0
64NTFW_NVCTR_VAL ?= 0
65endif
66BL1_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
67 plat/arm/board/common/rotpk/arm_dev_rotpk.S
68BL2_SOURCES += plat/arm/board/common/board_arm_trusted_boot.c \
69 plat/arm/board/common/rotpk/arm_dev_rotpk.S
Juan Castillo31a68f02015-04-14 12:49:03 +010070
Sandrine Bailleux012f8712020-02-06 14:59:33 +010071# Allows platform code to provide implementation variants depending on the
72# selected chain of trust.
73$(eval $(call add_define,ARM_COT_${COT}))
74
75ifeq (${COT},dualroot)
76# Platform Root of Trust key files.
77ARM_PROT_KEY := plat/arm/board/common/protpk/arm_protprivk_rsa.pem
78ARM_PROTPK_HASH := plat/arm/board/common/protpk/arm_protpk_rsa_sha256.bin
79
80# Provide the private key to cert_create tool. It needs it to sign the images.
81PROT_KEY := ${ARM_PROT_KEY}
82
83$(eval $(call add_define_val,ARM_PROTPK_HASH,'"$(ARM_PROTPK_HASH)"'))
84
85BL1_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
86BL2_SOURCES += plat/arm/board/common/protpk/arm_dev_protpk.S
87
88$(BUILD_PLAT)/bl1/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
89$(BUILD_PLAT)/bl2/arm_dev_protpk.o: $(ARM_PROTPK_HASH)
90endif
91
Juan Castillo31a68f02015-04-14 12:49:03 +010092endif