-
Notifications
You must be signed in to change notification settings - Fork 219
/
juno.mk
151 lines (116 loc) · 5.1 KB
/
juno.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
################################################################################
# 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
################################################################################
override COMPILE_NS_USER := 64
override COMPILE_NS_KERNEL := 64
override COMPILE_S_USER := 64
override COMPILE_S_KERNEL := 64
OPTEE_OS_PLATFORM = vexpress-juno
include common.mk
################################################################################
# Paths to git projects and various binaries
################################################################################
TF_A_PATH ?= $(ROOT)/trusted-firmware-a
U-BOOT_PATH ?= $(ROOT)/u-boot
U-BOOT_BIN ?= $(U-BOOT_PATH)/u-boot.bin
SCP_BLX_URL ?= https://downloads.trustedfirmware.org/tf-a/css_scp_2.8.0/juno
################################################################################
# Targets
################################################################################
all: scp-blx arm-tf u-boot linux optee-os buildroot
clean: scp-blx-clean arm-tf-clean buildroot-clean u-boot-clean optee-os-clean
include toolchain.mk
################################################################################
# SCP BL1 and BL2
################################################################################
.PHONY: scp-blx
scp-blx: $(ROOT)/out-firmware/scp_bl1.bin $(ROOT)/out-firmware/scp_bl2.bin
.PHONY: scp-blx
scp-blx-clean:
@rm -f $(ROOT)/out-firmware/scp_bl1.bin
@rm -f $(ROOT)/out-firmware/scp_bl2.bin
@rm -f $(ROOT)/out-firmware/tmp/scp_bl1.bin
@rm -f $(ROOT)/out-firmware/tmp/scp_bl2.bin
define dlscp
@mkdir -p $(ROOT)/out-firmware/tmp
@rm -f $(ROOT)/out-firmware/tmp/$1
@rm -f $(ROOT)/out-firmware/$1
@(cd $(ROOT)/out-firmware/tmp/ && wget $(SCP_BLX_URL)/$1)
@(echo $2 $(ROOT)/out-firmware/tmp/$1 | sha256sum -c)
@(mv $(ROOT)/out-firmware/tmp/$1 $(ROOT)/out-firmware/$1)
endef
$(ROOT)/out-firmware/scp_bl1.bin:
$(call dlscp,scp_bl1.bin,1c690a7d93c82d39d18b720920ced7a712fdcfc744224b4f067e56013522fece)
$(ROOT)/out-firmware/scp_bl2.bin:
$(call dlscp,scp_bl2.bin,533eb4a3f9d91e759b98288edf4c1441abe6f7fbc5da87825a8f1bb1b7942aa5)
################################################################################
# ARM Trusted Firmware
################################################################################
TF_A_EXPORTS ?= \
CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
TF_A_FLAGS ?= \
SCP_BL2=$(ROOT)/out-firmware/scp_bl2.bin \
BL32=$(OPTEE_OS_HEADER_V2_BIN) \
BL32_EXTRA1=$(OPTEE_OS_PAGER_V2_BIN) \
BL32_EXTRA2=$(OPTEE_OS_PAGEABLE_V2_BIN) \
BL33=$(U-BOOT_BIN) \
DEBUG=0 \
ARM_TSP_RAM_LOCATION=dram \
PLAT=juno \
SPD=opteed
arm-tf: scp-blx optee-os u-boot
$(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) all fip
arm-tf-clean:
$(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) clean
################################################################################
# Das U-Boot
################################################################################
U-BOOT_EXPORTS ?= CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
U-BOOT_DEFCONFIG_FILES := \
$(U-BOOT_PATH)/configs/vexpress_aemv8a_juno_defconfig \
$(ROOT)/build/kconfigs/u-boot_juno.conf
.PHONY: u-boot
u-boot:
cd $(U-BOOT_PATH) && \
scripts/kconfig/merge_config.sh $(U-BOOT_DEFCONFIG_FILES)
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all
u-boot-clean:
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean
################################################################################
# Linux kernel
################################################################################
LINUX_DEFCONFIG_COMMON_ARCH := arm64
LINUX_DEFCONFIG_COMMON_FILES := \
$(LINUX_PATH)/arch/arm64/configs/defconfig \
$(CURDIR)/kconfigs/juno.conf
linux-defconfig: $(LINUX_PATH)/.config
LINUX_COMMON_FLAGS += ARCH=arm64
linux: linux-common
linux-defconfig-clean: linux-defconfig-clean-common
LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64
linux-clean: linux-clean-common
LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64
linux-cleaner: linux-cleaner-common
################################################################################
# OP-TEE
################################################################################
optee-os: optee-os-common
optee-os-clean: optee-os-clean-common
$(ROOT)/out-br/images/ramdisk.img: $(ROOT)/out-br/images/rootfs.cpio.gz
$(U-BOOT_PATH)/tools/mkimage -A arm64 -O linux -T ramdisk -C gzip \
-d $< $@
FTP-UPLOAD = ftp-upload -v --host $(JUNO_IP) --dir SOFTWARE
.PHONY: flash
flash: $(ROOT)/out-br/images/ramdisk.img
@test -n "$(JUNO_IP)" || \
(echo "JUNO_IP not set" ; exit 1)
$(FTP-UPLOAD) $(ROOT)/out-firmware/scp_bl1.bin
$(FTP-UPLOAD) $(TF_A_PATH)/build/juno/release/bl1.bin
$(FTP-UPLOAD) $(TF_A_PATH)/build/juno/release/fip.bin
$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/Image
$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/dts/arm/juno.dtb
$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/dts/arm/juno-r1.dtb
$(FTP-UPLOAD) $(ROOT)/linux/arch/arm64/boot/dts/arm/juno-r2.dtb
$(FTP-UPLOAD) $(ROOT)/out-br/images/ramdisk.img