• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 Huawei Technologies Co., Ltd.
2# Licensed under the Mulan PSL v2.
3# You can use this software according to the terms and conditions of the Mulan PSL v2.
4# You may obtain a copy of Mulan PSL v2 at:
5#     http://license.coscl.org.cn/MulanPSL2
6# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
7# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
8# PURPOSE.
9# See the Mulan PSL v2 for more details.
10
11# TARGET is an app
12
13DRIVER := gtask${TARG}.elf
14
15include $(BUILD_CONFIG)/var.mk
16ifeq ($(CONFIG_DYN_TA_FORMAT),1)
17flags += -DDYN_TA_SUPPORT_V3
18else ifeq ($(CONFIG_DYN_TA_FORMAT),2)
19flags += -DDYN_TA_SUPPORT_V3
20else ifeq ($(CONFIG_DYN_TA_FORMAT),3)
21flags += -DDYN_TA_SUPPORT_V3
22else
23$(error "dynamic TA format not supported, please check CONFIG_DYN_TA_FORMAT")
24endif
25
26PWD := $(shell pwd)
27
28gtask_c_files := $(wildcard src/*.c)
29gtask_c_files   += $(wildcard src/*/*.c)
30gtask_c_files   += $(wildcard src/*/*/*.c)
31
32inc-flags += -I$(PLATFORM_DIR)/$(PLATFORM_NAME)/$(PRODUCT_NAME)/$(CHIP_NAME)/gtask/include
33inc-flags += -I$(TEELIB)/libteeconfig/src/tee_config
34inc-flags += -I$(PLATFORM_DIR)/common/include
35inc-flags += -I$(TEELIB)/libteeagentcommon_client/include
36
37inc-flags += -I$(TEELIB)/libopenssl/openssl/include
38inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto
39inc-flags += -I$(PREBUILD_HEADER)/sys
40inc-flags += -I$(SYSLIB)/libelf_verify/include
41inc-flags += -I$(PWD)/../teesmcmgr/src
42inc-flags += -I$(PWD)/src/init
43inc-flags += -I$(PWD)/src/include
44inc-flags += -I$(PWD)/src/app_load
45inc-flags += -I$(PWD)/src/framework
46inc-flags += -I$(PWD)/src/task_adaptor
47inc-flags += -I$(PWD)/src/manager
48inc-flags += -I$(PWD)/src
49inc-flags += -I$(SYSLIB)/libdynconfmgr/include
50inc-flags += -I$(SYSLIB)/libdynconfbuilder/include
51inc-flags += -I$(PWD)/../drvmgr/src
52inc-flags += -I$(DRIVERS_PATH)/include
53inc-flags += -I$(SYSLIB)/libspawn_common/include/
54inc-flags += -I$(TEELIB)/libagent_base/include/
55inc-flags += -I$(TEELIB)/libdrv/include/
56inc-flags += -I$(TEELIB)/libteeos/include/tee
57inc-flags += -I$(TEELIB)/libteeos/include/legacy
58inc-flags += -I$(TEELIB)/libteeos/include
59inc-flags += -I$(TEELIB)/libpermission_service/include
60inc-flags += -I$(TEELIB)/libcrypto/include
61inc-flags += -I$(TEELIB)/libtimer/include
62inc-flags += -I$(TEELIB)/libteeconfig/include
63inc-flags += -I$(TEELIB)/libteeconfig/include/kernel
64inc-flags += -I$(TEELIB)/libteeconfig/include/TEE_ext
65inc-flags += -I$(TEELIB)/libteemem/include
66inc-flags += -I$(TEELIB)/libssa/src
67inc-flags += -I$(TEELIB)/libssa/include
68inc-flags += -I$(TEELIB)/libhuk/include
69inc-flags += -I$(TEELIB)/libse/include
70inc-flags += -I$(TEELIB)/libse/src/se_service
71inc-flags += -I$(TEELIB)/libipc_hal/include
72
73ifeq ($(product_type), cdc)
74$(info product type is cdc)
75flags += -DCONFIG_TA_SIGN_CDC
76else ifeq ($(product_type), cdc_ace)
77$(info product type is cdc_ace)
78flags += -DCONFIG_TA_SIGN_CDC
79else ifeq ($(product_name), mdc)
80$(info product type is mdc)
81flags += -DCONFIG_TA_SIGN_MDC
82else ifeq ($(product_name), mini)
83$(info product type is mini)
84flags += -DCONFIG_TA_SIGN_MINI
85else ifeq ($(CONFIG_TA_SIGN_KEY_CBG),true)
86flags += -DCONFIG_TA_SIGN_CBG
87else ifeq ($(CONFIG_HUANGLONG_LOAD_KEY_3072),y)
88flags += -DCONFIG_TA_SIGN_HUANGLONG
89endif
90
91gtask_c_files := $(filter-out $(FILTEROUT_CFILES), $(gtask_c_files))
92
93LIBS := c_shared${TARG}        \
94    tee_shared${TARG}      \
95    permission_service${TARG} \
96    teemem${TARG}          \
97    drv${TARG}           \
98    teeconfig${TARG}       \
99    dynconfmgr${TARG}      \
100    dynconfbuilder${TARG}  \
101    spawn_common${TARG}
102
103ifeq ($(findstring y, $(CONFIG_APP_TEE_PERM) $(CONFIG_APP_TEE_PERM_A32)),)
104LIBS += elf_verify${TARG} \
105    elf_verify_key${TARG}
106endif
107
108ifeq ($(CONFIG_TERMINAL_DRV_SUPPORT),y)
109LIBS += devchip_api${TARG}
110endif
111
112LDFLAGS += -z text -z noexecstack --dynamic-linker=libc_shared${TARG}.so
113
114ENTRY_POINT := main
115
116# drv makefile will fully link a binary.
117include $(BUILD_SERVICE)/svc-common.mk
118include $(BUILD_CONFIG)/feature-macro.mk
119
120ifeq ($(DRIVER),gtask_a32.elf)
121flags := $(filter-out -flto -fsplit-lto-unit,$(flags))
122endif
123
124flags += -fstack-protector-all
125## gtask will only link here, so so object folder, need to create it.
126$(shell mkdir -p $(BUILD_DIR))
127
128#gtask need to print tlogi info log
129flags += -DTA_LOG_LEVEL=2
130
131# Suppress Wimplicit-fall-through warning: gtask heavily uses it
132
133ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl)
134flags += -DOPENSSL_ENABLE
135else ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
136flags += -DOPENSSL3_ENABLE
137endif
138