blob: 68bd47ae060d2b6bd36362e7b051e17cc0f4d81c [file] [log] [blame]
Pascal Brandefe56592016-03-03 10:46:52 +01001################################################################################
2# Following variables defines how the NS_USER (Non Secure User - Client
3# Application), NS_KERNEL (Non Secure Kernel), S_KERNEL (Secure Kernel) and
4# S_USER (Secure User - TA) are compiled
5################################################################################
6override COMPILE_NS_USER := 64
7override COMPILE_NS_KERNEL := 64
8override COMPILE_S_USER := 32
9override COMPILE_S_KERNEL := 64
Pascal Brandd6536da2015-09-01 10:38:43 +020010
Pascal Brandefe56592016-03-03 10:46:52 +010011-include common.mk
SY Chiuddd3d822015-07-21 10:10:01 +080012
13################################################################################
14# Paths to git projects and various binaries
15################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +080016MTK_TOOLS_PATH ?= $(ROOT)/mtk_tools
SY Chiu02ee5fb2016-03-22 17:47:10 +080017ARM_TF_PATH ?= $(ROOT)/arm-trusted-firmware
SY Chiu2c5101a2016-03-18 16:01:26 +080018OPTEE_OS_PAGER_BIN ?= $(OPTEE_OS_PATH)/out/arm/core/tee-pager.bin
SY Chiu02ee5fb2016-03-22 17:47:10 +080019ARM_TF_BIN ?= $(ARM_TF_PATH)/build/mt8173/debug/bl31.bin
SY Chiuddd3d822015-07-21 10:10:01 +080020
21################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +080022# Targets
23################################################################################
Igor Opaniuk584efe52017-08-07 01:41:48 +030024all: arm-tf linux optee-os optee-client xtest optee-examples
Victor Chong5fc1f852017-05-22 07:30:47 +010025clean: arm-tf-clean linux-clean busybox-clean optee-os-clean \
Igor Opaniuk584efe52017-08-07 01:41:48 +030026 optee-client-clean optee-examples-clean
SY Chiuddd3d822015-07-21 10:10:01 +080027
28-include toolchain.mk
29
30################################################################################
SY Chiu02ee5fb2016-03-22 17:47:10 +080031# ARM Trusted Firmware
32################################################################################
33ARM_TF_EXPORTS ?= \
Joakim Bech69a8a372016-04-26 11:05:04 +020034 CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
SY Chiu02ee5fb2016-03-22 17:47:10 +080035
36ARM_TF_FLAGS ?= \
37 DEBUG=1 \
38 PLAT=mt8173 \
39 SPD=opteed
40
41arm-tf: optee-os
42 $(ARM_TF_EXPORTS) $(MAKE) -C $(ARM_TF_PATH) $(ARM_TF_FLAGS) all
43
44arm-tf-clean:
45 $(ARM_TF_EXPORTS) $(MAKE) -C $(ARM_TF_PATH) $(ARM_TF_FLAGS) clean
46
47################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +080048# Busybox
49################################################################################
Pascal Brand440ef9c2015-09-08 16:01:58 +020050BUSYBOX_COMMON_TARGET = mt8173-evb
51BUSYBOX_CLEAN_COMMON_TARGET = mt8173-evb clean
SY Chiuddd3d822015-07-21 10:10:01 +080052
Pascal Brand440ef9c2015-09-08 16:01:58 +020053busybox: busybox-common
54
55busybox-clean: busybox-clean-common
56
57busybox-cleaner: busybox-cleaner-common
SY Chiuddd3d822015-07-21 10:10:01 +080058
59################################################################################
60# Linux kernel
61################################################################################
Jerome Forissiere1002382015-11-26 11:36:00 +010062LINUX_DEFCONFIG_COMMON_ARCH := arm64
63LINUX_DEFCONFIG_COMMON_FILES := \
64 $(LINUX_PATH)/arch/arm64/configs/defconfig \
65 $(CURDIR)/kconfigs/mediatek.conf
66
SY Chiuddd3d822015-07-21 10:10:01 +080067linux-defconfig: $(LINUX_PATH)/.config
SY Chiuddd3d822015-07-21 10:10:01 +080068
Pascal Brande3d85982015-09-10 17:20:42 +020069LINUX_COMMON_FLAGS += ARCH=arm64
70
71linux: linux-common
72
73linux-defconfig-clean: linux-defconfig-clean-common
74
75LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64
76
77linux-clean: linux-clean-common
78
79LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64
80
81linux-cleaner: linux-cleaner-common
SY Chiuddd3d822015-07-21 10:10:01 +080082
83################################################################################
84# OP-TEE
85################################################################################
Pascal Brandefe56592016-03-03 10:46:52 +010086OPTEE_OS_COMMON_FLAGS += PLATFORM=mediatek-mt8173
Jerome Forissierae45fbf2015-09-04 09:40:17 +020087optee-os: optee-os-common
SY Chiuddd3d822015-07-21 10:10:01 +080088
Pascal Brandefe56592016-03-03 10:46:52 +010089OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=mediatek-mt8173
Jerome Forissierae45fbf2015-09-04 09:40:17 +020090optee-os-clean: optee-os-clean-common
SY Chiuddd3d822015-07-21 10:10:01 +080091
Pascal Brand070d9552015-09-01 15:33:22 +020092optee-client: optee-client-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +020093
Pascal Brand070d9552015-09-01 15:33:22 +020094optee-client-clean: optee-client-clean-common
SY Chiuddd3d822015-07-21 10:10:01 +080095
SY Chiuddd3d822015-07-21 10:10:01 +080096
97################################################################################
98# xtest / optee_test
99################################################################################
Pascal Brandd6536da2015-09-01 10:38:43 +0200100xtest: xtest-common
101xtest-clean: xtest-clean-common
102xtest-patch: xtest-patch-common
SY Chiuddd3d822015-07-21 10:10:01 +0800103
104################################################################################
Igor Opaniuk584efe52017-08-07 01:41:48 +0300105# Sample applications / optee_examples
Victor Chong8519bcf2016-07-15 08:43:03 +0100106################################################################################
Igor Opaniuk584efe52017-08-07 01:41:48 +0300107optee-examples: optee-examples-common
108
109optee-examples-clean: optee-examples-clean-common
Victor Chong8519bcf2016-07-15 08:43:03 +0100110
111################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +0800112# Root FS
113################################################################################
Etienne Carriere5e113512016-10-21 10:13:57 +0200114filelist-tee: filelist-tee-common
SY Chiuddd3d822015-07-21 10:10:01 +0800115
Etienne Carriere5e113512016-10-21 10:13:57 +0200116update_rootfs: update_rootfs-common
SY Chiuddd3d822015-07-21 10:10:01 +0800117
118################################################################################
119# Image Tools
120################################################################################
121.PHONY: build_image flash_image run
122build-image: update_rootfs optee-os
123 cd $(MTK_TOOLS_PATH); \
SY Chiu02ee5fb2016-03-22 17:47:10 +0800124 ./build_trustzone.sh $(OPTEE_OS_PAGER_BIN) $(ARM_TF_BIN); \
SY Chiuddd3d822015-07-21 10:10:01 +0800125 ./build_bootimg.sh $(LINUX_PATH) $(GEN_ROOTFS_PATH)/filesystem.cpio.gz
126
127flash-image: build-image
128 @echo "Please press reset button ..."
129 @cd $(MTK_TOOLS_PATH); \
130 ./fastboot flash boot ./boot.img; \
131 ./fastboot flash TEE1 ./trustzone.bin
132 @echo "Please press reset button again..."
133
Victor Chong284e9ee2017-05-22 07:26:45 +0100134flash: flash-image