1ifneq ($(filter rk312% rk322% rk3288 rk3328 rk3368 rk3399 rk3399pro px3 px5, $(TARGET_BOARD_PLATFORM)), ) 2$(info 'building rk_tee_user v1') 3else 4$(info 'building rk_tee_user v2') 5 6LOCAL_PATH := $(call my-dir) 7OPTEE_TEST_PATH := $(shell pwd)/$(LOCAL_PATH) 8 9## include variants like TA_DEV_KIT_DIR 10## and target of BUILD_OPTEE_OS 11INCLUDE_FOR_BUILD_TA := false 12include $(BUILD_OPTEE_MK) 13INCLUDE_FOR_BUILD_TA := 14 15VERSION = $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown) 16 17# TA_DEV_KIT_DIR must be set to non-empty value to 18# avoid the Android build scripts complaining about 19# includes pointing outside the Android source tree. 20# This var is expected to be set when OPTEE OS built. 21# We set the default value to an invalid path. 22TA_DEV_KIT_DIR ?= $(OPTEE_TEST_PATH)/export-ta_arm32 23 24OPTEE_CLIENT_PATH ?= $(LOCAL_PATH)/client_export 25 26include $(TA_DEV_KIT_DIR)/host_include/conf.mk 27 28ifeq (1,$(strip $(shell expr $(PLATFORM_VERSION) \>= 11))) 29ifeq ($(strip $(TARGET_ARCH)), arm64) 30 CLIENT_LIB_PATH ?= $(shell pwd)/hardware/rockchip/optee/v2/arm64 31else 32 CLIENT_LIB_PATH ?= $(shell pwd)/hardware/rockchip/optee/v2/arm 33endif 34else 35ifeq ($(strip $(TARGET_ARCH)), arm64) 36 CLIENT_LIB_PATH ?= $(shell pwd)/vendor/rockchip/common/security/optee/v2/lib/arm64 37else 38 CLIENT_LIB_PATH ?= $(shell pwd)/vendor/rockchip/common/security/optee/v2/lib/arm 39endif 40endif 41 42################################################################################ 43# Build xtest # 44################################################################################ 45include $(CLEAR_VARS) 46LOCAL_MODULE := xtest 47LOCAL_VENDOR_MODULE := true 48LOCAL_SHARED_LIBRARIES := libteec 49 50TA_DIR ?= /vendor/lib/optee_armtz 51 52srcs := regression_1000.c 53 54ifeq ($(CFG_GP_SOCKETS),y) 55srcs += regression_2000.c \ 56 sock_server.c \ 57 rand_stream.c 58endif 59 60srcs += adbg/src/adbg_case.c \ 61 adbg/src/adbg_enum.c \ 62 adbg/src/adbg_expect.c \ 63 adbg/src/adbg_log.c \ 64 adbg/src/adbg_run.c \ 65 adbg/src/security_utils_hex.c \ 66 aes_perf.c \ 67 benchmark_1000.c \ 68 benchmark_2000.c \ 69 regression_4000.c \ 70 regression_4100.c \ 71 regression_5000.c \ 72 regression_6000.c \ 73 regression_8000.c \ 74 regression_8100.c \ 75 sha_perf.c \ 76 stats.c \ 77 xtest_helpers.c \ 78 xtest_main.c \ 79 xtest_test.c \ 80 xtest_uuid_helpers.c 81 82ifeq ($(CFG_SECSTOR_TA_MGMT_PTA),y) 83srcs += install_ta.c 84endif 85 86ifeq ($(CFG_SECURE_DATA_PATH),y) 87srcs += sdp_basic.c 88endif 89 90ifeq ($(CFG_PKCS11_TA),y) 91srcs += pkcs11_1000.c 92LOCAL_CFLAGS += -DCFG_PKCS11_TA 93LOCAL_SHARED_LIBRARIES += libckteec 94endif 95 96define my-embed-file 97$(TARGET_OUT_HEADERS)/$(1).h: $(LOCAL_PATH)/$(2) 98 @echo ' GEN $$@' 99 @$(LOCAL_PATH)/scripts/file_to_c.py --inf $$< --out $$@ --name $(1) 100 101LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_HEADERS)/$(1).h 102 103endef 104 105$(eval $(call my-embed-file,regression_8100_ca_crt,cert/ca.crt)) 106$(eval $(call my-embed-file,regression_8100_mid_crt,cert/mid.crt)) 107$(eval $(call my-embed-file,regression_8100_my_crt,cert/my.crt)) 108$(eval $(call my-embed-file,regression_8100_my_csr,cert/my.csr)) 109 110LOCAL_SRC_FILES := $(patsubst %,host/xtest/%,$(srcs)) 111 112LOCAL_C_INCLUDES += $(LOCAL_PATH)/host/xtest \ 113 $(LOCAL_PATH)/host/xtest/adbg/include\ 114 $(LOCAL_PATH)/host/supp_plugin/include \ 115 $(LOCAL_PATH)/ta/include \ 116 $(LOCAL_PATH)/ta/create_fail_test/include \ 117 $(LOCAL_PATH)/ta/crypt/include \ 118 $(LOCAL_PATH)/ta/enc_fs/include \ 119 $(LOCAL_PATH)/ta/os_test/include \ 120 $(LOCAL_PATH)/ta/rpc_test/include \ 121 $(LOCAL_PATH)/ta/sims/include \ 122 $(LOCAL_PATH)/ta/miss/include \ 123 $(LOCAL_PATH)/ta/sims_keepalive/include \ 124 $(LOCAL_PATH)/ta/storage_benchmark/include \ 125 $(LOCAL_PATH)/ta/concurrent/include \ 126 $(LOCAL_PATH)/ta/concurrent_large/include \ 127 $(LOCAL_PATH)/ta/sha_perf/include \ 128 $(LOCAL_PATH)/ta/aes_perf/include \ 129 $(LOCAL_PATH)/ta/socket/include \ 130 $(LOCAL_PATH)/ta/sdp_basic/include \ 131 $(LOCAL_PATH)/ta/tpm_log_test/include \ 132 $(LOCAL_PATH)/ta/supp_plugin/include \ 133 $(OPTEE_CLIENT_PATH)/public 134 135# Include configuration file generated by OP-TEE OS (CFG_* macros) 136LOCAL_CFLAGS += -I $(TA_DEV_KIT_DIR)/host_include -include conf.h 137LOCAL_CFLAGS += -pthread 138LOCAL_CFLAGS += -g3 139LOCAL_CFLAGS += -Wno-missing-field-initializers -Wno-format-zero-length 140 141ifneq ($(TA_DIR),) 142LOCAL_CFLAGS += -DTA_DIR=\"$(TA_DIR)\" 143endif 144 145## $(OPTEE_BIN) is the path of tee.bin like 146## out/target/product/hikey/optee/arm-plat-hikey/core/tee.bin 147## it will be generated after build the optee_os with target BUILD_OPTEE_OS 148## which is defined in the common ta build mk file included before, 149LOCAL_ADDITIONAL_DEPENDENCIES += $(OPTEE_BIN) 150 151include $(BUILD_EXECUTABLE) 152################################################################################ 153# Build rktest # 154################################################################################ 155include $(CLEAR_VARS) 156LOCAL_CFLAGS += -DANDROID_BUILD -DUSER_SPACE 157LOCAL_CFLAGS += -Wall -Wno-error 158LOCAL_LDFLAGS += $(CLIENT_LIB_PATH)/libteec.so 159LOCAL_LDFLAGS += -llog 160 161SRC_FILES_DIR := $(wildcard $(LOCAL_PATH)/host/rk_test/*.c) 162LOCAL_SRC_FILES += $(SRC_FILES_DIR:$(LOCAL_PATH)/%=%) 163 164LOCAL_C_INCLUDES := $(LOCAL_PATH)/ta/rk_test/include \ 165 $(LOCAL_PATH)/host/rk_test/include \ 166 $(LOCAL_PATH)/export-ta_arm32/host_include \ 167 $(OPTEE_CLIENT_PATH)/public 168 169LOCAL_MODULE := rktest 170LOCAL_MODULE_TAGS := optional 171ifeq (1,$(strip $(shell expr $(PLATFORM_VERSION) \>= 8))) 172 LOCAL_PROPRIETARY_MODULE := true 173endif 174include $(BUILD_EXECUTABLE) 175 176include $(LOCAL_PATH)/ta/Android.mk 177endif