blob: d60859897264c61bbc85b39d3867f7e8fb86b42c [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
19
Victor Chong8c53f692021-05-04 17:41:53 +010020################################################################################
21# Build xtest #
22################################################################################
Jerome Forissierf02a2212015-10-29 14:33:35 +010023include $(CLEAR_VARS)
24LOCAL_MODULE := xtest
Yongqin Liu286f1fc2018-06-21 22:09:15 +080025LOCAL_VENDOR_MODULE := true
Zoltan Kuscsikd3c5c2c2016-04-08 11:33:39 +020026LOCAL_SHARED_LIBRARIES := libteec
Jerome Forissierf02a2212015-10-29 14:33:35 +010027
Yongqin Liu286f1fc2018-06-21 22:09:15 +080028TA_DIR ?= /vendor/lib/optee_armtz
29
Victor Chong170a1ee2017-04-13 02:13:50 +010030srcs := regression_1000.c
Jens Wiklander02389a92016-12-16 11:13:38 +010031
32ifeq ($(CFG_GP_SOCKETS),y)
Victor Chong170a1ee2017-04-13 02:13:50 +010033srcs += regression_2000.c \
Jens Wiklander02389a92016-12-16 11:13:38 +010034 sock_server.c \
35 rand_stream.c
36endif
37
Victor Chong170a1ee2017-04-13 02:13:50 +010038srcs += adbg/src/adbg_case.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010039 adbg/src/adbg_enum.c \
40 adbg/src/adbg_expect.c \
41 adbg/src/adbg_log.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010042 adbg/src/adbg_run.c \
Jerome Forissierf02a2212015-10-29 14:33:35 +010043 adbg/src/security_utils_hex.c \
Igor Opaniuka00eeb12016-09-28 15:57:58 -070044 aes_perf.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010045 benchmark_1000.c \
46 benchmark_2000.c \
47 regression_4000.c \
Jens Wiklanderb4c75aa2018-11-15 10:43:29 +010048 regression_4100.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010049 regression_5000.c \
50 regression_6000.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010051 regression_8000.c \
Jens Wiklander29326472018-04-20 11:22:15 +020052 regression_8100.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010053 sha_perf.c \
Jens Wiklander254a3e32019-01-31 12:25:08 +010054 stats.c \
Victor Chong170a1ee2017-04-13 02:13:50 +010055 xtest_helpers.c \
56 xtest_main.c \
Victor Chong7be42392021-01-20 06:02:16 +000057 xtest_test.c \
58 xtest_uuid_helpers.c
Jerome Forissierf02a2212015-10-29 14:33:35 +010059
Jens Wiklanderf261a6d2017-11-09 16:45:51 +010060ifeq ($(CFG_SECSTOR_TA_MGMT_PTA),y)
61srcs += install_ta.c
62endif
63
Etienne Carriere41343db2017-03-17 15:38:52 +010064ifeq ($(CFG_SECURE_DATA_PATH),y)
65srcs += sdp_basic.c
66endif
67
Etienne Carriere109c1d72019-01-09 11:02:02 +010068ifeq ($(CFG_PKCS11_TA),y)
69srcs += pkcs11_1000.c
Victor Chongbe1a0422021-01-12 16:49:42 +000070LOCAL_CFLAGS += -DCFG_PKCS11_TA
71LOCAL_SHARED_LIBRARIES += libckteec
Etienne Carriere109c1d72019-01-09 11:02:02 +010072endif
73
Jens Wiklander97d6e292018-04-23 13:00:31 +020074define my-embed-file
75$(TARGET_OUT_HEADERS)/$(1).h: $(LOCAL_PATH)/$(2)
76 @echo ' GEN $$@'
Jens Wiklander950ea1c2018-04-30 15:39:22 +020077 @$(LOCAL_PATH)/scripts/file_to_c.py --inf $$< --out $$@ --name $(1)
Jens Wiklander97d6e292018-04-23 13:00:31 +020078
Yongqin Liu0142c7d2018-10-16 16:22:07 +080079LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_HEADERS)/$(1).h
80
Jens Wiklander97d6e292018-04-23 13:00:31 +020081endef
82
83$(eval $(call my-embed-file,regression_8100_ca_crt,cert/ca.crt))
84$(eval $(call my-embed-file,regression_8100_mid_crt,cert/mid.crt))
85$(eval $(call my-embed-file,regression_8100_my_crt,cert/my.crt))
Jens Wiklander950ea1c2018-04-30 15:39:22 +020086$(eval $(call my-embed-file,regression_8100_my_csr,cert/my.csr))
Jens Wiklander97d6e292018-04-23 13:00:31 +020087
Jerome Forissierf02a2212015-10-29 14:33:35 +010088LOCAL_SRC_FILES := $(patsubst %,host/xtest/%,$(srcs))
89
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +020090LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \
Victor Chong8c53f692021-05-04 17:41:53 +010091 $(LOCAL_PATH)/host/xtest/adbg/include \
Victor Chongbe1a0422021-01-12 16:49:42 +000092 $(LOCAL_PATH)/ta/include \
Victor Chong8c53f692021-05-04 17:41:53 +010093 $(LOCAL_PATH)/ta/supp_plugin/include \
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +020094 $(LOCAL_PATH)/ta/create_fail_test/include \
95 $(LOCAL_PATH)/ta/crypt/include \
96 $(LOCAL_PATH)/ta/enc_fs/include \
97 $(LOCAL_PATH)/ta/os_test/include \
98 $(LOCAL_PATH)/ta/rpc_test/include \
99 $(LOCAL_PATH)/ta/sims/include \
Ovidiu Mihalachi15cecff2019-04-02 16:36:31 +0300100 $(LOCAL_PATH)/ta/miss/include \
101 $(LOCAL_PATH)/ta/sims_keepalive/include \
Zoltan Kuscsikc8186b32016-04-08 11:35:17 +0200102 $(LOCAL_PATH)/ta/storage_benchmark/include \
Victor Chongbe1a0422021-01-12 16:49:42 +0000103 $(LOCAL_PATH)/ta/concurrent/include \
104 $(LOCAL_PATH)/ta/concurrent_large/include \
Igor Opaniuka00eeb12016-09-28 15:57:58 -0700105 $(LOCAL_PATH)/ta/sha_perf/include \
Victor Chong23139a32017-03-01 05:00:54 +0000106 $(LOCAL_PATH)/ta/aes_perf/include \
Etienne Carriere41343db2017-03-17 15:38:52 +0100107 $(LOCAL_PATH)/ta/socket/include \
Javier Almansa Sobrinocddc0002020-02-10 13:35:37 +0000108 $(LOCAL_PATH)/ta/sdp_basic/include \
Victor Chong4748c572021-07-14 11:00:27 +0100109 $(LOCAL_PATH)/ta/tpm_log_test/include \
Victor Chong9ab02502021-07-14 11:03:01 +0100110 $(LOCAL_PATH)/ta/large/include \
Victor Chong4748c572021-07-14 11:00:27 +0100111 $(LOCAL_PATH)/host/supp_plugin/include
Jerome Forissierf02a2212015-10-29 14:33:35 +0100112
Jerome Forissierf9b89252016-08-23 18:30:43 +0200113# Include configuration file generated by OP-TEE OS (CFG_* macros)
Jassi Brar5659bce2018-07-29 12:36:38 +0530114LOCAL_CFLAGS += -I $(TA_DEV_KIT_DIR)/host_include -include conf.h
Jerome Forissierf02a2212015-10-29 14:33:35 +0100115LOCAL_CFLAGS += -pthread
Jerome Forissiera8b78f12016-08-17 09:40:59 +0200116LOCAL_CFLAGS += -g3
Victor Chongea837822018-02-02 14:55:21 +0000117LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format-zero-length
Jerome Forissierf02a2212015-10-29 14:33:35 +0100118
Yongqin Liu286f1fc2018-06-21 22:09:15 +0800119ifneq ($(TA_DIR),)
120LOCAL_CFLAGS += -DTA_DIR=\"$(TA_DIR)\"
121endif
122
Yongqin Liub31d4a92017-11-08 18:47:16 +0800123## $(OPTEE_BIN) is the path of tee.bin like
124## out/target/product/hikey/optee/arm-plat-hikey/core/tee.bin
125## it will be generated after build the optee_os with target BUILD_OPTEE_OS
126## which is defined in the common ta build mk file included before,
Yongqin Liu0142c7d2018-10-16 16:22:07 +0800127LOCAL_ADDITIONAL_DEPENDENCIES += $(OPTEE_BIN)
Yongqin Liu26b8aa82016-06-02 20:54:19 +0800128
Jerome Forissierf02a2212015-10-29 14:33:35 +0100129include $(BUILD_EXECUTABLE)
Zoltan Kuscsik21758dc2016-04-13 09:41:02 +0200130
Victor Chong8c53f692021-05-04 17:41:53 +0100131################################################################################
132# Build tee-supplicant test plugin #
133################################################################################
134include $(CLEAR_VARS)
135
136PLUGIN_UUID = f07bfc66-958c-4a15-99c0-260e4e7375dd
137
138PLUGIN = $(PLUGIN_UUID).plugin
139PLUGIN_INCLUDES_DIR = $(LOCAL_PATH)/host/supp_plugin/include
140
141LOCAL_MODULE := $(PLUGIN)
142LOCAL_MODULE_RELATIVE_PATH := tee-supplicant/plugins
143LOCAL_VENDOR_MODULE := true
144# below is needed to locate optee_client exported headers
145LOCAL_SHARED_LIBRARIES := libteec
146
147LOCAL_SRC_FILES += host/supp_plugin/test_supp_plugin.c
148LOCAL_C_INCLUDES += $(PLUGIN_INCLUDES_DIR)
149LOCAL_CFLAGS += -Wno-unused-parameter
150
151$(info $$LOCAL_SRC_FILES = ${LOCAL_SRC_FILES})
152
153LOCAL_MODULE_TAGS := optional
154
155# Build the 32-bit and 64-bit versions.
156LOCAL_MULTILIB := both
157LOCAL_MODULE_TARGET_ARCH := arm arm64
158
159include $(BUILD_SHARED_LIBRARY)
160
161################################################################################
162# Build TAs #
163################################################################################
Zoltan Kuscsik21758dc2016-04-13 09:41:02 +0200164include $(LOCAL_PATH)/ta/Android.mk