Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 1 | # |
| 2 | # Common definition to all platforms |
| 3 | # |
| 4 | |
Jens Wiklander | 650f298 | 2017-04-05 10:08:59 +0200 | [diff] [blame^] | 5 | SHELL := bash |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 6 | BASH ?= bash |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 7 | ROOT ?= $(shell pwd)/.. |
| 8 | |
Philip Attfield | 3f9250f | 2016-09-14 07:43:32 +0200 | [diff] [blame] | 9 | BUILD_PATH ?= $(ROOT)/build |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 10 | LINUX_PATH ?= $(ROOT)/linux |
Victor Chong | 9f0d120 | 2016-04-23 16:28:31 +0100 | [diff] [blame] | 11 | OPTEE_GENDRV_MODULE ?= $(LINUX_PATH)/drivers/tee/optee/optee.ko |
Pascal Brand | 440ef9c | 2015-09-08 16:01:58 +0200 | [diff] [blame] | 12 | GEN_ROOTFS_PATH ?= $(ROOT)/gen_rootfs |
| 13 | GEN_ROOTFS_FILELIST ?= $(GEN_ROOTFS_PATH)/filelist-tee.txt |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 14 | OPTEE_OS_PATH ?= $(ROOT)/optee_os |
| 15 | OPTEE_CLIENT_PATH ?= $(ROOT)/optee_client |
| 16 | OPTEE_CLIENT_EXPORT ?= $(OPTEE_CLIENT_PATH)/out/export |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 17 | OPTEE_TEST_PATH ?= $(ROOT)/optee_test |
| 18 | OPTEE_TEST_OUT_PATH ?= $(ROOT)/optee_test/out |
Victor Chong | 8519bcf | 2016-07-15 08:43:03 +0100 | [diff] [blame] | 19 | HELLOWORLD_PATH ?= $(ROOT)/hello_world |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 20 | |
Etienne Carriere | cc23f6b | 2016-10-21 10:16:00 +0200 | [diff] [blame] | 21 | # default high verbosity. slow uarts shall specify lower if prefered |
Pascal Brand | 23ef205 | 2016-03-09 15:25:01 +0100 | [diff] [blame] | 22 | CFG_TEE_CORE_LOG_LEVEL ?= 3 |
| 23 | |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 24 | CCACHE ?= $(shell which ccache) # Don't remove this comment (space is needed) |
| 25 | |
Igor Opaniuk | 97d0529 | 2016-10-26 14:46:14 +0300 | [diff] [blame] | 26 | # Accessing a shared folder on the host from QEMU: |
| 27 | # # Set QEMU_VIRTFS_ENABLE to 'y' and adjust QEMU_VIRTFS_HOST_DIR |
| 28 | # # Then in QEMU, run: |
| 29 | # # $ mount -t 9p -o trans=virtio host <mount_point> |
| 30 | QEMU_VIRTFS_ENABLE ?= n |
| 31 | QEMU_VIRTFS_HOST_DIR ?= $(ROOT) |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 32 | |
Igor Opaniuk | 0aea4ef | 2017-01-13 12:52:00 +0200 | [diff] [blame] | 33 | # Enable SLiRP user networking |
| 34 | QEMU_USERNET_ENABLE ?= n |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 35 | ################################################################################ |
| 36 | # Check coherency of compilation mode |
| 37 | ################################################################################ |
| 38 | |
| 39 | ifneq ($(COMPILE_NS_USER),) |
| 40 | ifeq ($(COMPILE_NS_KERNEL),) |
| 41 | $(error COMPILE_NS_KERNEL must be defined as COMPILE_NS_USER=$(COMPILE_NS_USER) is defined) |
| 42 | endif |
| 43 | ifeq (,$(filter $(COMPILE_NS_USER),32 64)) |
| 44 | $(error COMPILE_NS_USER=$(COMPILE_NS_USER) - Should be 32 or 64) |
| 45 | endif |
| 46 | endif |
| 47 | |
| 48 | ifneq ($(COMPILE_NS_KERNEL),) |
| 49 | ifeq ($(COMPILE_NS_USER),) |
| 50 | $(error COMPILE_NS_USER must be defined as COMPILE_NS_KERNEL=$(COMPILE_NS_KERNEL) is defined) |
| 51 | endif |
| 52 | ifeq (,$(filter $(COMPILE_NS_KERNEL),32 64)) |
| 53 | $(error COMPILE_NS_KERNEL=$(COMPILE_NS_KERNEL) - Should be 32 or 64) |
| 54 | endif |
| 55 | endif |
| 56 | |
| 57 | ifeq ($(COMPILE_NS_KERNEL),32) |
| 58 | ifneq ($(COMPILE_NS_USER),32) |
| 59 | $(error COMPILE_NS_USER=$(COMPILE_NS_USER) - Should be 32 as COMPILE_NS_KERNEL=$(COMPILE_NS_KERNEL)) |
| 60 | endif |
| 61 | endif |
| 62 | |
| 63 | ifneq ($(COMPILE_S_USER),) |
| 64 | ifeq ($(COMPILE_S_KERNEL),) |
| 65 | $(error COMPILE_S_KERNEL must be defined as COMPILE_S_USER=$(COMPILE_S_USER) is defined) |
| 66 | endif |
| 67 | ifeq (,$(filter $(COMPILE_S_USER),32 64)) |
| 68 | $(error COMPILE_S_USER=$(COMPILE_S_USER) - Should be 32 or 64) |
| 69 | endif |
| 70 | endif |
| 71 | |
| 72 | ifneq ($(COMPILE_S_KERNEL),) |
| 73 | OPTEE_OS_COMMON_EXTRA_FLAGS ?= O=out/arm |
| 74 | OPTEE_OS_BIN ?= $(OPTEE_OS_PATH)/out/arm/core/tee.bin |
| 75 | ifeq ($(COMPILE_S_USER),) |
| 76 | $(error COMPILE_S_USER must be defined as COMPILE_S_KERNEL=$(COMPILE_S_KERNEL) is defined) |
| 77 | endif |
| 78 | ifeq (,$(filter $(COMPILE_S_KERNEL),32 64)) |
| 79 | $(error COMPILE_S_KERNEL=$(COMPILE_S_KERNEL) - Should be 32 or 64) |
| 80 | endif |
| 81 | endif |
| 82 | |
| 83 | ifeq ($(COMPILE_S_KERNEL),32) |
| 84 | ifneq ($(COMPILE_S_USER),32) |
| 85 | $(error COMPILE_S_USER=$(COMPILE_S_USER) - Should be 32 as COMPILE_S_KERNEL=$(COMPILE_S_KERNEL)) |
| 86 | endif |
| 87 | endif |
| 88 | |
| 89 | |
| 90 | ################################################################################ |
| 91 | # set the compiler when COMPILE_xxx are defined |
| 92 | ################################################################################ |
Pascal Brand | efe5659 | 2016-03-03 10:46:52 +0100 | [diff] [blame] | 93 | CROSS_COMPILE_NS_USER ?= "$(CCACHE)$(AARCH$(COMPILE_NS_USER)_CROSS_COMPILE)" |
| 94 | CROSS_COMPILE_NS_KERNEL ?= "$(CCACHE)$(AARCH$(COMPILE_NS_KERNEL)_CROSS_COMPILE)" |
| 95 | CROSS_COMPILE_S_USER ?= "$(CCACHE)$(AARCH$(COMPILE_S_USER)_CROSS_COMPILE)" |
| 96 | CROSS_COMPILE_S_KERNEL ?= "$(CCACHE)$(AARCH$(COMPILE_S_KERNEL)_CROSS_COMPILE)" |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 97 | |
| 98 | ifeq ($(COMPILE_S_USER),32) |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 99 | OPTEE_OS_TA_DEV_KIT_DIR ?= $(OPTEE_OS_PATH)/out/arm/export-ta_arm32 |
| 100 | endif |
| 101 | ifeq ($(COMPILE_S_USER),64) |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 102 | OPTEE_OS_TA_DEV_KIT_DIR ?= $(OPTEE_OS_PATH)/out/arm/export-ta_arm64 |
| 103 | endif |
| 104 | |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 105 | ifeq ($(COMPILE_S_KERNEL),64) |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 106 | OPTEE_OS_COMMON_EXTRA_FLAGS += CFG_ARM64_core=y |
| 107 | endif |
| 108 | |
| 109 | |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 110 | ################################################################################ |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 111 | # defines, macros, configuration etc |
| 112 | ################################################################################ |
| 113 | define KERNEL_VERSION |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 114 | $(shell cd $(LINUX_PATH) && $(MAKE) --no-print-directory kernelversion) |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 115 | endef |
| 116 | DEBUG ?= 0 |
| 117 | |
| 118 | ################################################################################ |
Pascal Brand | cb45260 | 2015-10-13 10:46:33 +0200 | [diff] [blame] | 119 | # default target is all |
| 120 | ################################################################################ |
| 121 | all: |
| 122 | |
| 123 | ################################################################################ |
Pascal Brand | 440ef9c | 2015-09-08 16:01:58 +0200 | [diff] [blame] | 124 | # Busybox |
| 125 | ################################################################################ |
| 126 | BUSYBOX_COMMON_TARGET ?= TOBEDEFINED |
| 127 | BUSYBOX_CLEAN_COMMON_TARGET ?= TOBEDEFINED |
Pascal Brand | 440ef9c | 2015-09-08 16:01:58 +0200 | [diff] [blame] | 128 | |
| 129 | busybox-common: linux |
| 130 | cd $(GEN_ROOTFS_PATH) && \ |
Pascal Brand | efe5659 | 2016-03-03 10:46:52 +0100 | [diff] [blame] | 131 | CROSS_COMPILE=$(CROSS_COMPILE_NS_USER) \ |
Pascal Brand | 440ef9c | 2015-09-08 16:01:58 +0200 | [diff] [blame] | 132 | PATH=${PATH}:$(LINUX_PATH)/usr \ |
| 133 | $(GEN_ROOTFS_PATH)/generate-cpio-rootfs.sh \ |
| 134 | $(BUSYBOX_COMMON_TARGET) |
| 135 | |
| 136 | busybox-clean-common: |
| 137 | cd $(GEN_ROOTFS_PATH) && \ |
| 138 | $(GEN_ROOTFS_PATH)/generate-cpio-rootfs.sh \ |
| 139 | $(BUSYBOX_CLEAN_COMMON_TARGET) |
| 140 | |
| 141 | busybox-cleaner-common: |
| 142 | rm -rf $(GEN_ROOTFS_PATH)/build |
| 143 | rm -rf $(GEN_ROOTFS_PATH)/filelist-final.txt |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 144 | |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 145 | ################################################################################ |
| 146 | # Linux |
| 147 | ################################################################################ |
| 148 | LINUX_COMMON_FLAGS ?= LOCALVERSION= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) |
| 149 | |
| 150 | linux-common: linux-defconfig |
| 151 | $(MAKE) -C $(LINUX_PATH) $(LINUX_COMMON_FLAGS) |
| 152 | |
Jerome Forissier | e100238 | 2015-11-26 11:36:00 +0100 | [diff] [blame] | 153 | $(LINUX_PATH)/.config: $(LINUX_DEFCONFIG_COMMON_FILES) |
| 154 | cd $(LINUX_PATH) && \ |
| 155 | ARCH=$(LINUX_DEFCONFIG_COMMON_ARCH) \ |
| 156 | scripts/kconfig/merge_config.sh $(LINUX_DEFCONFIG_COMMON_FILES) |
| 157 | |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 158 | linux-defconfig-clean-common: |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 159 | rm -f $(LINUX_PATH)/.config |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 160 | |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 161 | # LINUX_CLEAN_COMMON_FLAGS can be defined in specific makefiles (hikey.mk,...) |
| 162 | # if necessary |
| 163 | |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 164 | linux-clean-common: linux-defconfig-clean |
| 165 | $(MAKE) -C $(LINUX_PATH) $(LINUX_CLEAN_COMMON_FLAGS) clean |
| 166 | |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 167 | # LINUX_CLEANER_COMMON_FLAGS can be defined in specific makefiles (hikey.mk,...) |
| 168 | # if necessary |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 169 | |
| 170 | linux-cleaner-common: linux-defconfig-clean |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 171 | $(MAKE) -C $(LINUX_PATH) $(LINUX_CLEANER_COMMON_FLAGS) distclean |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 172 | |
Pascal Brand | 440ef9c | 2015-09-08 16:01:58 +0200 | [diff] [blame] | 173 | ################################################################################ |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 174 | # EDK2 / Tianocore |
| 175 | ################################################################################ |
| 176 | # Make sure edksetup.sh only will be called once and that we don't rebuild |
| 177 | # BaseTools again and again. |
| 178 | $(EDK2_PATH)/Conf/target.txt: |
Jens Wiklander | 650f298 | 2017-04-05 10:08:59 +0200 | [diff] [blame^] | 179 | set -e && cd $(EDK2_PATH) && source edksetup.sh && \ |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 180 | $(MAKE) -j1 -C $(EDK2_PATH)/BaseTools |
| 181 | |
| 182 | edk2-common: $(EDK2_PATH)/Conf/target.txt |
Jens Wiklander | 650f298 | 2017-04-05 10:08:59 +0200 | [diff] [blame^] | 183 | set -e && cd $(EDK2_PATH) && source edksetup.sh && \ |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 184 | $(call edk2-call) |
| 185 | |
| 186 | edk2-clean-common: |
Jens Wiklander | 650f298 | 2017-04-05 10:08:59 +0200 | [diff] [blame^] | 187 | set -e && cd $(EDK2_PATH) && source edksetup.sh && \ |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 188 | $(call edk2-call) clean && \ |
| 189 | $(MAKE) -j1 -C $(EDK2_PATH)/BaseTools clean && \ |
| 190 | rm -f $(EDK2_PATH)/Conf/target.txt |
Igor Opaniuk | 97d0529 | 2016-10-26 14:46:14 +0300 | [diff] [blame] | 191 | ################################################################################ |
| 192 | # QEMU / QEMUv8 |
| 193 | ################################################################################ |
| 194 | QEMU_CONFIGURE_PARAMS_COMMON = --cc="$(CCACHE)gcc" --extra-cflags="-Wno-error" |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 195 | |
Igor Opaniuk | 97d0529 | 2016-10-26 14:46:14 +0300 | [diff] [blame] | 196 | ifeq ($(QEMU_VIRTFS_ENABLE),y) |
Jerome Forissier | 23b4131 | 2016-11-12 16:02:01 +0100 | [diff] [blame] | 197 | QEMU_CONFIGURE_PARAMS_COMMON += --enable-virtfs |
Igor Opaniuk | 97d0529 | 2016-10-26 14:46:14 +0300 | [diff] [blame] | 198 | QEMU_EXTRA_ARGS +=\ |
| 199 | -fsdev local,id=fsdev0,path=$(QEMU_VIRTFS_HOST_DIR),security_model=none \ |
| 200 | -device virtio-9p-device,fsdev=fsdev0,mount_tag=host |
| 201 | endif |
Igor Opaniuk | 0aea4ef | 2017-01-13 12:52:00 +0200 | [diff] [blame] | 202 | |
| 203 | ifeq ($(QEMU_USERNET_ENABLE),y) |
| 204 | QEMU_EXTRA_ARGS +=\ |
| 205 | -netdev user,id=vmnic -device virtio-net-device,netdev=vmnic |
| 206 | endif |
Jerome Forissier | efd5629 | 2017-01-31 17:46:10 +0100 | [diff] [blame] | 207 | |
| 208 | define run-help |
| 209 | @echo |
| 210 | @echo \* QEMU is now waiting to start the execution |
| 211 | @echo \* Start execution with either a \'c\' followed by \<enter\> in the QEMU console or |
| 212 | @echo \* attach a debugger and continue from there. |
| 213 | @echo \* |
| 214 | @echo \* To run OP-TEE tests, use the xtest command in the \'Normal World\' terminal |
| 215 | @echo \* Enter \'xtest -h\' for help. |
| 216 | @echo |
| 217 | endef |
| 218 | |
| 219 | gnome-terminal := $(shell command -v gnome-terminal 2>/dev/null) |
| 220 | xterm := $(shell command -v xterm 2>/dev/null) |
| 221 | ifdef gnome-terminal |
| 222 | # Note: the title option (-t) is ignored with gnome-terminal versions |
| 223 | # >= 3.14 and < 3.20 |
| 224 | define launch-terminal |
| 225 | @nc -z 127.0.0.1 $(1) || \ |
| 226 | $(gnome-terminal) -t "$(2)" -x $(SOC_TERM_PATH)/soc_term $(1) & |
| 227 | endef |
| 228 | else |
| 229 | ifdef xterm |
| 230 | define launch-terminal |
| 231 | @nc -z 127.0.0.1 $(1) || \ |
| 232 | $(xterm) -title $(2) -e $(BASH) -c "$(SOC_TERM_PATH)/soc_term $(1)" & |
| 233 | endef |
| 234 | else |
| 235 | check-terminal := @echo "Error: could not find gnome-terminal nor xterm" ; false |
| 236 | endif |
| 237 | endif |
| 238 | |
| 239 | define wait-for-ports |
| 240 | @while ! nc -z 127.0.0.1 $(1) || ! nc -z 127.0.0.1 $(2); do sleep 1; done |
| 241 | endef |
| 242 | |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 243 | ################################################################################ |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 244 | # OP-TEE |
| 245 | ################################################################################ |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 246 | OPTEE_OS_COMMON_FLAGS ?= \ |
| 247 | $(OPTEE_OS_COMMON_EXTRA_FLAGS) \ |
| 248 | CROSS_COMPILE=$(CROSS_COMPILE_S_USER) \ |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 249 | CROSS_COMPILE_core=$(CROSS_COMPILE_S_KERNEL) \ |
Victor Chong | badc792 | 2015-12-08 17:23:20 +0000 | [diff] [blame] | 250 | CROSS_COMPILE_ta_arm64=$(AARCH64_CROSS_COMPILE) \ |
| 251 | CROSS_COMPILE_ta_arm32=$(AARCH32_CROSS_COMPILE) \ |
Pascal Brand | 23ef205 | 2016-03-09 15:25:01 +0100 | [diff] [blame] | 252 | CFG_TEE_CORE_LOG_LEVEL=$(CFG_TEE_CORE_LOG_LEVEL) \ |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 253 | DEBUG=$(DEBUG) |
| 254 | |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 255 | optee-os-common: |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 256 | $(MAKE) -C $(OPTEE_OS_PATH) $(OPTEE_OS_COMMON_FLAGS) |
| 257 | |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 258 | OPTEE_OS_CLEAN_COMMON_FLAGS ?= $(OPTEE_OS_COMMON_EXTRA_FLAGS) |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 259 | |
Victor Chong | 8519bcf | 2016-07-15 08:43:03 +0100 | [diff] [blame] | 260 | optee-os-clean-common: xtest-clean helloworld-clean |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 261 | $(MAKE) -C $(OPTEE_OS_PATH) $(OPTEE_OS_CLEAN_COMMON_FLAGS) clean |
| 262 | |
| 263 | OPTEE_CLIENT_COMMON_FLAGS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_USER) |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 264 | |
| 265 | optee-client-common: |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 266 | $(MAKE) -C $(OPTEE_CLIENT_PATH) $(OPTEE_CLIENT_COMMON_FLAGS) |
| 267 | |
Victor Chong | 87f5fcf | 2015-11-26 10:52:52 +0900 | [diff] [blame] | 268 | # OPTEE_CLIENT_CLEAN_COMMON_FLAGS can be defined in specific makefiles |
| 269 | # (hikey.mk,...) if necessary |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 270 | |
| 271 | optee-client-clean-common: |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 272 | $(MAKE) -C $(OPTEE_CLIENT_PATH) $(OPTEE_CLIENT_CLEAN_COMMON_FLAGS) \ |
| 273 | clean |
| 274 | |
Pascal Brand | 070d955 | 2015-09-01 15:33:22 +0200 | [diff] [blame] | 275 | ################################################################################ |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 276 | # xtest / optee_test |
| 277 | ################################################################################ |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 278 | XTEST_COMMON_FLAGS ?= CROSS_COMPILE_HOST=$(CROSS_COMPILE_NS_USER)\ |
| 279 | CROSS_COMPILE_TA=$(CROSS_COMPILE_S_USER) \ |
| 280 | TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) \ |
Etienne Carriere | 5e11351 | 2016-10-21 10:13:57 +0200 | [diff] [blame] | 281 | OPTEE_CLIENT_EXPORT=$(OPTEE_CLIENT_EXPORT) \ |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 282 | COMPILE_NS_USER=$(COMPILE_NS_USER) \ |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 283 | O=$(OPTEE_TEST_OUT_PATH) |
| 284 | |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 285 | xtest-common: optee-os optee-client |
Pascal Brand | dc83b9a | 2015-09-24 02:43:25 +0200 | [diff] [blame] | 286 | $(MAKE) -C $(OPTEE_TEST_PATH) $(XTEST_COMMON_FLAGS) |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 287 | |
Etienne Carriere | 965db7b | 2017-01-10 17:50:21 +0100 | [diff] [blame] | 288 | XTEST_CLEAN_COMMON_FLAGS ?= O=$(OPTEE_TEST_OUT_PATH) \ |
| 289 | TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) \ |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 290 | |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 291 | xtest-clean-common: |
Pascal Brand | dc83b9a | 2015-09-24 02:43:25 +0200 | [diff] [blame] | 292 | $(MAKE) -C $(OPTEE_TEST_PATH) $(XTEST_CLEAN_COMMON_FLAGS) clean |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 293 | |
Pascal Brand | dc83b9a | 2015-09-24 02:43:25 +0200 | [diff] [blame] | 294 | XTEST_PATCH_COMMON_FLAGS ?= $(XTEST_COMMON_FLAGS) |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 295 | |
Pascal Brand | dc83b9a | 2015-09-24 02:43:25 +0200 | [diff] [blame] | 296 | xtest-patch-common: |
| 297 | $(MAKE) -C $(OPTEE_TEST_PATH) $(XTEST_PATCH_COMMON_FLAGS) patch |
Victor Chong | 8519bcf | 2016-07-15 08:43:03 +0100 | [diff] [blame] | 298 | |
| 299 | ################################################################################ |
| 300 | # hello_world |
| 301 | ################################################################################ |
| 302 | HELLOWORLD_COMMON_FLAGS ?= HOST_CROSS_COMPILE=$(CROSS_COMPILE_NS_USER)\ |
| 303 | TA_CROSS_COMPILE=$(CROSS_COMPILE_S_USER) \ |
| 304 | TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) \ |
| 305 | TEEC_EXPORT=$(OPTEE_CLIENT_EXPORT) |
| 306 | |
| 307 | helloworld-common: optee-os optee-client |
| 308 | $(MAKE) -C $(HELLOWORLD_PATH) $(HELLOWORLD_COMMON_FLAGS) |
| 309 | |
| 310 | HELLOWORLD_CLEAN_COMMON_FLAGS ?= TA_DEV_KIT_DIR=$(OPTEE_OS_TA_DEV_KIT_DIR) |
| 311 | |
| 312 | helloworld-clean-common: |
| 313 | $(MAKE) -C $(HELLOWORLD_PATH) $(HELLOWORLD_CLEAN_COMMON_FLAGS) clean |
Etienne Carriere | 5e11351 | 2016-10-21 10:13:57 +0200 | [diff] [blame] | 314 | |
| 315 | ################################################################################ |
| 316 | # rootfs |
| 317 | ################################################################################ |
| 318 | update_rootfs-common: busybox filelist-tee |
| 319 | cat $(GEN_ROOTFS_PATH)/filelist-final.txt > $(GEN_ROOTFS_PATH)/filelist.tmp |
| 320 | cat $(GEN_ROOTFS_FILELIST) >> $(GEN_ROOTFS_PATH)/filelist.tmp |
| 321 | cd $(GEN_ROOTFS_PATH) && \ |
| 322 | $(LINUX_PATH)/usr/gen_init_cpio $(GEN_ROOTFS_PATH)/filelist.tmp | \ |
| 323 | gzip > $(GEN_ROOTFS_PATH)/filesystem.cpio.gz |
| 324 | |
| 325 | update_rootfs-clean-common: |
| 326 | rm -f $(GEN_ROOTFS_PATH)/filesystem.cpio.gz |
| 327 | rm -f $(GEN_ROOTFS_PATH)/filelist-all.txt |
| 328 | rm -f $(GEN_ROOTFS_PATH)/filelist-tmp.txt |
| 329 | rm -f $(GEN_ROOTFS_FILELIST) |
| 330 | |
| 331 | filelist-tee-common: fl:=$(GEN_ROOTFS_FILELIST) |
| 332 | filelist-tee-common: optee-client xtest helloworld |
| 333 | @echo "# filelist-tee-common /start" > $(fl) |
| 334 | @echo "dir /lib/optee_armtz 755 0 0" >> $(fl) |
| 335 | @echo "# xtest / optee_test" >> $(fl) |
| 336 | @find $(OPTEE_TEST_OUT_PATH) -type f -name "xtest" | \ |
| 337 | sed 's/\(.*\)/file \/bin\/xtest \1 755 0 0/g' >> $(fl) |
| 338 | @find $(OPTEE_TEST_OUT_PATH) -name "*.ta" | \ |
| 339 | sed 's/\(.*\)\/\(.*\)/file \/lib\/optee_armtz\/\2 \1\/\2 444 0 0/g' \ |
| 340 | >> $(fl) |
| 341 | @if [ -e $(HELLOWORLD_PATH)/host/hello_world ]; then \ |
| 342 | echo "file /bin/hello_world" \ |
| 343 | "$(HELLOWORLD_PATH)/host/hello_world 755 0 0" >> $(fl); \ |
Joakim Bech | 4b85a68 | 2016-12-21 09:41:51 +0100 | [diff] [blame] | 344 | echo "file /lib/optee_armtz/8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta" \ |
| 345 | "$(HELLOWORLD_PATH)/ta/8aaaf200-2450-11e4-abe2-0002a5d5c51b.ta" \ |
Etienne Carriere | 5e11351 | 2016-10-21 10:13:57 +0200 | [diff] [blame] | 346 | "444 0 0" >> $(fl); \ |
| 347 | fi |
Igor Opaniuk | 0aea4ef | 2017-01-13 12:52:00 +0200 | [diff] [blame] | 348 | @if [ "$(QEMU_USERNET_ENABLE)" = "y" ]; then \ |
| 349 | echo "slink /etc/rc.d/S02_udhcp_networking /etc/init.d/udhcpc 755 0 0" \ |
| 350 | >> $(fl); \ |
| 351 | fi |
Etienne Carriere | 5e11351 | 2016-10-21 10:13:57 +0200 | [diff] [blame] | 352 | @echo "# Secure storage dir" >> $(fl) |
| 353 | @echo "dir /data 755 0 0" >> $(fl) |
| 354 | @echo "dir /data/tee 755 0 0" >> $(fl) |
| 355 | @if [ -e $(OPTEE_GENDRV_MODULE) ]; then \ |
| 356 | echo "# OP-TEE device" >> $(fl); \ |
| 357 | echo "dir /lib/modules 755 0 0" >> $(fl); \ |
| 358 | echo "dir /lib/modules/$(call KERNEL_VERSION) 755 0 0" \ |
| 359 | >> $(fl); \ |
| 360 | echo "file /lib/modules/$(call KERNEL_VERSION)/optee.ko" \ |
| 361 | "$(OPTEE_GENDRV_MODULE) 755 0 0" \ |
| 362 | >> $(fl); \ |
| 363 | fi |
| 364 | @echo "# OP-TEE Client" >> $(fl) |
| 365 | @echo "file /bin/tee-supplicant $(OPTEE_CLIENT_EXPORT)/bin/tee-supplicant 755 0 0" \ |
| 366 | >> $(fl) |
| 367 | @echo "file /lib/libteec.so.1.0 $(OPTEE_CLIENT_EXPORT)/lib/libteec.so.1.0 755 0 0" \ |
| 368 | >> $(fl) |
| 369 | @echo "slink /lib/libteec.so.1 libteec.so.1.0 755 0 0" >> $(fl) |
| 370 | @echo "slink /lib/libteec.so libteec.so.1 755 0 0" >> $(fl) |
| 371 | @if [ -e $(OPTEE_CLIENT_EXPORT)/lib/libsqlfs.so.1.0 ]; then \ |
| 372 | echo "file /lib/libsqlfs.so.1.0" \ |
| 373 | "$(OPTEE_CLIENT_EXPORT)/lib/libsqlfs.so.1.0 755 0 0" \ |
| 374 | >> $(fl); \ |
| 375 | echo "slink /lib/libsqlfs.so.1 libsqlfs.so.1.0 755 0 0" >> $(fl); \ |
| 376 | echo "slink /lib/libsqlfs.so libsqlfs.so.1 755 0 0" >> $(fl); \ |
| 377 | fi |
Jerome Forissier | 1333db4 | 2017-01-18 10:20:51 +0100 | [diff] [blame] | 378 | @echo "file /etc/init.d/optee $(BUILD_PATH)/init.d.optee 755 0 0" >> $(fl) |
| 379 | @echo "slink /etc/rc.d/S09_optee /etc/init.d/optee 755 0 0" >> $(fl) |
Etienne Carriere | 5e11351 | 2016-10-21 10:13:57 +0200 | [diff] [blame] | 380 | @echo "# filelist-tee-common /end" >> $(fl) |