blob: 1b5330da39724eae9a83592489e9429a246eb450 [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################################################################################
Victor Chong8519bcf2016-07-15 08:43:03 +010024all: arm-tf linux optee-os optee-client xtest helloworld
Victor Chong5fc1f852017-05-22 07:30:47 +010025clean: arm-tf-clean linux-clean busybox-clean optee-os-clean \
Joakim Becha9884312016-03-22 13:24:11 +010026 optee-client-clean
SY Chiuddd3d822015-07-21 10:10:01 +080027
28
29-include toolchain.mk
30
31################################################################################
SY Chiu02ee5fb2016-03-22 17:47:10 +080032# ARM Trusted Firmware
33################################################################################
34ARM_TF_EXPORTS ?= \
35 CFLAGS="-O0 -gdwarf-2" \
Joakim Bech69a8a372016-04-26 11:05:04 +020036 CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
SY Chiu02ee5fb2016-03-22 17:47:10 +080037
38ARM_TF_FLAGS ?= \
39 DEBUG=1 \
40 PLAT=mt8173 \
41 SPD=opteed
42
43arm-tf: optee-os
44 $(ARM_TF_EXPORTS) $(MAKE) -C $(ARM_TF_PATH) $(ARM_TF_FLAGS) all
45
46arm-tf-clean:
47 $(ARM_TF_EXPORTS) $(MAKE) -C $(ARM_TF_PATH) $(ARM_TF_FLAGS) clean
48
49################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +080050# Busybox
51################################################################################
Pascal Brand440ef9c2015-09-08 16:01:58 +020052BUSYBOX_COMMON_TARGET = mt8173-evb
53BUSYBOX_CLEAN_COMMON_TARGET = mt8173-evb clean
SY Chiuddd3d822015-07-21 10:10:01 +080054
Pascal Brand440ef9c2015-09-08 16:01:58 +020055busybox: busybox-common
56
57busybox-clean: busybox-clean-common
58
59busybox-cleaner: busybox-cleaner-common
SY Chiuddd3d822015-07-21 10:10:01 +080060
61################################################################################
62# Linux kernel
63################################################################################
Jerome Forissiere1002382015-11-26 11:36:00 +010064LINUX_DEFCONFIG_COMMON_ARCH := arm64
65LINUX_DEFCONFIG_COMMON_FILES := \
66 $(LINUX_PATH)/arch/arm64/configs/defconfig \
67 $(CURDIR)/kconfigs/mediatek.conf
68
SY Chiuddd3d822015-07-21 10:10:01 +080069linux-defconfig: $(LINUX_PATH)/.config
SY Chiuddd3d822015-07-21 10:10:01 +080070
Pascal Brande3d85982015-09-10 17:20:42 +020071LINUX_COMMON_FLAGS += ARCH=arm64
72
73linux: linux-common
74
75linux-defconfig-clean: linux-defconfig-clean-common
76
77LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64
78
79linux-clean: linux-clean-common
80
81LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64
82
83linux-cleaner: linux-cleaner-common
SY Chiuddd3d822015-07-21 10:10:01 +080084
85################################################################################
86# OP-TEE
87################################################################################
Pascal Brandefe56592016-03-03 10:46:52 +010088OPTEE_OS_COMMON_FLAGS += PLATFORM=mediatek-mt8173
Jerome Forissierae45fbf2015-09-04 09:40:17 +020089optee-os: optee-os-common
SY Chiuddd3d822015-07-21 10:10:01 +080090
Pascal Brandefe56592016-03-03 10:46:52 +010091OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=mediatek-mt8173
Jerome Forissierae45fbf2015-09-04 09:40:17 +020092optee-os-clean: optee-os-clean-common
SY Chiuddd3d822015-07-21 10:10:01 +080093
Pascal Brand070d9552015-09-01 15:33:22 +020094optee-client: optee-client-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +020095
Pascal Brand070d9552015-09-01 15:33:22 +020096optee-client-clean: optee-client-clean-common
SY Chiuddd3d822015-07-21 10:10:01 +080097
SY Chiuddd3d822015-07-21 10:10:01 +080098
99################################################################################
100# xtest / optee_test
101################################################################################
Pascal Brandd6536da2015-09-01 10:38:43 +0200102xtest: xtest-common
103xtest-clean: xtest-clean-common
104xtest-patch: xtest-patch-common
SY Chiuddd3d822015-07-21 10:10:01 +0800105
106################################################################################
Victor Chong8519bcf2016-07-15 08:43:03 +0100107# hello_world
108################################################################################
109helloworld: helloworld-common
110helloworld-clean: helloworld-clean-common
111
112################################################################################
SY Chiuddd3d822015-07-21 10:10:01 +0800113# Root FS
114################################################################################
Etienne Carriere5e113512016-10-21 10:13:57 +0200115filelist-tee: filelist-tee-common
SY Chiuddd3d822015-07-21 10:10:01 +0800116
Etienne Carriere5e113512016-10-21 10:13:57 +0200117update_rootfs: update_rootfs-common
SY Chiuddd3d822015-07-21 10:10:01 +0800118
119################################################################################
120# Image Tools
121################################################################################
122.PHONY: build_image flash_image run
123build-image: update_rootfs optee-os
124 cd $(MTK_TOOLS_PATH); \
SY Chiu02ee5fb2016-03-22 17:47:10 +0800125 ./build_trustzone.sh $(OPTEE_OS_PAGER_BIN) $(ARM_TF_BIN); \
SY Chiuddd3d822015-07-21 10:10:01 +0800126 ./build_bootimg.sh $(LINUX_PATH) $(GEN_ROOTFS_PATH)/filesystem.cpio.gz
127
128flash-image: build-image
129 @echo "Please press reset button ..."
130 @cd $(MTK_TOOLS_PATH); \
131 ./fastboot flash boot ./boot.img; \
132 ./fastboot flash TEE1 ./trustzone.bin
133 @echo "Please press reset button again..."
134
Victor Chong284e9ee2017-05-22 07:26:45 +0100135flash: flash-image