blob: bbab849dbc066782d4e73542c570d9316a3d330e [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 := 32
7override COMPILE_NS_KERNEL := 32
8override COMPILE_S_USER := 32
9override COMPILE_S_KERNEL := 32
Pascal Brandd6536da2015-09-01 10:38:43 +020010
Pascal Brandefe56592016-03-03 10:46:52 +010011-include common.mk
Joakim Bech427dd632015-05-04 15:52:33 +020012
13################################################################################
14# Paths to git projects and various binaries
15################################################################################
Joakim Bech427dd632015-05-04 15:52:33 +020016BIOS_QEMU_PATH ?= $(ROOT)/bios_qemu_tz_arm
Joakim Bech427dd632015-05-04 15:52:33 +020017QEMU_PATH ?= $(ROOT)/qemu
18
19SOC_TERM_PATH ?= $(ROOT)/soc_term
20
Pascal Brand070d9552015-09-01 15:33:22 +020021DEBUG = 1
Joakim Bech427dd632015-05-04 15:52:33 +020022
Joakim Bech427dd632015-05-04 15:52:33 +020023################################################################################
24# Targets
25################################################################################
Igor Opaniuk4f667cd2017-05-31 14:11:56 +030026ifeq ($(CFG_TEE_BENCHMARK),y)
27all: benchmark-app
28clean: benchmark-app-clean
29endif
Igor Opaniuk584efe52017-08-07 01:41:48 +030030all: bios-qemu qemu soc-term optee-examples
Victor Chong5fc1f852017-05-22 07:30:47 +010031clean: bios-qemu-clean busybox-clean linux-clean optee-os-clean \
Igor Opaniuk584efe52017-08-07 01:41:48 +030032 optee-client-clean qemu-clean soc-term-clean check-clean \
33 optee-examples-clean
Joakim Bech427dd632015-05-04 15:52:33 +020034
35-include toolchain.mk
36
37################################################################################
38# QEMU
39################################################################################
40define bios-qemu-common
Jerome Forissier2660ff22015-09-03 10:20:00 +020041 +$(MAKE) -C $(BIOS_QEMU_PATH) \
42 CROSS_COMPILE=$(CROSS_COMPILE_NS_USER) \
Joakim Bech427dd632015-05-04 15:52:33 +020043 O=$(ROOT)/out/bios-qemu \
44 BIOS_NSEC_BLOB=$(LINUX_PATH)/arch/arm/boot/zImage \
45 BIOS_NSEC_ROOTFS=$(GEN_ROOTFS_PATH)/filesystem.cpio.gz \
46 BIOS_SECURE_BLOB=$(OPTEE_OS_BIN) \
47 PLATFORM_FLAVOR=virt
48endef
49
Jerome Forissier2660ff22015-09-03 10:20:00 +020050bios-qemu: update_rootfs optee-os
Joakim Bech427dd632015-05-04 15:52:33 +020051 $(call bios-qemu-common)
52
53bios-qemu-clean:
54 $(call bios-qemu-common) clean
55
56qemu:
Igor Opaniuk97d05292016-10-26 14:46:14 +030057 cd $(QEMU_PATH); ./configure --target-list=arm-softmmu\
58 $(QEMU_CONFIGURE_PARAMS_COMMON)
Jerome Forissier2660ff22015-09-03 10:20:00 +020059 $(MAKE) -C $(QEMU_PATH)
Joakim Bech427dd632015-05-04 15:52:33 +020060
61qemu-clean:
Jerome Forissier2660ff22015-09-03 10:20:00 +020062 $(MAKE) -C $(QEMU_PATH) distclean
Joakim Bech427dd632015-05-04 15:52:33 +020063
64################################################################################
65# Busybox
66################################################################################
Pascal Brand440ef9c2015-09-08 16:01:58 +020067BUSYBOX_COMMON_TARGET = vexpress
68BUSYBOX_CLEAN_COMMON_TARGET = vexpress clean
Joakim Bech427dd632015-05-04 15:52:33 +020069
Pascal Brand440ef9c2015-09-08 16:01:58 +020070busybox: busybox-common
Joakim Bech427dd632015-05-04 15:52:33 +020071
Pascal Brand440ef9c2015-09-08 16:01:58 +020072busybox-clean: busybox-clean-common
73
74busybox-cleaner: busybox-cleaner-common
Joakim Bech427dd632015-05-04 15:52:33 +020075
76################################################################################
77# Linux kernel
78################################################################################
Jerome Forissiere1002382015-11-26 11:36:00 +010079LINUX_DEFCONFIG_COMMON_ARCH := arm
80LINUX_DEFCONFIG_COMMON_FILES := \
81 $(LINUX_PATH)/arch/arm/configs/vexpress_defconfig \
82 $(CURDIR)/kconfigs/qemu.conf
Joakim Bech427dd632015-05-04 15:52:33 +020083
84linux-defconfig: $(LINUX_PATH)/.config
85
Pascal Brande3d85982015-09-10 17:20:42 +020086LINUX_COMMON_FLAGS += ARCH=arm
Joakim Bech427dd632015-05-04 15:52:33 +020087
Pascal Brande3d85982015-09-10 17:20:42 +020088linux: linux-common
89
90linux-defconfig-clean: linux-defconfig-clean-common
91
92LINUX_CLEAN_COMMON_FLAGS += ARCH=arm
93
94linux-clean: linux-clean-common
95
96LINUX_CLEANER_COMMON_FLAGS += ARCH=arm
97
98linux-cleaner: linux-cleaner-common
Joakim Bech427dd632015-05-04 15:52:33 +020099
100################################################################################
101# OP-TEE
102################################################################################
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200103OPTEE_OS_COMMON_FLAGS += PLATFORM=vexpress-qemu_virt
104optee-os: optee-os-common
Joakim Bech427dd632015-05-04 15:52:33 +0200105
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200106OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=vexpress-qemu_virt
107optee-os-clean: optee-os-clean-common
Joakim Bech427dd632015-05-04 15:52:33 +0200108
Pascal Brand070d9552015-09-01 15:33:22 +0200109optee-client: optee-client-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200110
Pascal Brand070d9552015-09-01 15:33:22 +0200111optee-client-clean: optee-client-clean-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200112
Joakim Bech427dd632015-05-04 15:52:33 +0200113################################################################################
114# Soc-term
115################################################################################
116soc-term:
Jerome Forissier2660ff22015-09-03 10:20:00 +0200117 $(MAKE) -C $(SOC_TERM_PATH)
Joakim Bech427dd632015-05-04 15:52:33 +0200118
119soc-term-clean:
Jerome Forissier2660ff22015-09-03 10:20:00 +0200120 $(MAKE) -C $(SOC_TERM_PATH) clean
Joakim Bech427dd632015-05-04 15:52:33 +0200121
122################################################################################
123# xtest / optee_test
124################################################################################
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200125xtest: xtest-common
Joakim Bech427dd632015-05-04 15:52:33 +0200126
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200127xtest-clean: xtest-clean-common
Pascal Brandeab35592015-07-10 15:07:02 +0200128
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200129xtest-patch: xtest-patch-common
Pascal Brandeab35592015-07-10 15:07:02 +0200130
Joakim Bech427dd632015-05-04 15:52:33 +0200131################################################################################
Igor Opaniuk584efe52017-08-07 01:41:48 +0300132# Sample applications / optee_examples
Victor Chong8519bcf2016-07-15 08:43:03 +0100133################################################################################
Igor Opaniuk584efe52017-08-07 01:41:48 +0300134optee-examples: optee-examples-common
Victor Chong8519bcf2016-07-15 08:43:03 +0100135
Igor Opaniuk584efe52017-08-07 01:41:48 +0300136optee-examples-clean: optee-examples-clean-common
Victor Chong8519bcf2016-07-15 08:43:03 +0100137
138################################################################################
Igor Opaniuk27edfc72016-10-25 18:33:54 +0300139# benchmark
140################################################################################
141benchmark-app: benchmark-app-common
142
143benchmark-app-clean: benchmark-app-clean-common
144
145################################################################################
Joakim Bech427dd632015-05-04 15:52:33 +0200146# Root FS
147################################################################################
Etienne Carriere5e113512016-10-21 10:13:57 +0200148filelist-tee: filelist-tee-common
Joakim Bech427dd632015-05-04 15:52:33 +0200149
Etienne Carriere5e113512016-10-21 10:13:57 +0200150update_rootfs: update_rootfs-common
Joakim Bech427dd632015-05-04 15:52:33 +0200151
152################################################################################
153# Run targets
154################################################################################
Joakim Bech427dd632015-05-04 15:52:33 +0200155.PHONY: run
156# This target enforces updating root fs etc
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200157run: all
158 $(MAKE) run-only
Joakim Bech427dd632015-05-04 15:52:33 +0200159
160.PHONY: run-only
161run-only:
Jerome Forissierefd56292017-01-31 17:46:10 +0100162 $(call check-terminal)
Joakim Bech427dd632015-05-04 15:52:33 +0200163 $(call run-help)
SY Chiuc8d61452015-09-17 16:42:17 +0800164 $(call launch-terminal,54320,"Normal World")
165 $(call launch-terminal,54321,"Secure World")
Peter Maydellc8bcc902015-10-29 16:31:52 +0000166 $(call wait-for-ports,54320,54321)
Joakim Bech427dd632015-05-04 15:52:33 +0200167 $(QEMU_PATH)/arm-softmmu/qemu-system-arm \
168 -nographic \
169 -serial tcp:localhost:54320 -serial tcp:localhost:54321 \
Victor Chong6f0c0eb2016-01-24 07:43:33 +0000170 -s -S -machine virt -machine secure=on -cpu cortex-a15 \
Joakim Bech427dd632015-05-04 15:52:33 +0200171 -m 1057 \
Igor Opaniuk97d05292016-10-26 14:46:14 +0300172 -bios $(ROOT)/out/bios-qemu/bios.bin \
173 $(QEMU_EXTRA_ARGS)
Joakim Bech427dd632015-05-04 15:52:33 +0200174
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200175
176ifneq ($(filter check,$(MAKECMDGOALS)),)
177CHECK_DEPS := all
178endif
179
Jerome Forissier7a9463c2015-08-20 10:53:48 +0200180check-args := --bios $(ROOT)/out/bios-qemu/bios.bin
181ifneq ($(TIMEOUT),)
182check-args += --timeout $(TIMEOUT)
183endif
184
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200185check: $(CHECK_DEPS)
Jerome Forissier7a9463c2015-08-20 10:53:48 +0200186 expect qemu-check.exp -- $(check-args) || \
Jerome Forissier2660ff22015-09-03 10:20:00 +0200187 (if [ "$(DUMP_LOGS_ON_ERROR)" ]; then \
188 echo "== $$PWD/serial0.log:"; \
189 cat serial0.log; \
190 echo "== end of $$PWD/serial0.log:"; \
191 echo "== $$PWD/serial1.log:"; \
192 cat serial1.log; \
193 echo "== end of $$PWD/serial1.log:"; \
194 fi; false)
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200195
196check-only: check
197
198check-clean:
199 rm -f serial0.log serial1.log