Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 1 | FVP_VIRTFS_ENABLE ?= y |
| 2 | FVP_VIRTFS_AUTOMOUNT ?= y |
| 3 | MEASURED_BOOT ?= y |
| 4 | MEASURED_BOOT_FTPM ?= n |
| 5 | TS_SMM_GATEWAY ?= y |
Gabor Ambrus | 557af27 | 2023-08-16 12:59:55 +0200 | [diff] [blame] | 6 | TS_LOGGING_SP ?= y |
| 7 | TS_LOGGING_SP_LOG ?= "trusted-services-logs.txt" |
Imre Kis | cef118b | 2023-01-11 18:01:46 +0100 | [diff] [blame] | 8 | TS_UEFI_TESTS ?= n |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 9 | TS_FW_UPDATE ?= n |
Gabor Toth | a95b581 | 2023-11-09 19:10:36 +0100 | [diff] [blame] | 10 | TS_UEFI_AUTH_VAR ?= y |
Gabor Toth | ab31978 | 2023-12-14 08:52:28 +0100 | [diff] [blame] | 11 | TS_UEFI_INTERNAL_CRYPTO ?= n |
Balint Dobszay | a59865b | 2022-09-13 16:47:27 +0200 | [diff] [blame] | 12 | # Supported values: embedded, fip |
| 13 | SP_PACKAGING_METHOD ?= embedded |
Imre Kis | cef118b | 2023-01-11 18:01:46 +0100 | [diff] [blame] | 14 | SPMC_TESTS ?= n |
Sudeep Holla | 68f7beb | 2024-05-23 17:21:55 +0100 | [diff] [blame] | 15 | SPMC_AT_EL ?= 1 |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 16 | |
Gabor Toth | 0c249c7 | 2024-05-10 10:39:48 +0200 | [diff] [blame] | 17 | # Behaves a similar way like BRANCH_PROTECTION in TF-A: |
| 18 | # unset: Default value. mbranch-protection flag is not provided |
| 19 | # 0: Turns off all types of branch protection |
| 20 | # 1: Enables all types of branch protection features |
| 21 | # 2: Return address signing to its standard level |
| 22 | # 3: Extend the signing to include leaf functions |
| 23 | # 4: Turn on branch target identification mechanism |
| 24 | TS_BRANCH_PROTECTION ?= unset |
| 25 | BRANCH_PROTECTION_OPTIONS := unset 0 1 2 3 4 |
| 26 | |
| 27 | ifeq ($(filter $(TS_BRANCH_PROTECTION),$(BRANCH_PROTECTION_OPTIONS)),) |
| 28 | $(error TS_BRANCH_PROTECTION is not set to a valid option) |
| 29 | endif |
| 30 | |
Gabor Toth | a95b581 | 2023-11-09 19:10:36 +0100 | [diff] [blame] | 31 | ifneq ($(TS_UEFI_AUTH_VAR)-$(TS_SMM_GATEWAY),y-y) |
| 32 | SP_SMM_GATEWAY_EXTRA_FLAGS += -DUEFI_AUTH_VAR=OFF |
| 33 | TS_APP_UEFI_TEST_EXTRA_FLAGS += -DUEFI_AUTH_VAR=OFF |
| 34 | endif |
| 35 | |
Gabor Toth | ab31978 | 2023-12-14 08:52:28 +0100 | [diff] [blame] | 36 | ifeq ($(TS_UEFI_INTERNAL_CRYPTO),y) |
| 37 | SP_SMM_GATEWAY_EXTRA_FLAGS += -DUEFI_INTERNAL_CRYPTO=ON |
| 38 | endif |
| 39 | |
Balint Dobszay | 6c7dfb2 | 2023-03-16 14:48:33 +0100 | [diff] [blame] | 40 | # Enable the "HArdware Volatile Entropy Gathering and Expansion" daemon to |
| 41 | # overcome low-entropy conditions in the FVP |
| 42 | BR2_PACKAGE_HAVEGED ?= y |
Balint Dobszay | 2e792b3 | 2023-06-05 18:07:32 +0200 | [diff] [blame] | 43 | |
| 44 | # Disable packages not used by this configuration |
| 45 | BR2_PACKAGE_HOST_E2FSPROGS ?= n |
| 46 | BR2_PACKAGE_KEYUTILS ?= n |
| 47 | BR2_PACKAGE_MMC_UTILS ?= n |
| 48 | BR2_PACKAGE_OPENSC ?= n |
| 49 | BR2_PACKAGE_OPTEE_EXAMPLES_EXT ?= n |
| 50 | BR2_PACKAGE_STRACE ?= n |
| 51 | |
| 52 | # Building xtest is not necessary if we don't want to run the SPMC tests |
| 53 | ifneq ($(SPMC_TESTS),y) |
| 54 | BR2_PACKAGE_OPTEE_TEST_EXT ?= n |
| 55 | BR2_PACKAGE_LIBOPENSSL ?= n |
| 56 | BR2_PACKAGE_OPENSSL ?= n |
| 57 | endif |
| 58 | |
Imre Kis | 874a2dd | 2023-01-09 17:01:22 +0100 | [diff] [blame] | 59 | # TS SP configurations |
| 60 | DEFAULT_SP_CONFIG ?= default-opteesp |
| 61 | SP_BLOCK_STORAGE_CONFIG ?= $(DEFAULT_SP_CONFIG) |
| 62 | SP_PSA_ITS_CONFIG ?= $(DEFAULT_SP_CONFIG) |
| 63 | SP_PSA_PS_CONFIG ?= $(DEFAULT_SP_CONFIG) |
| 64 | SP_PSA_CRYPTO_CONFIG ?= $(DEFAULT_SP_CONFIG) |
| 65 | SP_PSA_ATTESTATION_CONFIG ?= $(DEFAULT_SP_CONFIG) |
| 66 | SP_SMM_GATEWAY_CONFIG ?= $(DEFAULT_SP_CONFIG) |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 67 | SP_FWU_CONFIG ?= $(DEFAULT_SP_CONFIG) |
Gabor Ambrus | 557af27 | 2023-08-16 12:59:55 +0200 | [diff] [blame] | 68 | SP_LOGGING_CONFIG ?= $(DEFAULT_SP_CONFIG) |
Imre Kis | 874a2dd | 2023-01-09 17:01:22 +0100 | [diff] [blame] | 69 | |
Balint Dobszay | 3730e01 | 2023-06-02 11:40:41 +0200 | [diff] [blame] | 70 | LINUX_DEFCONFIG_COMMON_FILES ?= $(CURDIR)/kconfigs/fvp_trusted-services.conf |
| 71 | |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 72 | include fvp.mk |
| 73 | include trusted-services.mk |
| 74 | |
Imre Kis | efd2ece | 2023-04-05 13:35:28 +0200 | [diff] [blame] | 75 | # The macros used in bl2_sp_list.dts and spmc_manifest.dts has to be passed to |
| 76 | # TF-A because it handles the preprocessing of these files. |
| 77 | define add-dtc-define |
| 78 | DTC_CPPFLAGS+=-D$1=$(subst y,1,$(subst n,0,$($1))) |
| 79 | endef |
| 80 | |
| 81 | ifeq ($(SP_PACKAGING_METHOD),fip) |
| 82 | $(eval $(call add-dtc-define,SPMC_TESTS)) |
| 83 | $(eval $(call add-dtc-define,TS_SMM_GATEWAY)) |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 84 | $(eval $(call add-dtc-define,TS_FW_UPDATE)) |
Gabor Ambrus | 557af27 | 2023-08-16 12:59:55 +0200 | [diff] [blame] | 85 | $(eval $(call add-dtc-define,TS_LOGGING_SP)) |
Imre Kis | efd2ece | 2023-04-05 13:35:28 +0200 | [diff] [blame] | 86 | |
| 87 | TF_A_EXPORTS += DTC_CPPFLAGS="$(DTC_CPPFLAGS)" |
| 88 | endif |
| 89 | |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 90 | OPTEE_OS_COMMON_EXTRA_FLAGS += \ |
| 91 | CFG_SECURE_PARTITION=y \ |
| 92 | CFG_CORE_SEL1_SPMC=y \ |
| 93 | CFG_CORE_HEAP_SIZE=131072 \ |
| 94 | CFG_DT=y \ |
| 95 | CFG_MAP_EXT_DT_SECURE=y |
| 96 | |
Gabor Toth | 0c249c7 | 2024-05-10 10:39:48 +0200 | [diff] [blame] | 97 | # If branch protection is unset, do not pass it |
| 98 | ifeq ($(filter $(TS_BRANCH_PROTECTION),unset),) |
| 99 | TF_A_FLAGS += BRANCH_PROTECTION=$(TS_BRANCH_PROTECTION) |
| 100 | TS_APP_COMMON_FLAGS += -DBRANCH_PROTECTION=$(TS_BRANCH_PROTECTION) |
| 101 | SP_COMMON_FLAGS += -DBRANCH_PROTECTION=$(TS_BRANCH_PROTECTION) |
| 102 | endif |
| 103 | |
| 104 | # Branch Target Identification enablement |
| 105 | ifneq ($(filter $(TS_BRANCH_PROTECTION),1 4),) |
| 106 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_CORE_BTI=y |
| 107 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_TA_BTI=y |
| 108 | |
| 109 | FVP_EXTRA_ARGS += -C cluster0.has_branch_target_exception=2 |
| 110 | FVP_EXTRA_ARGS += -C cluster1.has_branch_target_exception=2 |
| 111 | FVP_EXTRA_ARGS += -C cluster0.has_arm_v8-5=1 |
| 112 | FVP_EXTRA_ARGS += -C cluster1.has_arm_v8-5=1 |
| 113 | endif |
| 114 | |
| 115 | # Pointer Authentication enablement |
| 116 | ifneq ($(filter $(TS_BRANCH_PROTECTION),1 2 3),) |
| 117 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_CORE_PAUTH=y |
| 118 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_TA_PAUTH=y |
| 119 | |
| 120 | FVP_EXTRA_ARGS += -C cluster0.has_pointer_authentication=2 |
| 121 | FVP_EXTRA_ARGS += -C cluster1.has_pointer_authentication=2 |
| 122 | endif |
Jelle Sels | 3a937c5 | 2023-02-01 09:25:52 +0100 | [diff] [blame] | 123 | |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 124 | # The boot order of the SPs is determined by the order of calls here. This is |
| 125 | # due to the SPMC not (yet) supporting the boot order field of the SP manifest. |
Imre Kis | 0dbd3df | 2023-04-05 13:31:22 +0200 | [diff] [blame] | 126 | ifeq ($(SPMC_TESTS),n) |
Gabor Ambrus | 557af27 | 2023-08-16 12:59:55 +0200 | [diff] [blame] | 127 | # LOGGING SP |
| 128 | ifeq ($(TS_LOGGING_SP),y) |
| 129 | $(eval $(call build-sp,logging,config/$(SP_LOGGING_CONFIG),da9dffbd-d590-40ed-975f-19c65a3d52d3,$(SP_LOGGING_EXTRA_FLAGS))) |
| 130 | endif |
Imre Kis | 0dbd3df | 2023-04-05 13:31:22 +0200 | [diff] [blame] | 131 | # PSA SPs |
Imre Kis | 874a2dd | 2023-01-09 17:01:22 +0100 | [diff] [blame] | 132 | $(eval $(call build-sp,block-storage,config/$(SP_BLOCK_STORAGE_CONFIG),63646e80-eb52-462f-ac4f-8cdf3987519c,$(SP_BLOCK_STORAGE_EXTRA_FLAGS))) |
| 133 | $(eval $(call build-sp,internal-trusted-storage,config/$(SP_PSA_ITS_CONFIG),dc1eef48-b17a-4ccf-ac8b-dfcff7711b14,$(SP_PSA_ITS_EXTRA_FLAGS))) |
| 134 | $(eval $(call build-sp,protected-storage,config/$(SP_PSA_PS_CONFIG),751bf801-3dde-4768-a514-0f10aeed1790,$(SP_PSA_PS_EXTRA_FLAGS))) |
| 135 | $(eval $(call build-sp,crypto,config/$(SP_PSA_CRYPTO_CONFIG),d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0,$(SP_PSA_CRYPTO_EXTRA_FLAGS))) |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 136 | ifeq ($(MEASURED_BOOT),y) |
Imre Kis | 874a2dd | 2023-01-09 17:01:22 +0100 | [diff] [blame] | 137 | $(eval $(call build-sp,attestation,config/$(SP_PSA_ATTESTATION_CONFIG),a1baf155-8876-4695-8f7c-54955e8db974,$(SP_PSA_ATTESTATION_EXTRA_FLAGS))) |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 138 | endif |
| 139 | ifeq ($(TS_SMM_GATEWAY),y) |
Imre Kis | 874a2dd | 2023-01-09 17:01:22 +0100 | [diff] [blame] | 140 | $(eval $(call build-sp,smm-gateway,config/$(SP_SMM_GATEWAY_CONFIG),ed32d533-99e6-4209-9cc0-2d72cdd998a7,$(SP_SMM_GATEWAY_EXTRA_FLAGS))) |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 141 | endif |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 142 | ifeq ($(TS_FW_UPDATE),y) |
| 143 | $(eval $(call build-sp,fwu,config/$(SP_FWU_CONFIG),6823a838-1b06-470e-9774-0cce8bfb53fd,$(SP_FWU_EXTRA_FLAGS))) |
| 144 | endif |
Imre Kis | 0dbd3df | 2023-04-05 13:31:22 +0200 | [diff] [blame] | 145 | else |
| 146 | # SPMC test SPs |
| 147 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_SPMC_TESTS=y |
| 148 | $(eval $(call build-sp,spm-test1,opteesp,5c9edbc3-7b3a-4367-9f83-7c191ae86a37,$(SP_SPMC_TEST_EXTRA_FLAGS))) |
| 149 | $(eval $(call build-sp,spm-test2,opteesp,7817164c-c40c-4d1a-867a-9bb2278cf41a,$(SP_SPMC_TEST_EXTRA_FLAGS))) |
| 150 | $(eval $(call build-sp,spm-test3,opteesp,23eb0100-e32a-4497-9052-2f11e584afa6,$(SP_SPMC_TEST_EXTRA_FLAGS))) |
| 151 | $(eval $(call build-sp,spm-test4,opteesp,423762ed-7772-406f-99d8-0c27da0abbf8,$(SP_SPMC_TEST_EXTRA_FLAGS))) |
| 152 | endif |
Balint Dobszay | c0b8fdf | 2022-06-02 14:41:54 +0200 | [diff] [blame] | 153 | |
Imre Kis | 0dbd3df | 2023-04-05 13:31:22 +0200 | [diff] [blame] | 154 | # Linux user space applications |
| 155 | ifeq ($(SPMC_TESTS),n) |
Gabor Toth | 22d7063 | 2023-11-09 19:05:17 +0100 | [diff] [blame] | 156 | $(eval $(call build-ts-app,libts,$(TS_APP_LIBTS_EXTRA_FLAGS))) |
Gabor Toth | d014819 | 2024-03-05 11:38:58 +0100 | [diff] [blame] | 157 | $(eval $(call build-ts-app,libpsats,$(TS_APP_LIBPSATS_EXTRA_FLAGS))) |
Gabor Toth | 22d7063 | 2023-11-09 19:05:17 +0100 | [diff] [blame] | 158 | $(eval $(call build-ts-app,ts-service-test,$(TS_APP_TS_SERVICE_TEST_EXTRA_FLAGS))) |
| 159 | $(eval $(call build-ts-app,psa-api-test/internal_trusted_storage,$(TS_APP_PSA_ITS_EXTRA_FLAGS))) |
| 160 | $(eval $(call build-ts-app,psa-api-test/protected_storage,$(TS_APP_PSA_PS_EXTRA_FLAGS))) |
| 161 | $(eval $(call build-ts-app,psa-api-test/crypto,$(TS_APP_PSA_CRYPTO_EXTRA_FLAGS))) |
Balint Dobszay | c0b8fdf | 2022-06-02 14:41:54 +0200 | [diff] [blame] | 162 | ifeq ($(MEASURED_BOOT),y) |
Gabor Toth | 22d7063 | 2023-11-09 19:05:17 +0100 | [diff] [blame] | 163 | $(eval $(call build-ts-app,psa-api-test/initial_attestation,$(TS_APP_PSA_IAT_EXTRA_FLAGS))) |
Balint Dobszay | c0b8fdf | 2022-06-02 14:41:54 +0200 | [diff] [blame] | 164 | endif |
| 165 | ifeq ($(TS_UEFI_TESTS),y) |
Gabor Toth | 22d7063 | 2023-11-09 19:05:17 +0100 | [diff] [blame] | 166 | $(eval $(call build-ts-app,uefi-test,$(TS_APP_UEFI_TEST_EXTRA_FLAGS))) |
Imre Kis | cad793f | 2023-09-08 15:53:31 +0200 | [diff] [blame] | 167 | |
| 168 | # uefi-test uses MM Communicate via the arm-ffa-user driver and the message |
| 169 | # payload is forwarded in a carveout memory area. Adding reserved-memory node to |
| 170 | # the device tree to prevent Linux from using the carveout area for other |
| 171 | # purposes. |
| 172 | |
| 173 | ORIGINAL_DTB := $(FVP_LINUX_DTB) |
| 174 | CARVEOUT_ENTRY = $(ROOT)/build/fvp/mm_communicate_carveout.dtsi |
| 175 | FVP_LINUX_DTB = $(ROOT)/out/fvp_with_mm_carveout.dtb |
| 176 | |
| 177 | $(FVP_LINUX_DTB): $(CARVEOUT_ENTRY) | linux |
| 178 | { dtc -Idtb -Odts $(ORIGINAL_DTB); cat $(CARVEOUT_ENTRY); } | dtc -Idts -Odtb -o $(FVP_LINUX_DTB) |
| 179 | |
| 180 | boot-img: $(FVP_LINUX_DTB) |
| 181 | |
| 182 | .PHONY: carveout-dtb-clean |
| 183 | carveout-dtb-clean: |
| 184 | rm -f $(FVP_LINUX_DTB) |
| 185 | |
| 186 | boot-img-clean: carveout-dtb-clean |
Balint Dobszay | c0b8fdf | 2022-06-02 14:41:54 +0200 | [diff] [blame] | 187 | endif |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 188 | |
| 189 | ifeq ($(TS_FW_UPDATE),y) |
| 190 | |
| 191 | # TODO: the fwu-tool is currently not needed. |
Gabor Toth | 22d7063 | 2023-11-09 19:05:17 +0100 | [diff] [blame] | 192 | $(eval $(call build-ts-host-app,fwu-tool,$(TS_HOST_UEFI_TEST_EXTRA_FLAGS))) |
Gyorgy Szing | 08d6974 | 2023-04-05 07:30:08 +0000 | [diff] [blame] | 193 | |
| 194 | ffa-fwu-sp: ts-host-fwu-tool |
| 195 | |
| 196 | # Copy the disk image used by FWU to the build directory to allow the FVP binary to find it. |
| 197 | $(BINARIES_PATH)/secure-flash.img: |
| 198 | mkdir -p $(BINARIES_PATH) |
| 199 | cp $(ROOT)/trusted-services/components/media/disk/disk_images/multi_location_fw.img $(BINARIES_PATH)/secure-flash.img |
| 200 | |
| 201 | # Add a shortcut to help manually doing the copy. |
| 202 | ffa-fwu-fash-img: $(BINARIES_PATH)/secure-flash.img |
| 203 | |
| 204 | ffa-fwu-sp: $(BINARIES_PATH)/secure-flash.img |
| 205 | |
| 206 | endif |
| 207 | |
| 208 | ffa-fwu-fash-img-clean: |
| 209 | rm -f $(BINARIES_PATH)/secure-flash.img |
| 210 | |
| 211 | clean: ffa-fwu-fash-img-clean |
| 212 | |
Balint Dobszay | 58b2bf9 | 2024-07-10 12:51:17 +0200 | [diff] [blame] | 213 | clean: ts-host-all-clean ffa-test-all-clean ffa-sp-all-clean linux-arm-ffa-user-clean |
Gyorgy Szing | 9715e9d | 2023-04-05 11:04:12 +0000 | [diff] [blame] | 214 | |
Jelle Sels | bb5a536 | 2022-07-18 17:07:05 +0200 | [diff] [blame] | 215 | endif |