1LOCAL_PATH := $(call my-dir) 2 3## include variants like TA_DEV_KIT_DIR 4## and OPTEE_BIN 5INCLUDE_FOR_BUILD_TA := false 6include $(BUILD_OPTEE_MK) 7INCLUDE_FOR_BUILD_TA := 8 9VERSION = $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown) 10 11# 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 18-include $(TA_DEV_KIT_DIR)/host_include/conf.mk 19include $(LOCAL_PATH)/scripts/common.mk 20 21################################################################################ 22# Build xtest # 23################################################################################ 24include $(CLEAR_VARS) 25LOCAL_MODULE := xtest 26LOCAL_VENDOR_MODULE := true 27LOCAL_SHARED_LIBRARIES := libteec 28 29TA_DIR ?= /vendor/lib/optee_armtz 30 31srcs := regression_1000.c 32 33ifeq ($(CFG_GP_SOCKETS),y) 34srcs += regression_2000.c \ 35 sock_server.c \ 36 rand_stream.c 37endif 38 39srcs += adbg/src/adbg_case.c \ 40 adbg/src/adbg_enum.c \ 41 adbg/src/adbg_expect.c \ 42 adbg/src/adbg_log.c \ 43 adbg/src/adbg_run.c \ 44 adbg/src/security_utils_hex.c \ 45 asym_perf.c \ 46 benchmark_1000.c \ 47 benchmark_2000.c \ 48 clear_storage.c \ 49 regression_4000.c \ 50 regression_4100.c \ 51 regression_5000.c \ 52 regression_6000.c \ 53 regression_8000.c \ 54 regression_8100.c \ 55 hash_perf.c \ 56 install_ta.c \ 57 stats.c \ 58 symm_cipher_perf.c \ 59 xtest_helpers.c \ 60 xtest_main.c \ 61 xtest_test.c \ 62 xtest_uuid_helpers.c 63 64ifeq ($(CFG_SECURE_PARTITION)-$(CFG_SPMC_TESTS),y-y) 65srcs += ffa_spmc_1000.c 66endif 67 68ifeq ($(CFG_SECURE_DATA_PATH),y) 69srcs += sdp_basic.c 70endif 71 72ifeq ($(CFG_PKCS11_TA),y) 73srcs += pkcs11_1000.c 74LOCAL_CFLAGS += -DCFG_PKCS11_TA 75LOCAL_SHARED_LIBRARIES += libckteec 76endif 77 78define my-embed-file 79$(TARGET_OUT_HEADERS)/$(1).h: $(LOCAL_PATH)/$(2) 80 @echo ' GEN $$@' 81 @$(PYTHON3) $(LOCAL_PATH)/scripts/file_to_c.py --inf $$< --out $$@ --name $(1) 82 83LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_HEADERS)/$(1).h 84 85endef 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)) 90$(eval $(call my-embed-file,regression_8100_my_csr,cert/my.csr)) 91 92LOCAL_SRC_FILES := $(patsubst %,host/xtest/%,$(srcs)) 93 94LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \ 95 $(LOCAL_PATH)/host/xtest/adbg/include \ 96 $(LOCAL_PATH)/host/xtest/include/uapi \ 97 $(LOCAL_PATH)/ta/include \ 98 $(LOCAL_PATH)/ta/supp_plugin/include \ 99 $(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 \ 105 $(LOCAL_PATH)/ta/miss/include \ 106 $(LOCAL_PATH)/ta/sims_keepalive/include \ 107 $(LOCAL_PATH)/ta/storage_benchmark/include \ 108 $(LOCAL_PATH)/ta/concurrent/include \ 109 $(LOCAL_PATH)/ta/concurrent_large/include \ 110 $(LOCAL_PATH)/ta/crypto_perf/include \ 111 $(LOCAL_PATH)/ta/socket/include \ 112 $(LOCAL_PATH)/ta/sdp_basic/include \ 113 $(LOCAL_PATH)/ta/tpm_log_test/include \ 114 $(LOCAL_PATH)/ta/large/include \ 115 $(LOCAL_PATH)/ta/bti_test/include \ 116 $(LOCAL_PATH)/ta/subkey1/include \ 117 $(LOCAL_PATH)/ta/subkey2/include \ 118 $(LOCAL_PATH)/host/supp_plugin/include 119 120# Include configuration file generated by OP-TEE OS (CFG_* macros) 121LOCAL_CFLAGS += -I $(TA_DEV_KIT_DIR)/host_include -include conf.h 122LOCAL_CFLAGS += -pthread 123LOCAL_CFLAGS += -g3 124LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format-zero-length 125LOCAL_CFLAGS += -Wno-unused-parameter 126 127ifneq ($(TA_DIR),) 128LOCAL_CFLAGS += -DTA_DIR=\"$(TA_DIR)\" 129endif 130 131## $(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, 135LOCAL_ADDITIONAL_DEPENDENCIES += $(OPTEE_BIN) 136 137include $(BUILD_EXECUTABLE) 138 139################################################################################ 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################################################################################ 172include $(LOCAL_PATH)/ta/Android.mk 173