blob: e10aa770a1a80453bee657f20fa671c879c842d6 [file] [log] [blame]
Balint Dobszay1bf41f52022-05-30 12:56:38 +02001################################################################################
2# Paths to Trusted Services source and output
3################################################################################
4TS_PATH ?= $(ROOT)/trusted-services
5TS_BUILD_PATH ?= $(OUT_PATH)/ts-build
6TS_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
13optee-os-common: ffa-sp-all
14optee-os-clean: ffa-sp-all-clean
15
16ffa-sp-all-realclean:
17 rm -rf $(TS_INSTALL_PREFIX)/opteesp
18
19ifneq ($(COMPILE_S_USER),64)
20$(error Trusted Services SPs only support AArch64)
21endif
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=<...>)
36define build-sp
37.PHONY: ffa-$1-sp
38ffa-$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
48ffa-$1-sp-clean:
49 $$(MAKE) -C $(TS_BUILD_PATH)/$1 clean
50
51.PHONY: ffa-$1-sp-realclean
52ffa-$1-sp-realclean:
53 rm -rf $(TS_BUILD_PATH)/$1
54
55ffa-sp-all: ffa-$1-sp
56ffa-sp-all-clean: ffa-$1-sp-clean
57ffa-sp-all-realclean: ffa-$1-sp-realclean
58
59optee_os_sp_paths += $(TS_INSTALL_PREFIX)/opteesp/bin/$2.stripped.elf
60endef
61
Balint Dobszaydb9b8f02022-09-01 11:20:23 +020062ifeq ($(SP_PACKAGING_METHOD),embedded)
Balint Dobszay1bf41f52022-05-30 12:56:38 +020063# Add the list of SP paths to the optee_os config
64OPTEE_OS_COMMON_EXTRA_FLAGS += SP_PATHS="$(optee_os_sp_paths)"
Balint Dobszaydb9b8f02022-09-01 11:20:23 +020065else ifeq ($(SP_PACKAGING_METHOD),fip)
66# Configure TF-A to load the SPs from FIP by BL2
67TF_A_FIP_SP_FLAGS += ARM_BL2_SP_LIST_DTS=$(ROOT)/build/fvp/bl2_sp_list.dtsi \
68 SP_LAYOUT_FILE=$(TS_INSTALL_PREFIX)/opteesp/json/sp_layout.json
69
70# This should be removed when TF-A is updated to v2.7 or later
71$(call force,MEASURED_BOOT,n,Need TF-A v2.7 for FIP SPs with Measured Boot)
72endif
Balint Dobszayc3d34122022-05-30 13:28:06 +020073
74################################################################################
75# Linux FF-A user space drivers
76################################################################################
77.PHONY: linux-arm-ffa-tee linux-arm-ffa-tee-clean
78all: linux-arm-ffa-tee
79
80linux-arm-ffa-tee: linux
81 mkdir -p $(OUT_PATH)/linux-arm-ffa-tee
82 $(MAKE) -C $(ROOT)/linux-arm-ffa-tee $(LINUX_COMMON_FLAGS) install \
83 TARGET_DIR=$(OUT_PATH)/linux-arm-ffa-tee
84
85linux-arm-ffa-tee-clean:
86 $(MAKE) -C $(ROOT)/linux-arm-ffa-tee clean
87
88# This driver is only used by the uefi-test app
89ifeq ($(TS_UEFI_TESTS),y)
90.PHONY: linux-arm-ffa-user linux-arm-ffa-user-clean
91all: linux-arm-ffa-user
92
93linux-arm-ffa-user: linux
94 mkdir -p $(OUT_PATH)/linux-arm-ffa-user
95 $(MAKE) -C $(ROOT)/linux-arm-ffa-user $(LINUX_COMMON_FLAGS) install \
96 TARGET_DIR=$(OUT_PATH)/linux-arm-ffa-user
Jelle Selsbb5a5362022-07-18 17:07:05 +020097 echo "ed32d533-99e6-4209-9cc0-2d72cdd998a7,\
98 5c9edbc3-7b3a-4367-9f83-7c191ae86a37,\
99 7817164c-c40c-4d1a-867a-9bb2278cf41a,\
100 23eb0100-e32a-4497-9052-2f11e584afa6" > \
Balint Dobszayc3d34122022-05-30 13:28:06 +0200101 $(OUT_PATH)/linux-arm-ffa-user/sp_uuid_list.txt
102
103linux-arm-ffa-user-clean:
104 $(MAKE) -C $(ROOT)/linux-arm-ffa-user clean
105
106# Disable CONFIG_STRICT_DEVMEM option in the Linux kernel config. This allows
107# userspace access to the whole NS physical address space through /dev/mem. It's
108# needed by the uefi-test app to communicate with the smm-gateway SP using a
109# static carveout. If changed, run "make linux-defconfig-clean" to take effect.
110LINUX_DEFCONFIG_COMMON_FILES += $(CURDIR)/kconfigs/fvp_trusted-services.conf
111endif
Balint Dobszayc0b8fdf2022-06-02 14:41:54 +0200112
113################################################################################
114# Trusted Services test applications
115################################################################################
116.PHONY: ffa-test-all ffa-test-all-clean ffa-test-all-realclean
117all: ffa-test-all
118
119ffa-test-all-realclean:
120 rm -rf $(TS_INSTALL_PREFIX)/arm-linux
121
122ifneq ($(COMPILE_NS_USER),64)
123$(error Trusted Services test apps only support AArch64)
124endif
125
126# Helper macro to build and install Trusted Services test applications.
127# Invokes CMake to configure, and make to build and install the apps.
128define build-ts-app
129.PHONY: ffa-$1
130ffa-$1:
131 CROSS_COMPILE=$(subst $(CCACHE),,$(CROSS_COMPILE_NS_USER)) cmake -G"Unix Makefiles" \
132 -S $(TS_PATH)/deployments/$1/arm-linux -B $(TS_BUILD_PATH)/$1 \
133 -DCMAKE_INSTALL_PREFIX=$(TS_INSTALL_PREFIX) \
134 -DCMAKE_C_COMPILER_LAUNCHER=$(CCACHE)
135 $$(MAKE) -C $(TS_BUILD_PATH)/$1 install
136
137.PHONY: ffa-$1-clean
138ffa-$1-clean:
139 $$(MAKE) -C $(TS_BUILD_PATH)/$1 clean
140
141.PHONY: ffa-$1-realclean
142ffa-$1-realclean:
143 rm -rf $(TS_BUILD_PATH)/$1
144
145ffa-test-all: ffa-$1
146ffa-test-all-clean: ffa-$1-clean
147ffa-test-all-realclean: ffa-$1-realclean
148endef