forked from OP-TEE/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synquacer.mk
128 lines (109 loc) · 3.77 KB
/
synquacer.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
################################################################################
# Following variables defines how the NS_USER (Non-Secure User - Client
# Application), NS_KERNEL (Non-Secure Kernel), S_KERNEL (Secure Kernel) and
# S_USER (Secure User - TA) are compiled
################################################################################
COMPILE_NS_USER ?= 64
COMPILE_NS_KERNEL ?= 64
COMPILE_S_USER ?= 64
COMPILE_S_KERNEL ?= 64
################################################################################
# Includes
################################################################################
include common.mk
include toolchain.mk
ifeq ($(DEBUG),1)
TFA_BUILD ?= debug
else
TFA_BUILD ?= release
endif
ifeq ($(DEBUG),1)
EDK2_BUILD ?= DEBUG
else
EDK2_BUILD ?= RELEASE
endif
################################################################################
# Paths to git projects and various binaries
################################################################################
TFA_PATH ?= $(ROOT)/trusted-firmware-a
TFA_OUT ?= $(TFA_PATH)/build/synquacer/$(TFA_BUILD)
TFA_BL31 ?= $(TFA_OUT)/bl31.bin
TFA_BL32 ?= $(TFA_OUT)/bl32.bin
TFA_FIP ?= $(TFA_OUT)/fip_all_arm_tf.bin
FIPTOOL ?= $(TFA_PATH)/tools/fiptool/fiptool
EDK2_PATH ?= $(ROOT)/edk2
EDK2_PLATFORMS_PATH ?= $(ROOT)/edk2-platforms
EDK2_NON_OSI_PATH ?= $(ROOT)/edk2-non-osi
EDK2_PKGS_PATH := "$(EDK2_PATH):$(EDK2_PLATFORMS_PATH):$(EDK2_NON_OSI_PATH)"
EDK2_FIP ?= $(EDK2_NON_OSI_PATH)/Platform/Socionext/DeveloperBox/fip_all_arm_tf.bin
EDK2_TOOLCHAIN ?= GCC5
EDK2_ARCH ?= AARCH64
################################################################################
# Targets
################################################################################
.PHONY: all
all: edk2 optee-os tfa
.PHONY: clean
clean: edk2-clean optee-os-clean tfa-clean
################################################################################
# Trusted Firmware A
################################################################################
TFA_EXPORTS ?= \
CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
TFA_FLAGS ?= \
BL32=$(TFA_BL32) \
PRELOADED_BL33_BASE=0x08200000 \
DEBUG=$(DEBUG) \
PLAT=synquacer \
SPD=opteed
.PHONY: tfa
tfa: $(TFA_FIP)
.PHONY: tfa-clean
tfa-clean:
$(TFA_EXPORTS) $(MAKE) -C $(TFA_PATH) $(TFA_FLAGS) clean
$(TFA_FIP): $(TFA_BL32)
$(TFA_EXPORTS) $(MAKE) -C $(TFA_PATH) $(TFA_FLAGS) all fiptool
$(FIPTOOL) create \
--tb-fw $(TFA_BL31) \
--soc-fw $(TFA_BL31) \
--scp-fw $(TFA_BL31) \
--tos-fw $< \
$@
$(TFA_BL32): optee-os
mkdir -p $(dir $@)
$(AARCH64_CROSS_COMPILE)objcopy \
-O binary $(OPTEE_OS_PATH)/out/arm/core/tee.elf $@
################################################################################
# EDK2 / Tianocore
################################################################################
define edk2-env
export WORKSPACE=$(EDK2_PLATFORMS_PATH)
endef
define edk2-call
$(EDK2_TOOLCHAIN)_$(EDK2_ARCH)_PREFIX=$(AARCH64_CROSS_COMPILE) \
build -n `getconf _NPROCESSORS_ONLN` \
-a $(EDK2_ARCH) -t $(EDK2_TOOLCHAIN) -b $(EDK2_BUILD) \
-p Platform/Socionext/DeveloperBox/DeveloperBox.dsc
endef
.PHONY: edk2
edk2: $(EDK2_FIP)
$(call edk2-env) && \
export PACKAGES_PATH=$(EDK2_PKGS_PATH) && \
source $(EDK2_PATH)/edksetup.sh && \
$(MAKE) -j1 -C $(EDK2_PATH)/BaseTools && \
$(call edk2-call) all
.PHONY: edk2-clean
edk2-clean: edk2-clean-common
cd $(EDK2_NON_OSI_PATH) && \
git checkout $(EDK2_FIP)
$(EDK2_FIP): $(TFA_FIP)
cp $< $@
################################################################################
# OP-TEE
################################################################################
OPTEE_OS_COMMON_FLAGS += PLATFORM=synquacer
OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=synquacer
.PHONY: optee-os
optee-os: optee-os-common
.PHONY: optee-os-clean
optee-os-clean: optee-os-clean-common