blob: 91b7c03f29a29fdf6116012ae01692b8c329e473 [file] [log] [blame]
Andrew F. Davis830ceed2016-12-13 16:32:08 -06001###############################################################################
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
10
11###############################################################################
12# Includes
13###############################################################################
14-include common.mk
15
16###############################################################################
17# Paths to git projects and various binaries
18###############################################################################
19STAGING_AREA ?= $(ROOT)/out
20U-BOOT_PATH ?= $(ROOT)/u-boot
21UBOOT_SPL ?= $(U-BOOT_PATH)/u-boot-spl_HS_MLO
22UBOOT_IMG ?= $(U-BOOT_PATH)/u-boot_HS.img
23UBOOT_ENV ?= $(BUILD_PATH)/dra7xx/uEnv.txt
24LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm/boot/zImage
25LINUX_DTBS ?= $(wildcard $(LINUX_PATH)/arch/arm/boot/dts/dra7*.dtb)
26FIT_SOURCE ?= $(BUILD_PATH)/dra7xx/fitImage.its
27FIT_MAKEFILE ?= $(BUILD_PATH)/dra7xx/Makefile
28
29###############################################################################
30# Targets
31###############################################################################
32.PHONY: all clean cleaner prepare
33
34all: u-boot linux optee-os optee-client xtest helloworld build-fit update_rootfs
35clean: linux-clean busybox-clean u-boot-clean optee-os-clean optee-client-clean build-fit-clean
36cleaner: clean prepare-cleaner busybox-cleaner linux-cleaner
37
38-include toolchain.mk
39
40prepare:
41 @if [ ! -d $(STAGING_AREA) ]; then mkdir $(STAGING_AREA); fi
42
43.PHONY: prepare-cleaner
44prepare-cleaner:
45 rm -rf $(STAGING_AREA)
46
47###############################################################################
48# Das U-Boot
49###############################################################################
50.PHONY: u-boot u-boot-clean
51
52U-BOOT_EXPORTS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) ARCH=arm
53
54u-boot:
55 $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) dra7xx_hs_evm_defconfig
56 $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all
57
58u-boot-clean:
59 $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean
60
61###############################################################################
62# Linux kernel
63###############################################################################
64.PHONY: linux-defconfig linux linux-defconfig-clean linux-clean linux-cleaner
65
66LINUX_DEFCONFIG_COMMON_ARCH := arm
67LINUX_DEFCONFIG_COMMON_FILES := \
68 $(LINUX_PATH)/arch/arm/configs/multi_v7_defconfig \
69 $(LINUX_PATH)/ti_config_fragments/multi_v7_prune.cfg \
70 $(LINUX_PATH)/ti_config_fragments/baseport.cfg \
71 $(LINUX_PATH)/ti_config_fragments/ipc.cfg \
72 $(LINUX_PATH)/ti_config_fragments/connectivity.cfg \
73 $(LINUX_PATH)/ti_config_fragments/audio_display.cfg \
74 $(LINUX_PATH)/ti_config_fragments/wlan.cfg \
75 $(LINUX_PATH)/ti_config_fragments/omap_soc.cfg \
76 $(LINUX_PATH)/ti_config_fragments/lpae.cfg \
77 $(LINUX_PATH)/ti_config_fragments/dra7_only.cfg \
78 $(LINUX_PATH)/ti_config_fragments/debug_options.cfg
79
80linux-defconfig: $(LINUX_PATH)/.config
81
82LINUX_COMMON_FLAGS += ARCH=arm
83linux: linux-common
84linux-defconfig-clean: linux-defconfig-clean-common
85
86LINUX_CLEAN_COMMON_FLAGS += ARCH=arm
87linux-clean: linux-clean-common
88
89LINUX_CLEANER_COMMON_FLAGS += ARCH=arm
90linux-cleaner: linux-cleaner-common
91
92###############################################################################
93# OP-TEE
94###############################################################################
95.PHONY: optee-os optee-os-clean optee-client optee-client-clean
96
97OPTEE_OS_COMMON_FLAGS += PLATFORM=ti-dra7xx
98optee-os: optee-os-common
99
100OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=ti-dra7xx
101optee-os-clean: optee-os-clean-common
102
103optee-client: optee-client-common
104optee-client-clean: optee-client-clean-common
105
106###############################################################################
107# xtest / optee_test
108###############################################################################
109.PHONY: xtest xtest-clean xtest-patch
110
111xtest: xtest-common
112xtest-clean: xtest-clean-common
113xtest-patch: xtest-patch-common
114
115###############################################################################
116# hello_world
117###############################################################################
118.PHONY: helloworld helloworld-clean
119
120helloworld: helloworld-common
121helloworld-clean: helloworld-clean-common
122
123###############################################################################
124# Busybox
125###############################################################################
126.PHONY: busybox busybox-clean busybox-cleaner
127
128BUSYBOX_COMMON_TARGET = dra7xx
129BUSYBOX_CLEAN_COMMON_TARGET = dra7xx clean
130
131busybox: busybox-common
132busybox-clean: busybox-clean-common
133busybox-cleaner: busybox-cleaner-common
134
135###############################################################################
136# Build FIT
137###############################################################################
138.PHONY: build-fit build-fit-clean
139
140build-fit: prepare linux optee-os
141 cp $(LINUX_IMAGE) $(STAGING_AREA)/
142 cp $(LINUX_DTBS) $(STAGING_AREA)/
143 cp $(OPTEE_OS_BIN) $(STAGING_AREA)/
144 cp $(FIT_SOURCE) $(STAGING_AREA)/
145 cp $(FIT_MAKEFILE) $(STAGING_AREA)/
146 MKIMAGE=$(U-BOOT_PATH)/tools/mkimage $(MAKE) -C $(STAGING_AREA)
147
148build-fit-clean:
149 $(RM) $(STAGING_AREA)/Makefile
150 $(RM) $(STAGING_AREA)/fitImage.its
151 $(RM) $(STAGING_AREA)/tee.bin
152 $(RM) $(STAGING_AREA)/*.dtb
153 $(RM) $(STAGING_AREA)/zImage
154
155###############################################################################
156# Root FS
157###############################################################################
158.PHONY: filelist-tee update_rootfs
159
160filelist-tee: filelist-tee-common u-boot build-fit
161 @echo "dir /boot 755 0 0" >> $(GEN_ROOTFS_FILELIST)
162 @echo "file /boot/MLO $(UBOOT_SPL) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
163 @echo "file /boot/u-boot.img $(UBOOT_IMG) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
164 @echo "file /boot/uEnv.txt $(UBOOT_ENV) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
165 @echo "file /boot/fitImage.itb $(STAGING_AREA)/fitImage.itb 644 0 0" >> $(GEN_ROOTFS_FILELIST)
166
167update_rootfs: update_rootfs-common