Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # Paths to Trusted Services source and output |
| 3 | ################################################################################ |
| 4 | TS_PATH ?= $(ROOT)/trusted-services |
| 5 | TS_BUILD_PATH ?= $(OUT_PATH)/ts-build |
| 6 | TS_INSTALL_PREFIX ?= $(OUT_PATH)/ts-install |
| 7 | |
| 8 | ################################################################################ |
| 9 | # Secure Partitions |
| 10 | ################################################################################ |
| 11 | .PHONY: ffa-sp-all ffa-sp-all-clean ffa-sp-all-realclean |
| 12 | |
| 13 | optee-os-common: ffa-sp-all |
| 14 | optee-os-clean: ffa-sp-all-clean |
| 15 | |
| 16 | ffa-sp-all-realclean: |
| 17 | rm -rf $(TS_INSTALL_PREFIX)/opteesp |
| 18 | |
| 19 | ifneq ($(COMPILE_S_USER),64) |
| 20 | $(error Trusted Services SPs only support AArch64) |
| 21 | endif |
| 22 | |
| 23 | # Helper macro to build and install Trusted Services Secure Partitions (SPs). |
| 24 | # Invokes CMake to configure, and make to build and install the SP. (CMake's |
| 25 | # Makefile generator backend is used, we can run make in the build directory). |
| 26 | # Adds the SP output image to the optee_os_sp_paths list and complies the SP |
| 27 | # manifest dts to dtb. |
| 28 | # |
| 29 | # For information about the additional dependencies of the project, please see |
| 30 | # https://trusted-services.readthedocs.io/en/latest/developer/software-requirements.html |
| 31 | # |
| 32 | # Parameter list: |
| 33 | # 1 - SP deployment name (e.g. internal-trusted-storage, crypto, etc.) |
Julian Hall | b0c8fc2 | 2022-11-30 12:24:38 +0000 | [diff] [blame^] | 34 | # 2 - Build configuration name (e.g. config/shared-flash) |
| 35 | # 3 - SP canonical UUID (e.g. dc1eef48-b17a-4ccf-ac8b-dfcff7711b14) |
| 36 | # 4 - SP additional build flags (e.g. -DTS_PLATFORM=<...>) |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 37 | define build-sp |
| 38 | .PHONY: ffa-$1-sp |
| 39 | ffa-$1-sp: |
| 40 | CROSS_COMPILE=$(subst $(CCACHE),,$(CROSS_COMPILE_S_USER)) cmake -G"Unix Makefiles" \ |
Julian Hall | b0c8fc2 | 2022-11-30 12:24:38 +0000 | [diff] [blame^] | 41 | -S $(TS_PATH)/deployments/$1/$2 -B $(TS_BUILD_PATH)/$1 \ |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 42 | -DCMAKE_INSTALL_PREFIX=$(TS_INSTALL_PREFIX) \ |
Julian Hall | b0c8fc2 | 2022-11-30 12:24:38 +0000 | [diff] [blame^] | 43 | -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) $(SP_COMMON_FLAGS) $4 |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 44 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 install |
Julian Hall | b0c8fc2 | 2022-11-30 12:24:38 +0000 | [diff] [blame^] | 45 | dtc -I dts -O dtb -o $(TS_INSTALL_PREFIX)/opteesp/manifest/$3.dtb \ |
| 46 | $(TS_INSTALL_PREFIX)/opteesp/manifest/$3.dts |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 47 | |
| 48 | .PHONY: ffa-$1-sp-clean |
| 49 | ffa-$1-sp-clean: |
| 50 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 clean |
| 51 | |
| 52 | .PHONY: ffa-$1-sp-realclean |
| 53 | ffa-$1-sp-realclean: |
| 54 | rm -rf $(TS_BUILD_PATH)/$1 |
| 55 | |
| 56 | ffa-sp-all: ffa-$1-sp |
| 57 | ffa-sp-all-clean: ffa-$1-sp-clean |
| 58 | ffa-sp-all-realclean: ffa-$1-sp-realclean |
| 59 | |
Julian Hall | b0c8fc2 | 2022-11-30 12:24:38 +0000 | [diff] [blame^] | 60 | optee_os_sp_paths += $(TS_INSTALL_PREFIX)/opteesp/bin/$3.stripped.elf |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 61 | endef |
| 62 | |
Balint Dobszay | db9b8f0 | 2022-09-01 11:20:23 +0200 | [diff] [blame] | 63 | ifeq ($(SP_PACKAGING_METHOD),embedded) |
Balint Dobszay | 1bf41f5 | 2022-05-30 12:56:38 +0200 | [diff] [blame] | 64 | # Add the list of SP paths to the optee_os config |
| 65 | OPTEE_OS_COMMON_EXTRA_FLAGS += SP_PATHS="$(optee_os_sp_paths)" |
Balint Dobszay | db9b8f0 | 2022-09-01 11:20:23 +0200 | [diff] [blame] | 66 | else ifeq ($(SP_PACKAGING_METHOD),fip) |
| 67 | # Configure TF-A to load the SPs from FIP by BL2 |
| 68 | TF_A_FIP_SP_FLAGS += ARM_BL2_SP_LIST_DTS=$(ROOT)/build/fvp/bl2_sp_list.dtsi \ |
| 69 | SP_LAYOUT_FILE=$(TS_INSTALL_PREFIX)/opteesp/json/sp_layout.json |
| 70 | |
| 71 | # This should be removed when TF-A is updated to v2.7 or later |
| 72 | $(call force,MEASURED_BOOT,n,Need TF-A v2.7 for FIP SPs with Measured Boot) |
| 73 | endif |
Balint Dobszay | c3d3412 | 2022-05-30 13:28:06 +0200 | [diff] [blame] | 74 | |
| 75 | ################################################################################ |
| 76 | # Linux FF-A user space drivers |
| 77 | ################################################################################ |
| 78 | .PHONY: linux-arm-ffa-tee linux-arm-ffa-tee-clean |
| 79 | all: linux-arm-ffa-tee |
| 80 | |
| 81 | linux-arm-ffa-tee: linux |
| 82 | mkdir -p $(OUT_PATH)/linux-arm-ffa-tee |
| 83 | $(MAKE) -C $(ROOT)/linux-arm-ffa-tee $(LINUX_COMMON_FLAGS) install \ |
| 84 | TARGET_DIR=$(OUT_PATH)/linux-arm-ffa-tee |
| 85 | |
| 86 | linux-arm-ffa-tee-clean: |
| 87 | $(MAKE) -C $(ROOT)/linux-arm-ffa-tee clean |
| 88 | |
| 89 | # This driver is only used by the uefi-test app |
| 90 | ifeq ($(TS_UEFI_TESTS),y) |
| 91 | .PHONY: linux-arm-ffa-user linux-arm-ffa-user-clean |
| 92 | all: linux-arm-ffa-user |
| 93 | |
| 94 | linux-arm-ffa-user: linux |
| 95 | mkdir -p $(OUT_PATH)/linux-arm-ffa-user |
| 96 | $(MAKE) -C $(ROOT)/linux-arm-ffa-user $(LINUX_COMMON_FLAGS) install \ |
| 97 | TARGET_DIR=$(OUT_PATH)/linux-arm-ffa-user |
Jelle Sels | bb5a536 | 2022-07-18 17:07:05 +0200 | [diff] [blame] | 98 | echo "ed32d533-99e6-4209-9cc0-2d72cdd998a7,\ |
| 99 | 5c9edbc3-7b3a-4367-9f83-7c191ae86a37,\ |
| 100 | 7817164c-c40c-4d1a-867a-9bb2278cf41a,\ |
| 101 | 23eb0100-e32a-4497-9052-2f11e584afa6" > \ |
Balint Dobszay | c3d3412 | 2022-05-30 13:28:06 +0200 | [diff] [blame] | 102 | $(OUT_PATH)/linux-arm-ffa-user/sp_uuid_list.txt |
| 103 | |
| 104 | linux-arm-ffa-user-clean: |
| 105 | $(MAKE) -C $(ROOT)/linux-arm-ffa-user clean |
| 106 | |
| 107 | # Disable CONFIG_STRICT_DEVMEM option in the Linux kernel config. This allows |
| 108 | # userspace access to the whole NS physical address space through /dev/mem. It's |
| 109 | # needed by the uefi-test app to communicate with the smm-gateway SP using a |
| 110 | # static carveout. If changed, run "make linux-defconfig-clean" to take effect. |
| 111 | LINUX_DEFCONFIG_COMMON_FILES += $(CURDIR)/kconfigs/fvp_trusted-services.conf |
| 112 | endif |
Balint Dobszay | c0b8fdf | 2022-06-02 14:41:54 +0200 | [diff] [blame] | 113 | |
| 114 | ################################################################################ |
| 115 | # Trusted Services test applications |
| 116 | ################################################################################ |
| 117 | .PHONY: ffa-test-all ffa-test-all-clean ffa-test-all-realclean |
| 118 | all: ffa-test-all |
| 119 | |
| 120 | ffa-test-all-realclean: |
| 121 | rm -rf $(TS_INSTALL_PREFIX)/arm-linux |
| 122 | |
| 123 | ifneq ($(COMPILE_NS_USER),64) |
| 124 | $(error Trusted Services test apps only support AArch64) |
| 125 | endif |
| 126 | |
| 127 | # Helper macro to build and install Trusted Services test applications. |
| 128 | # Invokes CMake to configure, and make to build and install the apps. |
| 129 | define build-ts-app |
| 130 | .PHONY: ffa-$1 |
| 131 | ffa-$1: |
| 132 | CROSS_COMPILE=$(subst $(CCACHE),,$(CROSS_COMPILE_NS_USER)) cmake -G"Unix Makefiles" \ |
| 133 | -S $(TS_PATH)/deployments/$1/arm-linux -B $(TS_BUILD_PATH)/$1 \ |
| 134 | -DCMAKE_INSTALL_PREFIX=$(TS_INSTALL_PREFIX) \ |
| 135 | -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) |
| 136 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 install |
| 137 | |
| 138 | .PHONY: ffa-$1-clean |
| 139 | ffa-$1-clean: |
| 140 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 clean |
| 141 | |
| 142 | .PHONY: ffa-$1-realclean |
| 143 | ffa-$1-realclean: |
| 144 | rm -rf $(TS_BUILD_PATH)/$1 |
| 145 | |
| 146 | ffa-test-all: ffa-$1 |
| 147 | ffa-test-all-clean: ffa-$1-clean |
| 148 | ffa-test-all-realclean: ffa-$1-realclean |
| 149 | endef |