Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | # |
Jayanth Dodderi Chidanand | ce37277 | 2023-04-21 11:40:22 +0100 | [diff] [blame] | 2 | # Copyright (c) 2018-2023, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | # TFTF Version |
| 8 | VERSION_MAJOR := 2 |
Juan Pablo Conde | 0a0f674 | 2023-05-13 00:20:15 -0500 | [diff] [blame] | 9 | VERSION_MINOR := 9 |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 10 | |
Leonardo Sandoval | 667fd72 | 2020-09-11 12:50:19 -0500 | [diff] [blame] | 11 | MAKE_HELPERS_DIRECTORY := make_helpers/ |
| 12 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 13 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 14 | ################################################################################ |
| 15 | # Default values for build configurations, and their dependencies |
| 16 | ################################################################################ |
| 17 | |
Leonardo Sandoval | 667fd72 | 2020-09-11 12:50:19 -0500 | [diff] [blame] | 18 | include ${MAKE_HELPERS_DIRECTORY}defaults.mk |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 19 | |
| 20 | PLAT := ${DEFAULT_PLAT} |
| 21 | |
| 22 | # Assertions enabled for DEBUG builds by default |
| 23 | ENABLE_ASSERTIONS := ${DEBUG} |
| 24 | |
| 25 | ################################################################################ |
| 26 | # Checkpatch script options |
| 27 | ################################################################################ |
| 28 | |
| 29 | CHECKCODE_ARGS := --no-patch |
| 30 | # Do not check the coding style on imported library files or documentation files |
| 31 | INC_LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 32 | include/lib/libfdt \ |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 33 | include/lib/libc, \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 34 | $(wildcard include/lib/*))) |
| 35 | LIB_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 36 | lib/compiler-rt \ |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 37 | lib/libfdt% \ |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 38 | lib/libc, \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 39 | $(wildcard lib/*))) |
| 40 | ROOT_DIRS_TO_CHECK := $(sort $(filter-out \ |
| 41 | lib \ |
| 42 | include \ |
| 43 | docs \ |
| 44 | %.md \ |
| 45 | %.rst, \ |
| 46 | $(wildcard *))) |
| 47 | CHECK_PATHS := ${ROOT_DIRS_TO_CHECK} \ |
| 48 | ${INC_LIB_DIRS_TO_CHECK} \ |
| 49 | ${LIB_DIRS_TO_CHECK} |
| 50 | |
| 51 | ifeq (${V},0) |
| 52 | Q=@ |
| 53 | else |
| 54 | Q= |
| 55 | endif |
| 56 | export Q |
| 57 | |
| 58 | ifneq (${DEBUG}, 0) |
| 59 | BUILD_TYPE := debug |
| 60 | # Use LOG_LEVEL_INFO by default for debug builds |
| 61 | LOG_LEVEL := 40 |
| 62 | else |
| 63 | BUILD_TYPE := release |
| 64 | # Use LOG_LEVEL_ERROR by default for release builds |
| 65 | LOG_LEVEL := 20 |
| 66 | endif |
| 67 | |
| 68 | # Default build string (git branch and commit) |
| 69 | ifeq (${BUILD_STRING},) |
Manish V Badarkhe | ce14941 | 2022-05-24 22:54:45 +0100 | [diff] [blame] | 70 | BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 71 | endif |
| 72 | |
| 73 | VERSION_STRING := v${VERSION_MAJOR}.${VERSION_MINOR}(${PLAT},${BUILD_TYPE}):${BUILD_STRING} |
| 74 | |
| 75 | BUILD_BASE := ./build |
| 76 | BUILD_PLAT := ${BUILD_BASE}/${PLAT}/${BUILD_TYPE} |
| 77 | |
| 78 | PLAT_MAKEFILE := platform.mk |
| 79 | # Generate the platforms list by recursively searching for all directories |
| 80 | # under /plat containing a PLAT_MAKEFILE. Append each platform with a `|` |
| 81 | # char and strip out the final '|'. |
| 82 | PLATFORMS := $(shell find plat/ -name '${PLAT_MAKEFILE}' -print0 | \ |
| 83 | sed -r 's%[^\x00]*\/([^/]*)\/${PLAT_MAKEFILE}\x00%\1|%g' | \ |
| 84 | sed -r 's/\|$$//') |
| 85 | |
Sandrine Bailleux | f8228af | 2020-04-21 14:45:00 +0200 | [diff] [blame] | 86 | DOCS_PATH := docs |
| 87 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 88 | ifeq (${PLAT},) |
| 89 | $(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform") |
| 90 | endif |
| 91 | PLAT_PATH := $(shell find plat/ -wholename '*/${PLAT}') |
| 92 | PLAT_MAKEFILE_FULL := ${PLAT_PATH}/${PLAT_MAKEFILE} |
| 93 | ifeq ($(wildcard ${PLAT_MAKEFILE_FULL}),) |
| 94 | $(error "Error: Invalid platform. The following platforms are available: ${PLATFORMS}") |
| 95 | endif |
| 96 | |
Arvind Ram Prakash | 2e1264d | 2022-05-20 12:27:40 -0500 | [diff] [blame] | 97 | |
| 98 | EL3_PAYLOAD_PLAT_PATH := $(shell find el3_payload/plat/ -wholename '*/${PLAT}') |
| 99 | EL3_PAYLOAD_PLAT_MAKEFILE_FULL := ${EL3_PAYLOAD_PLAT_PATH}/${PLAT_MAKEFILE} |
| 100 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 101 | .PHONY: all |
| 102 | all: msg_start |
| 103 | |
| 104 | .PHONY: msg_start |
| 105 | msg_start: |
| 106 | @echo "Building ${PLAT}" |
Sandrine Bailleux | 043d536 | 2018-10-03 17:05:59 +0200 | [diff] [blame] | 107 | @echo "Selected set of tests: ${TESTS}" |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 108 | |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 109 | # Set flags for Realm Payload Tests |
| 110 | ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1) |
| 111 | BRANCH_PROTECTION := 2 |
| 112 | endif |
| 113 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 114 | # Include test images makefiles. |
| 115 | include tftf/framework/framework.mk |
| 116 | include tftf/tests/tests.mk |
| 117 | include fwu/ns_bl1u/ns_bl1u.mk |
| 118 | include fwu/ns_bl2u/ns_bl2u.mk |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 119 | |
Daniel Boulby | f6c288e | 2022-07-25 14:07:57 +0100 | [diff] [blame] | 120 | # List of secure partitions present. |
| 121 | SECURE_PARTITIONS := |
| 122 | |
Olivier Deprez | 40777f8 | 2022-11-09 10:15:28 +0100 | [diff] [blame] | 123 | # Only platform fvp supports cactus_mm |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 124 | ifeq (${ARCH}-${PLAT},aarch64-fvp) |
Antonio Nino Diaz | f2218e7 | 2019-03-19 10:59:11 +0000 | [diff] [blame] | 125 | include spm/cactus_mm/cactus_mm.mk |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 126 | include realm/realm.mk |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 127 | endif |
| 128 | |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 129 | # cactus and ivy are supported on platforms: fvp, tc |
| 130 | ifeq (${ARCH}-${PLAT},$(filter ${ARCH}-${PLAT},aarch64-fvp aarch64-tc)) |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 131 | include spm/cactus/cactus.mk |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 132 | include spm/ivy/ivy.mk |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 133 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 134 | |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 135 | ################################################################################ |
| 136 | # Include libc |
| 137 | ################################################################################ |
| 138 | include lib/libc/libc.mk |
| 139 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 140 | # Include platform specific makefile last because: |
| 141 | # - the platform makefile may use all previous definitions in this file. |
| 142 | # - the platform makefile may wish overwriting some of them. |
| 143 | include ${PLAT_MAKEFILE_FULL} |
| 144 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 145 | .SUFFIXES: |
| 146 | |
| 147 | ################################################################################ |
| 148 | # Build options checks |
| 149 | ################################################################################ |
| 150 | $(eval $(call assert_boolean,DEBUG)) |
| 151 | $(eval $(call assert_boolean,ENABLE_ASSERTIONS)) |
| 152 | $(eval $(call assert_boolean,FIRMWARE_UPDATE)) |
| 153 | $(eval $(call assert_boolean,FWU_BL_TEST)) |
| 154 | $(eval $(call assert_boolean,NEW_TEST_SESSION)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 155 | $(eval $(call assert_boolean,USE_NVM)) |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 156 | $(eval $(call assert_numeric,BRANCH_PROTECTION)) |
| 157 | $(eval $(call assert_boolean,ENABLE_REALM_PAYLOAD_TESTS)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 158 | |
| 159 | ################################################################################ |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 160 | # Process build options |
| 161 | ################################################################################ |
| 162 | |
| 163 | # Process BRANCH_PROTECTION value and set |
| 164 | # Pointer Authentication and Branch Target Identification flags |
| 165 | include branch_protection.mk |
| 166 | |
| 167 | ################################################################################ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 168 | # Add definitions to the cpp preprocessor based on the current build options. |
| 169 | # This is done after including the platform specific makefile to allow the |
| 170 | # platform to overwrite the default options |
| 171 | ################################################################################ |
| 172 | $(eval $(call add_define,TFTF_DEFINES,ARM_ARCH_MAJOR)) |
| 173 | $(eval $(call add_define,TFTF_DEFINES,ARM_ARCH_MINOR)) |
| 174 | $(eval $(call add_define,TFTF_DEFINES,DEBUG)) |
| 175 | $(eval $(call add_define,TFTF_DEFINES,ENABLE_ASSERTIONS)) |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 176 | $(eval $(call add_define,TFTF_DEFINES,ENABLE_BTI)) |
Antonio Nino Diaz | 9c9f92c | 2019-03-13 13:57:39 +0000 | [diff] [blame] | 177 | $(eval $(call add_define,TFTF_DEFINES,ENABLE_PAUTH)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 178 | $(eval $(call add_define,TFTF_DEFINES,LOG_LEVEL)) |
| 179 | $(eval $(call add_define,TFTF_DEFINES,NEW_TEST_SESSION)) |
| 180 | $(eval $(call add_define,TFTF_DEFINES,PLAT_${PLAT})) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 181 | $(eval $(call add_define,TFTF_DEFINES,USE_NVM)) |
| 182 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 183 | ################################################################################ |
| 184 | |
| 185 | # Assembler, compiler and linker flags shared across all test images. |
| 186 | COMMON_ASFLAGS := |
| 187 | COMMON_CFLAGS := |
| 188 | COMMON_LDFLAGS := |
| 189 | |
| 190 | ifeq (${DEBUG},1) |
Daniel Boulby | ed1f951 | 2022-05-03 16:36:51 +0100 | [diff] [blame] | 191 | COMMON_CFLAGS += -g -gdwarf-4 |
| 192 | COMMON_ASFLAGS += -g -Wa,--gdwarf-4 |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 193 | endif |
| 194 | |
Joel Hutton | 6a6f483 | 2019-04-08 15:46:36 +0100 | [diff] [blame] | 195 | # Set the compiler's target architecture profile based on ARM_ARCH_MINOR option |
| 196 | ifeq (${ARM_ARCH_MINOR},0) |
Alexei Fedorov | d92f4ce | 2020-12-07 18:13:28 +0000 | [diff] [blame] | 197 | march32-directive = -march=armv${ARM_ARCH_MAJOR}-a |
| 198 | march64-directive = -march=armv${ARM_ARCH_MAJOR}-a |
Joel Hutton | 6a6f483 | 2019-04-08 15:46:36 +0100 | [diff] [blame] | 199 | else |
Alexei Fedorov | d92f4ce | 2020-12-07 18:13:28 +0000 | [diff] [blame] | 200 | march32-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a |
| 201 | march64-directive = -march=armv${ARM_ARCH_MAJOR}.${ARM_ARCH_MINOR}-a |
Joel Hutton | 6a6f483 | 2019-04-08 15:46:36 +0100 | [diff] [blame] | 202 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 203 | |
Alexei Fedorov | d92f4ce | 2020-12-07 18:13:28 +0000 | [diff] [blame] | 204 | # Get architecture feature modifiers |
| 205 | arch-features = ${ARM_ARCH_FEATURE} |
| 206 | |
| 207 | # Set the compiler's architecture feature modifiers |
| 208 | ifneq ($(arch-features), none) |
| 209 | ifeq ($(ARCH), aarch32) |
| 210 | march32-directive := $(march32-directive)+$(arch-features) |
| 211 | else |
| 212 | march64-directive := $(march64-directive)+$(arch-features) |
| 213 | endif |
| 214 | # Print features |
| 215 | $(info Arm Architecture Features specified: $(subst +, ,$(arch-features))) |
| 216 | endif # arch-features |
| 217 | |
Joel Hutton | 6a6f483 | 2019-04-08 15:46:36 +0100 | [diff] [blame] | 218 | COMMON_ASFLAGS_aarch64 := -mgeneral-regs-only ${march64-directive} |
| 219 | COMMON_CFLAGS_aarch64 := -mgeneral-regs-only -mstrict-align ${march64-directive} |
| 220 | |
| 221 | COMMON_ASFLAGS_aarch32 := ${march32-directive} |
| 222 | COMMON_CFLAGS_aarch32 := ${march32-directive} -mno-unaligned-access |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 223 | |
| 224 | COMMON_ASFLAGS += -nostdinc -ffreestanding -Wa,--fatal-warnings \ |
| 225 | -Werror -Wmissing-include-dirs \ |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 226 | -D__ASSEMBLY__ $(COMMON_ASFLAGS_$(ARCH)) \ |
| 227 | ${INCLUDES} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 228 | COMMON_CFLAGS += -nostdinc -ffreestanding -Wall -Werror \ |
| 229 | -Wmissing-include-dirs $(COMMON_CFLAGS_$(ARCH)) \ |
| 230 | -std=gnu99 -Os |
| 231 | COMMON_CFLAGS += -ffunction-sections -fdata-sections |
| 232 | |
| 233 | # Get the content of CFLAGS user defined value last so they are appended after |
| 234 | # the options defined in the Makefile |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 235 | COMMON_CFLAGS += ${CFLAGS} ${INCLUDES} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 236 | |
Karl Meakin | e69d128 | 2023-03-07 17:10:07 +0000 | [diff] [blame^] | 237 | COMMON_LDFLAGS += ${LDFLAGS} --fatal-warnings -O1 --gc-sections --build-id=none |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 238 | |
| 239 | CC := ${CROSS_COMPILE}gcc |
| 240 | CPP := ${CROSS_COMPILE}cpp |
| 241 | AS := ${CROSS_COMPILE}gcc |
| 242 | AR := ${CROSS_COMPILE}ar |
| 243 | LD := ${CROSS_COMPILE}ld |
| 244 | OC := ${CROSS_COMPILE}objcopy |
| 245 | OD := ${CROSS_COMPILE}objdump |
| 246 | NM := ${CROSS_COMPILE}nm |
| 247 | PP := ${CROSS_COMPILE}gcc |
| 248 | |
Soby Mathew | 25d9e2f | 2023-05-05 10:51:57 +0100 | [diff] [blame] | 249 | # With ld.bfd version 2.39 and newer new warnings are added. Skip those since we |
| 250 | # are not loaded by a elf loader. |
| 251 | COMMON_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) |
| 252 | |
Govindraj Raja | 1421d77 | 2023-05-05 09:15:43 -0500 | [diff] [blame] | 253 | # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 |
| 254 | COMMON_CFLAGS += $(call cc_option, --param=min-pagesize=0) |
| 255 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 256 | ################################################################################ |
| 257 | |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 258 | TFTF_SOURCES := ${FRAMEWORK_SOURCES} ${TESTS_SOURCES} ${PLAT_SOURCES} ${LIBC_SRCS} ${LIBFDT_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 259 | TFTF_INCLUDES += ${PLAT_INCLUDES} |
| 260 | TFTF_CFLAGS += ${COMMON_CFLAGS} |
| 261 | TFTF_ASFLAGS += ${COMMON_ASFLAGS} |
| 262 | TFTF_LDFLAGS += ${COMMON_LDFLAGS} |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 263 | TFTF_EXTRA_OBJS := |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 264 | |
Alexei Fedorov | 7fac162 | 2020-06-19 14:25:43 +0100 | [diff] [blame] | 265 | ifneq (${BP_OPTION},none) |
| 266 | TFTF_CFLAGS += -mbranch-protection=${BP_OPTION} |
| 267 | NS_BL1U_CFLAGS += -mbranch-protection=${BP_OPTION} |
| 268 | NS_BL2U_CFLAGS += -mbranch-protection=${BP_OPTION} |
| 269 | CACTUS_MM_CFLAGS += -mbranch-protection=${BP_OPTION} |
| 270 | CACTUS_CFLAGS += -mbranch-protection=${BP_OPTION} |
| 271 | IVY_CFLAGS += -mbranch-protection=${BP_OPTION} |
AlexeiFedorov | 193b356 | 2022-12-22 16:50:08 +0000 | [diff] [blame] | 272 | REALM_CFLAGS += -mbranch-protection=${BP_OPTION} |
Antonio Nino Diaz | 9c9f92c | 2019-03-13 13:57:39 +0000 | [diff] [blame] | 273 | endif |
| 274 | |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 275 | ifeq ($(SMC_FUZZING), 1) |
| 276 | TFTF_EXTRA_OBJS += ${BUILD_PLAT}/smcf/dtb.o |
| 277 | endif |
| 278 | |
Olivier Deprez | 231115d | 2020-02-03 11:27:01 +0100 | [diff] [blame] | 279 | ##################################################################################### |
| 280 | ifneq ($(findstring gcc,$(notdir $(LD))),) |
| 281 | PIE_LDFLAGS += -Wl,-pie -Wl,--no-dynamic-linker |
| 282 | else |
| 283 | PIE_LDFLAGS += -pie --no-dynamic-linker |
| 284 | endif |
| 285 | |
| 286 | ##################################################################################### |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 287 | NS_BL1U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 288 | NS_BL1U_INCLUDES += ${PLAT_INCLUDES} |
| 289 | NS_BL1U_CFLAGS += ${COMMON_CFLAGS} |
| 290 | NS_BL1U_ASFLAGS += ${COMMON_ASFLAGS} |
| 291 | NS_BL1U_LDFLAGS += ${COMMON_LDFLAGS} |
| 292 | |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 293 | NS_BL2U_SOURCES += ${PLAT_SOURCES} ${LIBC_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 294 | NS_BL2U_INCLUDES += ${PLAT_INCLUDES} |
| 295 | NS_BL2U_CFLAGS += ${COMMON_CFLAGS} |
| 296 | NS_BL2U_ASFLAGS += ${COMMON_ASFLAGS} |
| 297 | NS_BL2U_LDFLAGS += ${COMMON_LDFLAGS} |
| 298 | |
Antonio Nino Diaz | f2218e7 | 2019-03-19 10:59:11 +0000 | [diff] [blame] | 299 | CACTUS_MM_SOURCES += ${LIBC_SRCS} |
| 300 | CACTUS_MM_INCLUDES += ${PLAT_INCLUDES} |
| 301 | CACTUS_MM_CFLAGS += ${COMMON_CFLAGS} |
| 302 | CACTUS_MM_ASFLAGS += ${COMMON_ASFLAGS} |
| 303 | CACTUS_MM_LDFLAGS += ${COMMON_LDFLAGS} |
| 304 | |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 305 | CACTUS_SOURCES += ${LIBC_SRCS} |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 306 | CACTUS_INCLUDES += ${PLAT_INCLUDES} |
Olivier Deprez | 231115d | 2020-02-03 11:27:01 +0100 | [diff] [blame] | 307 | CACTUS_CFLAGS += ${COMMON_CFLAGS} -fpie |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 308 | CACTUS_ASFLAGS += ${COMMON_ASFLAGS} |
Olivier Deprez | 231115d | 2020-02-03 11:27:01 +0100 | [diff] [blame] | 309 | CACTUS_LDFLAGS += ${COMMON_LDFLAGS} $(PIE_LDFLAGS) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 310 | |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 311 | IVY_SOURCES += ${LIBC_SRCS} |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 312 | IVY_INCLUDES += ${PLAT_INCLUDES} |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 313 | IVY_CFLAGS += ${COMMON_CFLAGS} -fpie |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 314 | IVY_ASFLAGS += ${COMMON_ASFLAGS} |
Ruari Phipps | 9f1952c | 2020-08-24 11:32:32 +0100 | [diff] [blame] | 315 | IVY_LDFLAGS += ${COMMON_LDFLAGS} $(PIE_LDFLAGS) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 316 | |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 317 | REALM_SOURCES += ${LIBC_SRCS} |
| 318 | REALM_CFLAGS += ${COMMON_CFLAGS} -fpie |
| 319 | REALM_ASFLAGS += ${COMMON_ASFLAGS} |
| 320 | REALM_LDFLAGS += ${COMMON_LDFLAGS} $(PIE_LDFLAGS) |
| 321 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 322 | .PHONY: locate-checkpatch |
| 323 | locate-checkpatch: |
| 324 | ifndef CHECKPATCH |
| 325 | $(error "Please set CHECKPATCH to point to the Linux checkpatch.pl file, eg: CHECKPATCH=../linux/script/checkpatch.pl") |
| 326 | else |
| 327 | ifeq (,$(wildcard ${CHECKPATCH})) |
| 328 | $(error "The file CHECKPATCH points to cannot be found, use eg: CHECKPATCH=../linux/script/checkpatch.pl") |
| 329 | endif |
| 330 | endif |
| 331 | |
| 332 | .PHONY: clean |
| 333 | clean: |
| 334 | @echo " CLEAN" |
| 335 | ${Q}rm -rf ${BUILD_PLAT} |
Shriram K | 8687985 | 2022-09-15 15:45:05 +0530 | [diff] [blame] | 336 | ifneq ($(wildcard ${EL3_PAYLOAD_PLAT_MAKEFILE_FULL}),) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 337 | ${MAKE} -C el3_payload clean |
Shriram K | 8687985 | 2022-09-15 15:45:05 +0530 | [diff] [blame] | 338 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 339 | |
| 340 | .PHONY: realclean distclean |
| 341 | realclean distclean: |
| 342 | @echo " REALCLEAN" |
| 343 | ${Q}rm -rf ${BUILD_BASE} |
| 344 | ${Q}rm -f ${CURDIR}/cscope.* |
Shriram K | 8687985 | 2022-09-15 15:45:05 +0530 | [diff] [blame] | 345 | ifneq ($(wildcard ${EL3_PAYLOAD_PLAT_MAKEFILE_FULL}),) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 346 | ${MAKE} -C el3_payload distclean |
Shriram K | 8687985 | 2022-09-15 15:45:05 +0530 | [diff] [blame] | 347 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 348 | |
| 349 | .PHONY: checkcodebase |
| 350 | checkcodebase: locate-checkpatch |
| 351 | @echo " CHECKING STYLE" |
| 352 | @if test -d .git ; then \ |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 353 | git ls-files | grep -E -v 'libfdt|libc|docs|\.md|\.rst' | \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 354 | while read GIT_FILE ; \ |
| 355 | do ${CHECKPATCH} ${CHECKCODE_ARGS} -f $$GIT_FILE ; \ |
| 356 | done ; \ |
| 357 | else \ |
| 358 | find . -type f -not -iwholename "*.git*" \ |
| 359 | -not -iwholename "*build*" \ |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 360 | -not -iwholename "*libfdt*" \ |
Ambroise Vincent | d6e806d | 2019-02-11 14:34:26 +0000 | [diff] [blame] | 361 | -not -iwholename "*libc*" \ |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 362 | -not -iwholename "*docs*" \ |
| 363 | -not -iwholename "*.md" \ |
| 364 | -not -iwholename "*.rst" \ |
| 365 | -exec ${CHECKPATCH} ${CHECKCODE_ARGS} -f {} \; ; \ |
| 366 | fi |
| 367 | |
| 368 | .PHONY: checkpatch |
| 369 | checkpatch: locate-checkpatch |
| 370 | @echo " CHECKING STYLE" |
| 371 | ${Q}COMMON_COMMIT=$$(git merge-base HEAD ${BASE_COMMIT}); \ |
| 372 | for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \ |
| 373 | printf "\n[*] Checking style of '$$commit'\n\n"; \ |
| 374 | git log --format=email "$$commit~..$$commit" \ |
| 375 | -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \ |
| 376 | git diff --format=email "$$commit~..$$commit" \ |
| 377 | -- ${CHECK_PATHS} | ${CHECKPATCH} - || true; \ |
| 378 | done |
| 379 | |
| 380 | ifneq (${FIRMWARE_UPDATE},1) |
| 381 | .PHONY: ns_bl1u ns_bl2u |
| 382 | ns_bl1u ns_bl2u: |
| 383 | @echo "ERROR: Can't build $@ because Firmware Update is not supported \ |
| 384 | on this platform." |
| 385 | @exit 1 |
| 386 | endif |
| 387 | |
| 388 | ifneq (${ARCH}-${PLAT},aarch64-fvp) |
Antonio Nino Diaz | f2218e7 | 2019-03-19 10:59:11 +0000 | [diff] [blame] | 389 | .PHONY: cactus_mm |
| 390 | cactus_mm: |
| 391 | @echo "ERROR: $@ is supported only on AArch64 FVP." |
| 392 | @exit 1 |
| 393 | |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 394 | .PHONY: realm |
| 395 | realm: |
| 396 | @echo "ERROR: $@ is supported only on AArch64 FVP." |
| 397 | @exit 1 |
| 398 | |
| 399 | .PHONY: pack_realm |
| 400 | pack_realm: |
| 401 | @echo "Nothing to be done" |
| 402 | @exit 1 |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 403 | endif |
| 404 | |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 405 | ifneq (${ARCH}-${PLAT},$(filter ${ARCH}-${PLAT},aarch64-fvp aarch64-tc)) |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 406 | .PHONY: cactus |
| 407 | cactus: |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 408 | @echo "ERROR: $@ is supported only on AArch64 FVP or TC." |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 409 | @exit 1 |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 410 | |
| 411 | .PHONY: ivy |
| 412 | ivy: |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 413 | @echo "ERROR: $@ is supported only on AArch64 FVP or TC." |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 414 | @exit 1 |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 415 | endif |
| 416 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 417 | MAKE_DEP = -Wp,-MD,$(DEP) -MT $$@ |
| 418 | |
| 419 | define MAKE_C |
| 420 | |
| 421 | $(eval OBJ := $(1)/$(patsubst %.c,%.o,$(notdir $(2)))) |
| 422 | $(eval DEP := $(patsubst %.o,%.d,$(OBJ))) |
| 423 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 424 | $(OBJ) : $(2) | $(AUTOGEN_DIR)/tests_list.h |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 425 | @echo " CC $$<" |
| 426 | $$(Q)$$(CC) $$($(3)_CFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@ |
| 427 | |
| 428 | -include $(DEP) |
| 429 | endef |
| 430 | |
| 431 | |
| 432 | define MAKE_S |
| 433 | |
| 434 | $(eval OBJ := $(1)/$(patsubst %.S,%.o,$(notdir $(2)))) |
| 435 | $(eval DEP := $(patsubst %.o,%.d,$(OBJ))) |
| 436 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 437 | $(OBJ) : $(2) | $(AUTOGEN_DIR)/tests_list.h |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 438 | @echo " AS $$<" |
| 439 | $$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -DIMAGE_$(3) $(MAKE_DEP) -c $$< -o $$@ |
| 440 | |
| 441 | -include $(DEP) |
| 442 | endef |
| 443 | |
| 444 | |
| 445 | define MAKE_LD |
| 446 | |
| 447 | $(eval DEP := $(1).d) |
| 448 | |
Bence Szépkúti | 537b358 | 2019-11-29 18:23:56 +0100 | [diff] [blame] | 449 | $(1) : $(2) | $(AUTOGEN_DIR)/tests_list.h |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 450 | @echo " PP $$<" |
| 451 | $$(Q)$$(AS) $$($(3)_ASFLAGS) ${$(3)_INCLUDES} ${$(3)_DEFINES} -P -E $(MAKE_DEP) -o $$@ $$< |
| 452 | |
| 453 | -include $(DEP) |
| 454 | endef |
| 455 | |
| 456 | |
| 457 | define MAKE_OBJS |
| 458 | $(eval C_OBJS := $(filter %.c,$(2))) |
| 459 | $(eval REMAIN := $(filter-out %.c,$(2))) |
| 460 | $(eval $(foreach obj,$(C_OBJS),$(call MAKE_C,$(1),$(obj),$(3)))) |
| 461 | |
| 462 | $(eval S_OBJS := $(filter %.S,$(REMAIN))) |
| 463 | $(eval REMAIN := $(filter-out %.S,$(REMAIN))) |
| 464 | $(eval $(foreach obj,$(S_OBJS),$(call MAKE_S,$(1),$(obj),$(3)))) |
| 465 | |
| 466 | $(and $(REMAIN),$(error Unexpected source files present: $(REMAIN))) |
| 467 | endef |
| 468 | |
| 469 | |
| 470 | # NOTE: The line continuation '\' is required in the next define otherwise we |
| 471 | # end up with a line-feed characer at the end of the last c filename. |
| 472 | # Also bare this issue in mind if extending the list of supported filetypes. |
| 473 | define SOURCES_TO_OBJS |
| 474 | $(notdir $(patsubst %.c,%.o,$(filter %.c,$(1)))) \ |
| 475 | $(notdir $(patsubst %.S,%.o,$(filter %.S,$(1)))) |
| 476 | endef |
| 477 | |
| 478 | define uppercase |
| 479 | $(shell echo $(1) | tr '[:lower:]' '[:upper:]') |
| 480 | endef |
| 481 | |
| 482 | define MAKE_IMG |
| 483 | $(eval IMG_PREFIX := $(call uppercase, $(1))) |
| 484 | $(eval BUILD_DIR := ${BUILD_PLAT}/$(1)) |
| 485 | $(eval SOURCES := $(${IMG_PREFIX}_SOURCES)) |
| 486 | $(eval OBJS := $(addprefix $(BUILD_DIR)/,$(call SOURCES_TO_OBJS,$(SOURCES)))) |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 487 | $(eval OBJS += $(${IMG_PREFIX}_EXTRA_OBJS)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 488 | $(eval LINKERFILE := $(BUILD_DIR)/$(1).ld) |
| 489 | $(eval MAPFILE := $(BUILD_DIR)/$(1).map) |
| 490 | $(eval ELF := $(BUILD_DIR)/$(1).elf) |
| 491 | $(eval DUMP := $(BUILD_DIR)/$(1).dump) |
| 492 | $(eval BIN := $(BUILD_PLAT)/$(1).bin) |
| 493 | |
| 494 | $(eval $(call MAKE_OBJS,$(BUILD_DIR),$(SOURCES),${IMG_PREFIX})) |
| 495 | $(eval $(call MAKE_LD,$(LINKERFILE),$(${IMG_PREFIX}_LINKERFILE),${IMG_PREFIX})) |
| 496 | |
| 497 | $(BUILD_DIR) : |
| 498 | $$(Q)mkdir -p "$$@" |
| 499 | |
| 500 | $(ELF) : $(OBJS) $(LINKERFILE) |
| 501 | @echo " LD $$@" |
| 502 | @echo 'const char build_message[] = "Built : "__TIME__", "__DATE__; \ |
| 503 | const char version_string[] = "${VERSION_STRING}";' | \ |
| 504 | $$(CC) $$(${IMG_PREFIX}_CFLAGS) ${${IMG_PREFIX}_INCLUDES} ${${IMG_PREFIX}_DEFINES} -c -xc - -o $(BUILD_DIR)/build_message.o |
| 505 | $$(Q)$$(LD) -o $$@ $$(${IMG_PREFIX}_LDFLAGS) -Map=$(MAPFILE) \ |
| 506 | -T $(LINKERFILE) $(BUILD_DIR)/build_message.o $(OBJS) |
| 507 | |
| 508 | $(DUMP) : $(ELF) |
| 509 | @echo " OD $$@" |
| 510 | $${Q}$${OD} -dx $$< > $$@ |
| 511 | |
| 512 | $(BIN) : $(ELF) |
| 513 | @echo " BIN $$@" |
| 514 | $$(Q)$$(OC) -O binary $$< $$@ |
| 515 | @echo |
| 516 | @echo "Built $$@ successfully" |
| 517 | @echo |
| 518 | |
| 519 | .PHONY : $(1) |
| 520 | $(1) : $(BUILD_DIR) $(BIN) $(DUMP) |
| 521 | |
| 522 | all : $(1) |
| 523 | |
| 524 | endef |
| 525 | |
Shruti Gupta | 2eb601b | 2023-03-29 21:35:17 +0100 | [diff] [blame] | 526 | ifeq (${ARCH},aarch32) |
| 527 | ARCH_TESTS_SKIP_LIST := tftf/tests/aarch32_tests_to_skip.txt |
| 528 | endif |
| 529 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 530 | $(AUTOGEN_DIR): |
| 531 | $(Q)mkdir -p "$@" |
| 532 | |
Shruti Gupta | 2eb601b | 2023-03-29 21:35:17 +0100 | [diff] [blame] | 533 | $(AUTOGEN_DIR)/tests_list.c $(AUTOGEN_DIR)/tests_list.h: $(AUTOGEN_DIR) ${TESTS_FILE} ${PLAT_TESTS_SKIP_LIST} $(ARCH_TESTS_SKIP_LIST) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 534 | @echo " AUTOGEN $@" |
Jim Ray | 7ba27bf | 2023-05-25 14:11:51 -0700 | [diff] [blame] | 535 | tools/generate_test_list/generate_test_list.py $(AUTOGEN_DIR)/tests_list.c \ |
| 536 | $(AUTOGEN_DIR)/tests_list.h ${TESTS_FILE} \ |
| 537 | --plat-skip-file=$(PLAT_TESTS_SKIP_LIST) \ |
| 538 | --arch-skip-file=$(ARCH_TESTS_SKIP_LIST) |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 539 | ifeq ($(SMC_FUZZING), 1) |
| 540 | $(Q)mkdir -p ${BUILD_PLAT}/smcf |
| 541 | dtc ${SMC_FUZZ_DTS} >> ${BUILD_PLAT}/smcf/dtb |
| 542 | $(OC) -I binary -O elf64-littleaarch64 -B aarch64 ${BUILD_PLAT}/smcf/dtb ${BUILD_PLAT}/smcf/dtb.o \ |
johpow01 | d5c79cc | 2021-06-23 16:10:22 -0500 | [diff] [blame] | 543 | --redefine-sym _binary___build_$(PLAT)_$(BUILD_TYPE)_smcf_dtb_start=_binary___dtb_start \ |
| 544 | --redefine-sym _binary___build_$(PLAT)_$(BUILD_TYPE)_smcf_dtb_end=_binary___dtb_end |
Mark Dykes | e7810b5 | 2020-06-03 15:46:55 -0500 | [diff] [blame] | 545 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 546 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 547 | ifeq ($(FIRMWARE_UPDATE), 1) |
| 548 | $(eval $(call MAKE_IMG,ns_bl1u)) |
| 549 | $(eval $(call MAKE_IMG,ns_bl2u)) |
| 550 | endif |
| 551 | |
| 552 | ifeq (${ARCH}-${PLAT},aarch64-fvp) |
Antonio Nino Diaz | f2218e7 | 2019-03-19 10:59:11 +0000 | [diff] [blame] | 553 | $(eval $(call MAKE_IMG,cactus_mm)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 554 | $(eval $(call MAKE_IMG,cactus)) |
Antonio Nino Diaz | 0b1ab40 | 2018-12-05 15:38:39 +0000 | [diff] [blame] | 555 | $(eval $(call MAKE_IMG,ivy)) |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 556 | endif |
| 557 | |
| 558 | ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1) |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 559 | $(eval $(call MAKE_IMG,realm)) |
| 560 | endif |
| 561 | |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 562 | .PHONY : tftf |
| 563 | $(eval $(call MAKE_IMG,tftf)) |
| 564 | |
| 565 | ifeq (${ENABLE_REALM_PAYLOAD_TESTS},1) |
| 566 | tftf: realm |
| 567 | @echo " PACK REALM PAYLOAD" |
| 568 | $(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \ |
| 569 | seek=$(TFTF_MAX_IMAGE_SIZE)) |
| 570 | endif |
| 571 | |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 572 | ifeq (${ARCH}-${PLAT},aarch64-fvp) |
| 573 | .PHONY : pack_realm |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 574 | $(eval $(call MAKE_IMG,realm)) |
nabkah01 | 002e569 | 2022-10-10 12:36:46 +0100 | [diff] [blame] | 575 | pack_realm: realm tftf |
| 576 | @echo " PACK REALM PAYLOAD" |
| 577 | $(shell dd if=$(BUILD_PLAT)/realm.bin of=$(BUILD_PLAT)/tftf.bin obs=1 \ |
| 578 | seek=$(TFTF_MAX_IMAGE_SIZE)) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 579 | endif |
| 580 | |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 581 | ifeq (${ARCH}-${PLAT},aarch64-tc) |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 582 | $(eval $(call MAKE_IMG,cactus)) |
Olivier Deprez | 2765ebf | 2020-12-16 15:46:14 +0100 | [diff] [blame] | 583 | $(eval $(call MAKE_IMG,ivy)) |
Arunachalam Ganapathy | 1e51c2f | 2020-09-22 13:28:29 +0100 | [diff] [blame] | 584 | endif |
| 585 | |
Daniel Boulby | f6c288e | 2022-07-25 14:07:57 +0100 | [diff] [blame] | 586 | SP_LAYOUT: |
| 587 | ${Q}tools/generate_json/generate_json.sh \ |
| 588 | $(BUILD_PLAT) $(SECURE_PARTITIONS) |
| 589 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 590 | # The EL3 test payload is only supported in AArch64. It has an independent build |
| 591 | # system. |
| 592 | .PHONY: el3_payload |
| 593 | ifneq (${ARCH},aarch32) |
Arvind Ram Prakash | 2e1264d | 2022-05-20 12:27:40 -0500 | [diff] [blame] | 594 | ifneq ($(wildcard ${EL3_PAYLOAD_PLAT_MAKEFILE_FULL}),) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 595 | el3_payload: $(BUILD_DIR) |
| 596 | ${Q}${MAKE} -C el3_payload PLAT=${PLAT} |
| 597 | ${Q}find "el3_payload/build/${PLAT}" -name '*.bin' -exec cp {} "${BUILD_PLAT}" \; |
| 598 | |
| 599 | all: el3_payload |
| 600 | endif |
Arvind Ram Prakash | 2e1264d | 2022-05-20 12:27:40 -0500 | [diff] [blame] | 601 | endif |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 602 | |
Sandrine Bailleux | f8228af | 2020-04-21 14:45:00 +0200 | [diff] [blame] | 603 | doc: |
| 604 | @echo " BUILD DOCUMENTATION" |
| 605 | ${Q}${MAKE} --no-print-directory -C ${DOCS_PATH} html |
| 606 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 607 | .PHONY: cscope |
| 608 | cscope: |
| 609 | @echo " CSCOPE" |
| 610 | ${Q}find ${CURDIR} -name "*.[chsS]" > cscope.files |
| 611 | ${Q}cscope -b -q -k |
| 612 | |
| 613 | .PHONY: help |
Leonardo Sandoval | 770b431 | 2020-09-11 14:44:40 -0500 | [diff] [blame] | 614 | .SILENT: help |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 615 | help: |
Leonardo Sandoval | 770b431 | 2020-09-11 14:44:40 -0500 | [diff] [blame] | 616 | echo "usage: ${MAKE} PLAT=<${PLATFORMS}> \ |
Shruti Gupta | c973b2a | 2023-07-12 12:10:54 +0100 | [diff] [blame] | 617 | <all|tftf|ns_bl1u|ns_bl2u|cactus|ivy|el3_payload|distclean|clean|checkcodebase|checkpatch|help_tests>" |
Leonardo Sandoval | 770b431 | 2020-09-11 14:44:40 -0500 | [diff] [blame] | 618 | echo "" |
| 619 | echo "PLAT is used to specify which platform you wish to build." |
| 620 | echo "If no platform is specified, PLAT defaults to: ${DEFAULT_PLAT}" |
| 621 | echo "" |
| 622 | echo "Supported Targets:" |
| 623 | echo " all Build all supported binaries for this platform" |
| 624 | echo " (i.e. TFTF and FWU images)" |
| 625 | echo " tftf Build the TFTF image" |
| 626 | echo " ns_bl1u Build the NS_BL1U image" |
| 627 | echo " ns_bl2u Build the NS_BL2U image" |
Olivier Deprez | 40777f8 | 2022-11-09 10:15:28 +0100 | [diff] [blame] | 628 | echo " cactus Build the Cactus image (FF-A S-EL1 test payload)." |
| 629 | echo " cactus_mm Build the Cactus-MM image (SPM-MM S-EL0 test payload)." |
| 630 | echo " ivy Build the Ivy image (FF-A S-EL0 test payload)." |
Leonardo Sandoval | 770b431 | 2020-09-11 14:44:40 -0500 | [diff] [blame] | 631 | echo " el3_payload Build the EL3 test payload" |
| 632 | echo " checkcodebase Check the coding style of the entire source tree" |
| 633 | echo " checkpatch Check the coding style on changes in the current" |
| 634 | echo " branch against BASE_COMMIT (default origin/master)" |
| 635 | echo " doc Build html based documentation using Sphinx tool" |
| 636 | echo " clean Clean the build for the selected platform" |
| 637 | echo " cscope Generate cscope index" |
| 638 | echo " distclean Remove all build artifacts for all platforms" |
| 639 | echo " help_tests List all possible sets of tests" |
| 640 | echo "" |
| 641 | echo "note: most build targets require PLAT to be set to a specific platform." |
| 642 | echo "" |
| 643 | echo "example: build all targets for the FVP platform:" |
| 644 | echo " CROSS_COMPILE=aarch64-none-elf- make PLAT=fvp all" |