blob: c6ef29f8bc17631780e8b210ed239d2505317161 [file] [log] [blame]
Jerome Forissierf02a2212015-10-29 14:33:35 +01001LOCAL_PATH := $(call my-dir)
2
Yongqin Liu26b8aa82016-06-02 20:54:19 +08003## include variants like TA_DEV_KIT_DIR
Yongqin Liub31d4a92017-11-08 18:47:16 +08004## and OPTEE_BIN
Yongqin Liu26b8aa82016-06-02 20:54:19 +08005INCLUDE_FOR_BUILD_TA := false
6include $(BUILD_OPTEE_MK)
7INCLUDE_FOR_BUILD_TA :=
8
Jerome Forissierf02a2212015-10-29 14:33:35 +01009VERSION = $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
Jerome Forissierf02a2212015-10-29 14:33:35 +010010
Zoltan Kuscsik88b88c52016-10-20 09:15:56 +020011# TA_DEV_KIT_DIR must be set to non-empty value to
12# avoid the Android build scripts complaining about
13# includes pointing outside the Android source tree.
14# This var is expected to be set when OPTEE OS built.
15# We set the default value to an invalid path.
16TA_DEV_KIT_DIR ?= ../invalid_include_path
17
Jerome Forissierf02a2212015-10-29 14:33:35 +010018-include $(TA_DEV_KIT_DIR)/host_include/conf.mk
Yongqin Liud6b7e412021-11-01 15:46:55 +080019include $(LOCAL_PATH)/scripts/common.mk
Jerome Forissierf02a2212015-10-29 14:33:35 +010020
Victor Chong8c53f692021-05-04 17:41:53 +010021################################################################################
22# Build xtest #
23################################################################################
Jerome Forissierf02a2212015-10-29 14:33:35 +010024include $(CLEAR_VARS)
25LOCAL_MODULE := xtest
Yongqin Liu286f1fc2018-06-21 22:09:15 +080026LOCAL_VENDOR_MODULE := true
Zoltan Kuscsikd3c5c2c2016-04-08 11:33:39 +020027LOCAL_SHARED_LIBRARIES := libteec
Jerome Forissierf02a2212015-10-29 14:33:35 +010028
Yongqin Liu286f1fc2018-06-21 22:09:15 +080029TA_DIR ?= /vendor/lib/optee_armtz
30
Victor Chong170a1ee2017-04-13 02:13:50 +010031srcs := regression_1000.c
Jens Wiklander02389a92016-12-16 11:13:38 +010032
33ifeq ($(CFG_GP_SOCKETS),y)
Victor Chong170a1ee2017-04-13 02:13:50 +010034srcs += regression_2000.c \
Jens Wiklander02389a92016-12-16 11:13:38 +010035 sock_server.c \
36 rand_stream.c
37endif
38
Victor Chong170a1ee2017-04-13 02:13:50 +010039srcs += adbg/src/adbg_case.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010040 adbg/src/adbg_enum.c \
41 adbg/src/adbg_expect.c \
42 adbg/src/adbg_log.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010043 adbg/src/adbg_run.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010044 adbg/src/security_utils_hex.c \
Zexi Yubcd55832024-02-04 10:45:28 +080045 asym_perf.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010046 benchmark_1000.c \
47 benchmark_2000.c \
Jerome Forissieraa43c902023-05-29 17:21:00 +020048 clear_storage.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010049 regression_4000.c \
Jens Wiklanderb4c75aa2018-11-15 10:43:29 +010050 regression_4100.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010051 regression_5000.c \
52 regression_6000.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010053 regression_8000.c \
Jens Wiklander29326472018-04-20 11:22:15 +020054 regression_8100.c \
yuzexi4c9b16a2022-11-24 15:42:34 +080055 hash_perf.c \
Etienne Carriere44ec72b2023-03-31 10:13:51 +020056 install_ta.c \
Jens Wiklander254a3e32019-01-31 12:25:08 +010057 stats.c \
Zexi Yudda32122024-02-22 11:23:50 +080058 symm_cipher_perf.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010059 xtest_helpers.c \
60 xtest_main.c \
Victor Chong7be42392021-01-20 06:02:16 +000061 xtest_test.c \
62 xtest_uuid_helpers.c
Jerome Forissierf02a2212015-10-29 14:33:35 +010063
Jelle Sels252faa92020-06-05 14:56:30 +020064ifeq ($(CFG_SECURE_PARTITION)-$(CFG_SPMC_TESTS),y-y)
65srcs += ffa_spmc_1000.c
66endif
67
Etienne Carriere41343db2017-03-17 15:38:52 +010068ifeq ($(CFG_SECURE_DATA_PATH),y)
69srcs += sdp_basic.c
70endif
71
Etienne Carriere109c1d72019-01-09 11:02:02 +010072ifeq ($(CFG_PKCS11_TA),y)
73srcs += pkcs11_1000.c
Victor Chongbe1a0422021-01-12 16:49:42 +000074LOCAL_CFLAGS += -DCFG_PKCS11_TA
75LOCAL_SHARED_LIBRARIES += libckteec
Etienne Carriere109c1d72019-01-09 11:02:02 +010076endif
77
Jens Wiklander97d6e292018-04-23 13:00:31 +020078define my-embed-file
79$(TARGET_OUT_HEADERS)/$(1).h: $(LOCAL_PATH)/$(2)
80 @echo ' GEN $$@'
Sadiq Hussain1f8ef912021-10-02 17:45:30 +053081 @$(PYTHON3) $(LOCAL_PATH)/scripts/file_to_c.py --inf $$< --out $$@ --name $(1)
Jens Wiklander97d6e292018-04-23 13:00:31 +020082
Yongqin Liu0142c7d2018-10-16 16:22:07 +080083LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_HEADERS)/$(1).h
84
Jens Wiklander97d6e292018-04-23 13:00:31 +020085endef
86
87$(eval $(call my-embed-file,regression_8100_ca_crt,cert/ca.crt))
88$(eval $(call my-embed-file,regression_8100_mid_crt,cert/mid.crt))
89$(eval $(call my-embed-file,regression_8100_my_crt,cert/my.crt))
Jens Wiklander950ea1c2018-04-30 15:39:22 +020090$(eval $(call my-embed-file,regression_8100_my_csr,cert/my.csr))
Jens Wiklander97d6e292018-04-23 13:00:31 +020091
Jerome Forissierf02a2212015-10-29 14:33:35 +010092LOCAL_SRC_FILES := $(patsubst %,host/xtest/%,$(srcs))
93
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +020094LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \
Victor Chong8c53f692021-05-04 17:41:53 +010095 $(LOCAL_PATH)/host/xtest/adbg/include \
Jens Wiklanderdd5692a2024-08-26 14:54:54 +020096 $(LOCAL_PATH)/host/xtest/include/uapi \
Victor Chongbe1a0422021-01-12 16:49:42 +000097 $(LOCAL_PATH)/ta/include \
Victor Chong8c53f692021-05-04 17:41:53 +010098 $(LOCAL_PATH)/ta/supp_plugin/include \
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +020099 $(LOCAL_PATH)/ta/create_fail_test/include \
100 $(LOCAL_PATH)/ta/crypt/include \
101 $(LOCAL_PATH)/ta/enc_fs/include \
102 $(LOCAL_PATH)/ta/os_test/include \
103 $(LOCAL_PATH)/ta/rpc_test/include \
104 $(LOCAL_PATH)/ta/sims/include \
Ovidiu Mihalachi15cecff2019-04-02 16:36:31 +0300105 $(LOCAL_PATH)/ta/miss/include \
106 $(LOCAL_PATH)/ta/sims_keepalive/include \
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +0200107 $(LOCAL_PATH)/ta/storage_benchmark/include \
Victor Chongbe1a0422021-01-12 16:49:42 +0000108 $(LOCAL_PATH)/ta/concurrent/include \
109 $(LOCAL_PATH)/ta/concurrent_large/include \
Zexi Yue18381f2023-10-30 11:29:51 +0800110 $(LOCAL_PATH)/ta/crypto_perf/include \
Etienne Carriere41343db2017-03-17 15:38:52 +0100111 $(LOCAL_PATH)/ta/socket/include \
Javier Almansa Sobrinocddc0002020-02-10 13:35:37 +0000112 $(LOCAL_PATH)/ta/sdp_basic/include \
Victor Chong4748c572021-07-14 11:00:27 +0100113 $(LOCAL_PATH)/ta/tpm_log_test/include \
Victor Chong9ab02502021-07-14 11:03:01 +0100114 $(LOCAL_PATH)/ta/large/include \
Ruchika Gupta1cf0e6d2022-01-17 12:37:22 +0530115 $(LOCAL_PATH)/ta/bti_test/include \
Vitor Sato Eschholz36a136d2023-06-06 15:18:47 +0000116 $(LOCAL_PATH)/ta/subkey1/include \
117 $(LOCAL_PATH)/ta/subkey2/include \
Victor Chong4748c572021-07-14 11:00:27 +0100118 $(LOCAL_PATH)/host/supp_plugin/include
Jerome Forissierf02a2212015-10-29 14:33:35 +0100119
Jerome Forissierf9b89252016-08-23 18:30:43 +0200120# Include configuration file generated by OP-TEE OS (CFG_* macros)
Jassi Brar5659bce2018-07-29 12:36:38 +0530121LOCAL_CFLAGS += -I $(TA_DEV_KIT_DIR)/host_include -include conf.h
Jerome Forissierf02a2212015-10-29 14:33:35 +0100122LOCAL_CFLAGS += -pthread
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200123LOCAL_CFLAGS += -g3
Victor Chongea837822018-02-02 14:55:21 +0000124LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format-zero-length
Jerome Forissier66adb452025-04-15 16:35:26 +0200125LOCAL_CFLAGS += -Wno-unused-parameter -Wno-alloc-size
Jerome Forissierf02a2212015-10-29 14:33:35 +0100126
Yongqin Liu286f1fc2018-06-21 22:09:15 +0800127ifneq ($(TA_DIR),)
128LOCAL_CFLAGS += -DTA_DIR=\"$(TA_DIR)\"
129endif
130
Yongqin Liub31d4a92017-11-08 18:47:16 +0800131## $(OPTEE_BIN) is the path of tee.bin like
132## out/target/product/hikey/optee/arm-plat-hikey/core/tee.bin
133## it will be generated after build the optee_os with target BUILD_OPTEE_OS
134## which is defined in the common ta build mk file included before,
Yongqin Liu0142c7d2018-10-16 16:22:07 +0800135LOCAL_ADDITIONAL_DEPENDENCIES += $(OPTEE_BIN)
Yongqin Liu26b8aa82016-06-02 20:54:19 +0800136
Jerome Forissierf02a2212015-10-29 14:33:35 +0100137include $(BUILD_EXECUTABLE)
Zoltan Kuscsik21758dc2016-04-13 09:41:02 +0200138
Victor Chong8c53f692021-05-04 17:41:53 +0100139################################################################################
140# Build tee-supplicant test plugin #
141################################################################################
142include $(CLEAR_VARS)
143
144PLUGIN_UUID = f07bfc66-958c-4a15-99c0-260e4e7375dd
145
146PLUGIN = $(PLUGIN_UUID).plugin
147PLUGIN_INCLUDES_DIR = $(LOCAL_PATH)/host/supp_plugin/include
148
149LOCAL_MODULE := $(PLUGIN)
150LOCAL_MODULE_RELATIVE_PATH := tee-supplicant/plugins
151LOCAL_VENDOR_MODULE := true
152# below is needed to locate optee_client exported headers
153LOCAL_SHARED_LIBRARIES := libteec
154
155LOCAL_SRC_FILES += host/supp_plugin/test_supp_plugin.c
156LOCAL_C_INCLUDES += $(PLUGIN_INCLUDES_DIR)
157LOCAL_CFLAGS += -Wno-unused-parameter
158
159$(info $$LOCAL_SRC_FILES = ${LOCAL_SRC_FILES})
160
161LOCAL_MODULE_TAGS := optional
162
163# Build the 32-bit and 64-bit versions.
164LOCAL_MULTILIB := both
165LOCAL_MODULE_TARGET_ARCH := arm arm64
166
167include $(BUILD_SHARED_LIBRARY)
168
169################################################################################
170# Build TAs #
171################################################################################
Zoltan Kuscsik21758dc2016-04-13 09:41:02 +0200172include $(LOCAL_PATH)/ta/Android.mk