blob: 7faddc2c049bfc50916bd67d1f5ff937b1e40b3e [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
2# Copyright (C) 2012 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9include $(INCLUDE_DIR)/kernel.mk
10
11PKG_NAME:=optee_app
12PKG_VERSION:=1
13PKG_RELEASE:=1
14
15PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
16PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17SVC_SOURCE_DIR:=$(MRVLDIR)/services/optee_app
18PKG_SOURCE_DIR:=$(SVC_SOURCE_DIR) $(STAGING_DIR)/usr/include $(STAGING_DIR)/usr/lib
19PKG_BUILD_PARALLEL:=0
20
b.liub17525e2025-05-14 17:22:29 +080021APP_LIST:= libsecure_storage
b.liue9582032025-04-17 19:18:16 +080022
23include $(INCLUDE_DIR)/package.mk
24
25define Package/optee_app
26 CATEGORY:=service
27 TITLE:=optee application
28 DEPENDS:=+libpthread +optee_client
29 DEFAULT:=n
30endef
31
b.liub17525e2025-05-14 17:22:29 +080032define Package/optee_app/extra_provides
33 echo "libmbtk_lib.so"
34endef
35
b.liue9582032025-04-17 19:18:16 +080036define Package/optee_app/config
37menu "OPTEE application Configuration"
38config HWRANDOM
39 bool "Enable hardware random TA/CA"
40 default n
41config CIPHER_TEST
42 bool "Enable Cipher test TA/CA"
43 default n
44config SECURE_STORAGE
45 bool "Enable secure storage test TA/CA"
46 default n
47config ACIPHER_TEST
48 bool "Enable ACipher test TA/CA"
49config KEY_TEST
50 bool "Enable key test TA/CA"
51endmenu
52endef
53
54ifeq ($(CONFIG_HWRANDOM),y)
55 APP_LIST := $(APP_LIST)" random"
56endif
57
58ifeq ($(CONFIG_CIPHER_TEST),y)
59 APP_LIST := $(APP_LIST)" cipher"
60endif
61
62ifeq ($(CONFIG_SECURE_STORAGE),y)
63 APP_LIST := $(APP_LIST)" secure_storage"
64endif
65
66ifeq ($(CONFIG_ACIPHER_TEST),y)
67 APP_LIST := $(APP_LIST)" acipher"
68endif
69
70ifeq ($(CONFIG_KEY_TEST),y)
71 APP_LIST := $(APP_LIST)" keytest"
72endif
73
74define Package/optee_app/description
75 optee applications
76endef
77
78define Build/Compile
79 $(MAKE) $(PKG_JOBS) -C $(SVC_SOURCE_DIR) HOST_CROSS_COMPILE="$(TARGET_CROSS)" \
80 TA_DEV_KIT_DIR=$(TOPDIR)/package/services/optee_os/export/asr18xx/export-ta_arm32\
81 TEEC_EXPORT=$(MRVLDIR)/services/optee_client/out/export/usr PLATFORM=$(ARCH_PROFILE)\
b.liub17525e2025-05-14 17:22:29 +080082 LOG_EXPORT=$(TOPDIR)/mbtk/rootfs \
b.liue9582032025-04-17 19:18:16 +080083 TA_CROSS_COMPILE="$(TARGET_CROSS)" APP_LIST=$(APP_LIST)
84endef
85
86define Build/Clean
87 $(MAKE) $(PKG_JOBS) -C $(SVC_SOURCE_DIR) \
88 CROSS_COMPILE="$(TARGET_CROSS)" \
89 TA_DEV_KIT_DIR=$(TOPDIR)/package/services/optee_os/export/asr18xx/export-ta_arm32\
90 TEEC_EXPORT=$(MRVLDIR)/services/optee_client/out/export/usr PLATFORM=$(ARCH_PROFILE)\
91 APP_LIST=$(APP_LIST) clean
92 rm -rf $(SVC_SOURCE_DIR)/out
93endef
94
95define Build/InstallDev
96endef
97
98define Package/$(PKG_NAME)/install
99 $(INSTALL_DIR) $(1)/usr/sbin
100 $(INSTALL_DIR) $(1)/usr/lib/optee_armtz
b.liub17525e2025-05-14 17:22:29 +0800101 $(INSTALL_DIR) $(1)/lib
b.liue9582032025-04-17 19:18:16 +0800102 $(CP) -rf $(SVC_SOURCE_DIR)/out/ca/* $(1)/usr/sbin
b.liub17525e2025-05-14 17:22:29 +0800103 $(CP) -rf $(SVC_SOURCE_DIR)/out/lib/* $(1)/lib
b.liue9582032025-04-17 19:18:16 +0800104 find $(SVC_SOURCE_DIR)/out/ta -name "*.ta" | xargs -i $(CP) {} $(1)/usr/lib/optee_armtz
105 find $(SVC_SOURCE_DIR)/out/ta -name "*.elf" | xargs -i $(CP) {} $(1)/usr/lib/optee_armtz
106endef
107
108$(eval $(call BuildPackage,optee_app))