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.) |
| 34 | # 2 - SP canonical UUID (e.g. dc1eef48-b17a-4ccf-ac8b-dfcff7711b14) |
| 35 | # 3 - SP additional build flags (e.g. -DTS_PLATFORM=<...>) |
| 36 | define build-sp |
| 37 | .PHONY: ffa-$1-sp |
| 38 | ffa-$1-sp: |
| 39 | CROSS_COMPILE=$(subst $(CCACHE),,$(CROSS_COMPILE_S_USER)) cmake -G"Unix Makefiles" \ |
| 40 | -S $(TS_PATH)/deployments/$1/opteesp -B $(TS_BUILD_PATH)/$1 \ |
| 41 | -DCMAKE_INSTALL_PREFIX=$(TS_INSTALL_PREFIX) \ |
| 42 | -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE) $(SP_COMMON_FLAGS) $3 |
| 43 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 install |
| 44 | dtc -I dts -O dtb -o $(TS_INSTALL_PREFIX)/opteesp/manifest/$2.dtb \ |
| 45 | $(TS_INSTALL_PREFIX)/opteesp/manifest/$2.dts |
| 46 | |
| 47 | .PHONY: ffa-$1-sp-clean |
| 48 | ffa-$1-sp-clean: |
| 49 | $$(MAKE) -C $(TS_BUILD_PATH)/$1 clean |
| 50 | |
| 51 | .PHONY: ffa-$1-sp-realclean |
| 52 | ffa-$1-sp-realclean: |
| 53 | rm -rf $(TS_BUILD_PATH)/$1 |
| 54 | |
| 55 | ffa-sp-all: ffa-$1-sp |
| 56 | ffa-sp-all-clean: ffa-$1-sp-clean |
| 57 | ffa-sp-all-realclean: ffa-$1-sp-realclean |
| 58 | |
| 59 | optee_os_sp_paths += $(TS_INSTALL_PREFIX)/opteesp/bin/$2.stripped.elf |
| 60 | endef |
| 61 | |
| 62 | # Add the list of SP paths to the optee_os config |
| 63 | OPTEE_OS_COMMON_EXTRA_FLAGS += SP_PATHS="$(optee_os_sp_paths)" |