blob: b4f254330721951ceb9f04033b51b52f4e95ba52 [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
30all: bios-qemu qemu soc-term
Victor Chong5fc1f852017-05-22 07:30:47 +010031clean: bios-qemu-clean busybox-clean linux-clean optee-os-clean \
Igor Opaniuk4f667cd2017-05-31 14:11:56 +030032 optee-client-clean qemu-clean soc-term-clean check-clean
Joakim Bech427dd632015-05-04 15:52:33 +020033
34-include toolchain.mk
35
36################################################################################
37# QEMU
38################################################################################
39define bios-qemu-common
Jerome Forissier2660ff22015-09-03 10:20:00 +020040 +$(MAKE) -C $(BIOS_QEMU_PATH) \
41 CROSS_COMPILE=$(CROSS_COMPILE_NS_USER) \
Joakim Bech427dd632015-05-04 15:52:33 +020042 O=$(ROOT)/out/bios-qemu \
43 BIOS_NSEC_BLOB=$(LINUX_PATH)/arch/arm/boot/zImage \
44 BIOS_NSEC_ROOTFS=$(GEN_ROOTFS_PATH)/filesystem.cpio.gz \
45 BIOS_SECURE_BLOB=$(OPTEE_OS_BIN) \
46 PLATFORM_FLAVOR=virt
47endef
48
Jerome Forissier2660ff22015-09-03 10:20:00 +020049bios-qemu: update_rootfs optee-os
Joakim Bech427dd632015-05-04 15:52:33 +020050 $(call bios-qemu-common)
51
52bios-qemu-clean:
53 $(call bios-qemu-common) clean
54
55qemu:
Igor Opaniuk97d05292016-10-26 14:46:14 +030056 cd $(QEMU_PATH); ./configure --target-list=arm-softmmu\
57 $(QEMU_CONFIGURE_PARAMS_COMMON)
Jerome Forissier2660ff22015-09-03 10:20:00 +020058 $(MAKE) -C $(QEMU_PATH)
Joakim Bech427dd632015-05-04 15:52:33 +020059
60qemu-clean:
Jerome Forissier2660ff22015-09-03 10:20:00 +020061 $(MAKE) -C $(QEMU_PATH) distclean
Joakim Bech427dd632015-05-04 15:52:33 +020062
63################################################################################
64# Busybox
65################################################################################
Pascal Brand440ef9c2015-09-08 16:01:58 +020066BUSYBOX_COMMON_TARGET = vexpress
67BUSYBOX_CLEAN_COMMON_TARGET = vexpress clean
Joakim Bech427dd632015-05-04 15:52:33 +020068
Pascal Brand440ef9c2015-09-08 16:01:58 +020069busybox: busybox-common
Joakim Bech427dd632015-05-04 15:52:33 +020070
Pascal Brand440ef9c2015-09-08 16:01:58 +020071busybox-clean: busybox-clean-common
72
73busybox-cleaner: busybox-cleaner-common
Joakim Bech427dd632015-05-04 15:52:33 +020074
75################################################################################
76# Linux kernel
77################################################################################
Jerome Forissiere1002382015-11-26 11:36:00 +010078LINUX_DEFCONFIG_COMMON_ARCH := arm
79LINUX_DEFCONFIG_COMMON_FILES := \
80 $(LINUX_PATH)/arch/arm/configs/vexpress_defconfig \
81 $(CURDIR)/kconfigs/qemu.conf
Joakim Bech427dd632015-05-04 15:52:33 +020082
83linux-defconfig: $(LINUX_PATH)/.config
84
Pascal Brande3d85982015-09-10 17:20:42 +020085LINUX_COMMON_FLAGS += ARCH=arm
Joakim Bech427dd632015-05-04 15:52:33 +020086
Pascal Brande3d85982015-09-10 17:20:42 +020087linux: linux-common
88
89linux-defconfig-clean: linux-defconfig-clean-common
90
91LINUX_CLEAN_COMMON_FLAGS += ARCH=arm
92
93linux-clean: linux-clean-common
94
95LINUX_CLEANER_COMMON_FLAGS += ARCH=arm
96
97linux-cleaner: linux-cleaner-common
Joakim Bech427dd632015-05-04 15:52:33 +020098
99################################################################################
100# OP-TEE
101################################################################################
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200102OPTEE_OS_COMMON_FLAGS += PLATFORM=vexpress-qemu_virt
103optee-os: optee-os-common
Joakim Bech427dd632015-05-04 15:52:33 +0200104
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200105OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=vexpress-qemu_virt
106optee-os-clean: optee-os-clean-common
Joakim Bech427dd632015-05-04 15:52:33 +0200107
Pascal Brand070d9552015-09-01 15:33:22 +0200108optee-client: optee-client-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200109
Pascal Brand070d9552015-09-01 15:33:22 +0200110optee-client-clean: optee-client-clean-common
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200111
Joakim Bech427dd632015-05-04 15:52:33 +0200112################################################################################
113# Soc-term
114################################################################################
115soc-term:
Jerome Forissier2660ff22015-09-03 10:20:00 +0200116 $(MAKE) -C $(SOC_TERM_PATH)
Joakim Bech427dd632015-05-04 15:52:33 +0200117
118soc-term-clean:
Jerome Forissier2660ff22015-09-03 10:20:00 +0200119 $(MAKE) -C $(SOC_TERM_PATH) clean
Joakim Bech427dd632015-05-04 15:52:33 +0200120
121################################################################################
122# xtest / optee_test
123################################################################################
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200124xtest: xtest-common
Joakim Bech427dd632015-05-04 15:52:33 +0200125
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200126xtest-clean: xtest-clean-common
Pascal Brandeab35592015-07-10 15:07:02 +0200127
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200128xtest-patch: xtest-patch-common
Pascal Brandeab35592015-07-10 15:07:02 +0200129
Joakim Bech427dd632015-05-04 15:52:33 +0200130################################################################################
Victor Chong8519bcf2016-07-15 08:43:03 +0100131# hello_world
132################################################################################
133helloworld: helloworld-common
134
135helloworld-clean: helloworld-clean-common
136
137################################################################################
Igor Opaniuk27edfc72016-10-25 18:33:54 +0300138# benchmark
139################################################################################
140benchmark-app: benchmark-app-common
141
142benchmark-app-clean: benchmark-app-clean-common
143
144################################################################################
Joakim Bech427dd632015-05-04 15:52:33 +0200145# Root FS
146################################################################################
Etienne Carriere5e113512016-10-21 10:13:57 +0200147filelist-tee: filelist-tee-common
Joakim Bech427dd632015-05-04 15:52:33 +0200148
Etienne Carriere5e113512016-10-21 10:13:57 +0200149update_rootfs: update_rootfs-common
Joakim Bech427dd632015-05-04 15:52:33 +0200150
151################################################################################
152# Run targets
153################################################################################
Joakim Bech427dd632015-05-04 15:52:33 +0200154.PHONY: run
155# This target enforces updating root fs etc
Jerome Forissierae45fbf2015-09-04 09:40:17 +0200156run: all
157 $(MAKE) run-only
Joakim Bech427dd632015-05-04 15:52:33 +0200158
159.PHONY: run-only
160run-only:
Jerome Forissierefd56292017-01-31 17:46:10 +0100161 $(call check-terminal)
Joakim Bech427dd632015-05-04 15:52:33 +0200162 $(call run-help)
SY Chiuc8d61452015-09-17 16:42:17 +0800163 $(call launch-terminal,54320,"Normal World")
164 $(call launch-terminal,54321,"Secure World")
Peter Maydellc8bcc902015-10-29 16:31:52 +0000165 $(call wait-for-ports,54320,54321)
Joakim Bech427dd632015-05-04 15:52:33 +0200166 $(QEMU_PATH)/arm-softmmu/qemu-system-arm \
167 -nographic \
168 -serial tcp:localhost:54320 -serial tcp:localhost:54321 \
Victor Chong6f0c0eb2016-01-24 07:43:33 +0000169 -s -S -machine virt -machine secure=on -cpu cortex-a15 \
Joakim Bech427dd632015-05-04 15:52:33 +0200170 -m 1057 \
Igor Opaniuk97d05292016-10-26 14:46:14 +0300171 -bios $(ROOT)/out/bios-qemu/bios.bin \
172 $(QEMU_EXTRA_ARGS)
Joakim Bech427dd632015-05-04 15:52:33 +0200173
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200174
175ifneq ($(filter check,$(MAKECMDGOALS)),)
176CHECK_DEPS := all
177endif
178
Jerome Forissier7a9463c2015-08-20 10:53:48 +0200179check-args := --bios $(ROOT)/out/bios-qemu/bios.bin
180ifneq ($(TIMEOUT),)
181check-args += --timeout $(TIMEOUT)
182endif
183
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200184check: $(CHECK_DEPS)
Jerome Forissier7a9463c2015-08-20 10:53:48 +0200185 expect qemu-check.exp -- $(check-args) || \
Jerome Forissier2660ff22015-09-03 10:20:00 +0200186 (if [ "$(DUMP_LOGS_ON_ERROR)" ]; then \
187 echo "== $$PWD/serial0.log:"; \
188 cat serial0.log; \
189 echo "== end of $$PWD/serial0.log:"; \
190 echo "== $$PWD/serial1.log:"; \
191 cat serial1.log; \
192 echo "== end of $$PWD/serial1.log:"; \
193 fi; false)
Jerome Forissierf080b5a2015-08-07 16:18:57 +0200194
195check-only: check
196
197check-clean:
198 rm -f serial0.log serial1.log