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 11DRIVER := drvmgr.elf 12 13override SOURCE_DIR:=$(FRAMEWORK_PATH)/drvmgr 14 15include $(BUILD_CONFIG)/feature-macro.mk 16include $(BUILD_CONFIG)/var.mk 17 18# it depends on compile order 19NO_OBJFILE_SORT = y 20 21# Source files required to build the target 22drvmgr_c_files := src/main.c \ 23 src/drv_dispatch.c \ 24 src/drv_fd_ops.c \ 25 src/drv_process_mgr.c \ 26 src/drv_index_mgr.c \ 27 src/drv_ipc_mgr.c \ 28 src/drv_auth.c \ 29 src/drv_dyn_conf_mgr.c \ 30 src/drvcall_dyn_conf_mgr.c \ 31 src/drv_dyn_policy_mgr_stub.c \ 32 src/base_drv_node.c \ 33 src/task_mgr.c 34 35ifeq ($(WITH_ENG_VERSION), true) 36flags += -DTEE_SUPPORT_DRV_FD_DUMP 37endif 38 39ifeq ($(CONFIG_DYN_CONF_DEBUG), true) 40flags += -DTEE_SUPPORT_DYN_CONF_DEBUG 41endif 42 43ifeq ($(CONFIG_TEE_MISC_DRIVER_64BIT), false) 44flags += -DCONFIG_TEE_MISC_DRIVER 45endif 46 47ifeq ($(CONFIG_TEE_MISC_DRIVER_64BIT), true) 48flags += -DCONFIG_TEE_MISC_DRIVER 49endif 50 51ifeq ($(CONFIG_TEE_CRYPTO_MGR_SERVER_64BIT), false) 52flags += -DCRYPTO_MGR_SERVER_ENABLE 53endif 54 55ifeq ($(CONFIG_TEE_CRYPTO_MGR_SERVER_64BIT), true) 56flags += -DCRYPTO_MGR_SERVER_ENABLE 57endif 58LIBS := 59 60c-flags += -Wno-implicit-fallthrough 61c-flags += -DTA_LOG_LEVEL=2 62inc-flags += -I$(PREBUILD_HEADER)/sys 63inc-flags += -I$(DRIVERS_PATH)/include 64inc-flags += -I$(FRAMEWORK_PATH)/drvmgr/src 65inc-flags += -I$(DRVLIB)/common/libdrv_frame/include/ 66inc-flags += -I$(TEELIB)/libteeconfig/include/ 67inc-flags += -I$(SYSLIB)/libdynconfmgr/include/ 68inc-flags += -I$(SYSLIB)/libspawn_common/include/ 69inc-flags += -I$(TEELIB)/libdrv/include/ 70inc-flags += -I$(TEELIB)/libteeos/include/tee 71inc-flags += -I$(TEELIB)/libteeos/include/legacy 72inc-flags += -I$(TEELIB)/libteeos/include 73inc-flags += -I$(TEELIB)/libteemem/include 74inc-flags += -I$(TEELIB)/libipc_hal/include 75inc-flags += -I$(SYSLIB)/libelf_verify/include 76 77LIBS += c_shared${TARG} 78LIBS += timer${TARG} 79LIBS += teemem${TARG} teeos${TARG} spawn_common${TARG} ipc_hal${TARG} 80 81ENTRY_POINT := main 82LDFLAGS += -z text -z noexecstack --dynamic-linker=libc_shared${TARG}.so 83LIBS += drv_frame${TARG} 84LIBS += drv_shared${TARG} 85 86include $(BUILD_DRIVER)/drv-common.mk 87 88flags += $(TRUSTEDCORE_LOCAL_CFLAGS) 89 90LIBS += drv${TARG} 91drvmgr_LDFLAGS += --whole-archive -lteeconfig${TARG} --no-whole-archive 92 93install: 94 @echo "drvmgr strip begin" 95 @$(READELF) -W -s $(INSTALL_FILE) | grep ' FUNC ' | \ 96 awk -v path=$(INSTALL_FILE) '{printf " -K "$$8} END {printf(" %s", path)}' | \ 97 xargs -L 1 -s 262144 $(STRIP) 98 @echo "drvmgr strip end" 99 100