blob: 849ddcd7679ffb258946dc5209f1ab86d35dc75a [file] [log] [blame]
Jun Nie8cfd4b52019-06-13 11:38:24 +08001#
2# Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Architecture
8$(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
9
10TF_CFLAGS += -mfpu=neon
11ASFLAGS += -mfpu=neon
12
13# Platform
14PLAT_INCLUDES := -Idrivers/imx/uart \
15 -Iplat/imx/common/include \
16 -Iplat/imx/imx7/include \
17 -Idrivers/imx/timer \
18 -Idrivers/imx/usdhc \
19
20# Translation tables library
21include lib/xlat_tables_v2/xlat_tables.mk
22
23BL2_SOURCES += common/desc_image_load.c \
24 drivers/delay_timer/delay_timer.c \
25 drivers/mmc/mmc.c \
26 drivers/io/io_block.c \
27 drivers/io/io_fip.c \
28 drivers/io/io_memmap.c \
29 drivers/io/io_storage.c \
30 drivers/imx/timer/imx_gpt.c \
31 drivers/imx/uart/imx_uart.c \
32 drivers/imx/uart/imx_crash_uart.S \
33 lib/aarch32/arm32_aeabi_divmod.c \
34 lib/aarch32/arm32_aeabi_divmod_a32.S \
35 lib/cpus/aarch32/cortex_a7.S \
36 lib/optee/optee_utils.c \
37 plat/imx/common/imx_aips.c \
38 plat/imx/common/imx_caam.c \
39 plat/imx/common/imx_clock.c \
40 plat/imx/common/imx_csu.c \
41 plat/imx/common/imx_io_mux.c \
42 plat/imx/common/imx_snvs.c \
43 plat/imx/common/imx_wdog.c \
44 plat/imx/common/imx7_clock.c \
45 plat/imx/imx7/common/imx7_bl2_mem_params_desc.c \
46 plat/imx/imx7/common/imx7_bl2_el3_common.c \
47 plat/imx/imx7/common/imx7_helpers.S \
48 plat/imx/imx7/common/imx7_image_load.c \
49 plat/imx/imx7/common/imx7_io_storage.c \
50 plat/imx/common/aarch32/imx_uart_console.S \
51 ${XLAT_TABLES_LIB_SRCS}
52
53ifneq (${TRUSTED_BOARD_BOOT},0)
54
55include drivers/auth/mbedtls/mbedtls_crypto.mk
56include drivers/auth/mbedtls/mbedtls_x509.mk
57
58AUTH_SOURCES := drivers/auth/auth_mod.c \
59 drivers/auth/crypto_mod.c \
60 drivers/auth/img_parser_mod.c \
61 drivers/auth/tbbr/tbbr_cot.c
62
63BL2_SOURCES += ${AUTH_SOURCES} \
64 plat/common/tbbr/plat_tbbr.c \
65 plat/imx/imx7/common/imx7_trusted_boot.c \
66 plat/imx/imx7/common/imx7_rotpk.S
67
68ROT_KEY = $(BUILD_PLAT)/rot_key.pem
69ROTPK_HASH = $(BUILD_PLAT)/rotpk_sha256.bin
70
71$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
72$(eval $(call MAKE_LIB_DIRS))
73
74$(BUILD_PLAT)/bl2/imx7_rotpk.o: $(ROTPK_HASH)
75
76certificates: $(ROT_KEY)
77
78$(ROT_KEY): | $(BUILD_PLAT)
79 @echo " OPENSSL $@"
80 @if [ ! -f $(ROT_KEY) ]; then \
81 openssl genrsa 2048 > $@ 2>/dev/null; \
82 fi
83
84$(ROTPK_HASH): $(ROT_KEY)
85 @echo " OPENSSL $@"
86 $(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
87 openssl dgst -sha256 -binary > $@ 2>/dev/null
88endif
89
90# Add the build options to pack BLx images and kernel device tree
91# in the FIP if the platform requires.
92ifneq ($(BL2),)
93$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
94endif
95ifneq ($(BL32_EXTRA1),)
96$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
97endif
98ifneq ($(BL32_EXTRA2),)
99$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
100endif
101ifneq ($(HW_CONFIG),)
102$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
103endif
104
105# Verify build config
106# -------------------
107
108ifeq (${ARCH},aarch64)
109 $(error Error: AArch64 not supported on i.mx7)
110endif