1 ## SPDX-License-Identifier: GPL-2.0-only
3 ################################################################################
4 # Take care of subdirectories
5 ################################################################################
9 ################################################################################
10 # ARM specific options
11 ################################################################################
13 ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM64
),y
)
14 check-ramstage-overlap-regions
+= postram_cbfs_cache stack ttb
17 ################################################################################
19 ################################################################################
21 ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM64
),y
)
23 decompressor-y
+= boot.c
25 decompressor-y
+= div0.c
27 decompressor-y
+= eabi_compat.c
28 bootblock-y
+= eabi_compat.c
30 decompressor-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
31 bootblock-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
32 bootblock-y
+= transition.c transition_asm.S
33 ifneq ($(CONFIG_ARM64_CURRENT_EL
),3)
34 bootblock-y
+= smc.c smc_asm.S
37 decompressor-y
+= memset.S
38 bootblock-y
+= memset.S
39 decompressor-y
+= memcpy.S
40 bootblock-y
+= memcpy.S
41 decompressor-y
+= memmove.S
42 bootblock-y
+= memmove.S
46 $(eval
$(call link_stage
,bootblock
))
47 $(eval
$(call link_stage
,decompressor
))
49 endif # CONFIG_ARCH_BOOTBLOCK_ARM64
51 ###############################################################################
53 ###############################################################################
55 ifeq ($(CONFIG_ARCH_VERSTAGE_ARM64
),y
)
57 $(eval
$(call link_stage
,verstage
))
61 verstage-y
+= eabi_compat.c
62 verstage-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
63 verstage-y
+= memset.S
64 verstage-y
+= memcpy.S
65 verstage-y
+= memmove.S
67 verstage-y
+= transition.c transition_asm.S
68 ifneq ($(CONFIG_ARM64_CURRENT_EL
),3)
69 verstage-y
+= smc.c smc_asm.S
72 endif # CONFIG_ARCH_VERSTAGE_ARM64
74 ################################################################################
76 ################################################################################
78 ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM64
),y
)
82 romstage-y
+= eabi_compat.c
83 romstage-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
84 romstage-y
+= memset.S
85 romstage-y
+= memcpy.S
86 romstage-y
+= memmove.S
87 romstage-y
+= ramdetect.c
88 romstage-y
+= romstage.c
89 romstage-y
+= transition.c transition_asm.S
90 ifneq ($(CONFIG_ARM64_CURRENT_EL
),3)
91 romstage-y
+= smc.c smc_asm.S
94 rmodules_arm64-y
+= memset.S
95 rmodules_arm64-y
+= memcpy.S
96 rmodules_arm64-y
+= memmove.S
97 rmodules_arm64-y
+= eabi_compat.c
99 $(eval
$(call link_stage
,romstage
))
101 endif # CONFIG_ARCH_ROMSTAGE_ARM64
103 ################################################################################
105 ################################################################################
107 ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM64
),y
)
110 ramstage-y
+= eabi_compat.c
112 ramstage-
$(CONFIG_GENERATE_SMBIOS_TABLES
) += smbios.c
113 ramstage-y
+= tables.c
114 ramstage-y
+= ramdetect.c
115 ramstage-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
116 ramstage-y
+= memset.S
117 ramstage-y
+= memcpy.S
118 ramstage-y
+= memmove.S
119 ramstage-
$(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE
) += bl31.c
120 ramstage-y
+= transition.c transition_asm.S
121 ifneq ($(CONFIG_ARM64_CURRENT_EL
),3)
122 ramstage-y
+= smc.c smc_asm.S
124 ramstage-
$(CONFIG_PAYLOAD_FIT_SUPPORT
) += fit_payload.c
125 ramstage-
$(CONFIG_HAVE_ACPI_TABLES
) += acpi.c
128 rmodules_arm64-y
+= memset.S
129 rmodules_arm64-y
+= memcpy.S
130 rmodules_arm64-y
+= memmove.S
131 rmodules_arm64-y
+= eabi_compat.c
132 rmodules_arm64-
$(CONFIG_ARM64_USE_ARCH_TIMER
) += arch_timer.c
134 ramstage-srcs
+= $(wildcard src
/mainboard
/$(MAINBOARDDIR
)/mainboard.c
)
138 $(eval
$(call link_stage
,ramstage
))
140 # Build ARM Trusted Firmware (BL31)
142 ifeq ($(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE
),y
)
144 ifeq ($(CONFIG_ARM64_BL31_EXTERNAL_FILE
),"")
146 BL31_SOURCE
:= $(top
)/3rdparty
/arm-trusted-firmware
147 BL31_BUILD
:= $(abspath
$(obj
)/3rdparty
/arm-trusted-firmware
)
148 BL31_TARGET
:= $(BL31_BUILD
)/bl31
/bl31.elf
154 # Build ARM TF in debug mode (with assertions) if coreboot has hard assertions
155 ifeq ($(CONFIG_FATAL_ASSERTS
),y
)
156 BL31_MAKEARGS
+= DEBUG
=1
157 endif # CONFIG_FATAL_ASSERTS
159 # ARM TF's VERBOSE (50) is *very* spammy, so default to INFO (40)
160 BL31_MAKEARGS
+= LOG_LEVEL
=40
162 # Always enable crash reporting, even on a release build
163 BL31_MAKEARGS
+= CRASH_REPORTING
=1
165 # Enable coreboot-specific features like CBMEM console support
166 BL31_MAKEARGS
+= COREBOOT
=1
168 # Avoid build/release|build/debug distinction by overriding BUILD_PLAT directly
169 BL31_MAKEARGS
+= BUILD_PLAT
="$(BL31_BUILD)"
171 # Force making .d files and output directories even though target is not 'bl31'
172 BL31_MAKEARGS
+= IS_ANYTHING_TO_BUILD
=1
174 # Set a consistent build timestamp: the same coreboot has
175 BL31_MAKEARGS
+= BUILD_MESSAGE_TIMESTAMP
='"$(shell sed -n 's
/^.
define COREBOOT_BUILD\
>.
*"\(.*\)".
*/\
1/p
' $(obj)/build.h)"'
177 ifeq ($(CONFIG_ARM64_BL31_OPTEE_WITH_SMC
),y
)
178 BL31_MAKEARGS
+= SPD
=opteed
179 BL31_MAKEARGS
+= OPTEE_ALLOW_SMC_LOAD
=1
180 BL31_MAKEARGS
+= PLAT_XLAT_TABLES_DYNAMIC
=1
181 ifeq ($(CONFIG_CHROMEOS
),y
)
182 BL31_MAKEARGS
+= CROS_WIDEVINE_SMC
=1
184 endif # CONFIG_ARM64_BL31_OPTEE_WITH_SMC
186 BL31_CFLAGS
:= -fno-pic
-fno-stack-protector
-Wno-deprecated-declarations
-Wno-unused-function
187 BL31_LDFLAGS
:= -Wl
,--emit-relocs
189 BL31
:= $(obj
)/bl31.elf
191 $(BL31
): $(obj
)/build.h
192 printf
" MAKE $(subst $(obj)/,,$(@))\n"
193 +unset AS AR CC CPP OC OD LD
; \
194 CROSS_COMPILE
="$(CROSS_COMPILE_arm64)" \
195 CFLAGS
="$(BL31_CFLAGS)" \
196 LDFLAGS
="$(BL31_LDFLAGS)" \
197 $(MAKE
) -C
$(BL31_SOURCE
) $(BL31_MAKEARGS
) $(BL31_TARGET
) DISABLE_PEDANTIC
=1
204 BL31
:= $(call strip_quotes
,$(CONFIG_ARM64_BL31_EXTERNAL_FILE
))
206 endif # CONFIG_ARM64_BUILD_ARM_TRUSTED_FIRMWARE
209 BL31_CBFS
:= $(CONFIG_CBFS_PREFIX
)/bl31
210 $(BL31_CBFS
)-file
:= $(BL31
)
211 $(BL31_CBFS
)-type
:= payload
212 $(BL31_CBFS
)-compression
:= $(CBFS_COMPRESS_FLAG
)
213 cbfs-files-y
+= $(BL31_CBFS
)
215 check-ramstage-overlap-files
+= $(BL31_CBFS
)
217 ifeq ($(CONFIG_ARM64_USE_SECURE_OS
),y
)
219 SECURE_OS_FILE
:= $(CONFIG_ARM64_SECURE_OS_FILE
)
220 SECURE_OS_FILE_CBFS
:= $(CONFIG_CBFS_PREFIX
)/secure_os
221 $(SECURE_OS_FILE_CBFS
)-file
:= $(SECURE_OS_FILE
)
222 $(SECURE_OS_FILE_CBFS
)-type
:= stage
223 cbfs-files-y
+= $(SECURE_OS_FILE_CBFS
)
225 check-ramstage-overlap-files
+= $(SECURE_OS_FILE_CBFS
)
227 endif # CONFIG_ARM64_USE_SECURE_OS
229 endif # CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE
231 endif # CONFIG_ARCH_RAMSTAGE_ARM64