blob: 4533f6af14284a1ec8a1db8f89839e6513331ab4 [file] [log] [blame]
Jeremie Corbier0ea18132023-12-15 16:01:59 +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 := 64
7override COMPILE_NS_KERNEL := 64
8override COMPILE_S_USER := 64
9override COMPILE_S_KERNEL := 64
10
11WITH_CXX_TESTS = n
12
13# Network support related packages:
14BR2_PACKAGE_DHCPCD ?= y
15BR2_PACKAGE_ETHTOOL ?= y
16BR2_PACKAGE_XINETD ?= y
17
18# SSH Packages :
19BR2_PACKAGE_OPENSSH ?= y
20BR2_PACKAGE_OPENSSH_SERVER ?= y
21BR2_PACKAGE_OPENSSH_KEY_UTILS ?= y
22
23# Openssl binary
24BR2_PACKAGE_LIBOPENSSL_BIN ?= y
25
26BR2_TARGET_GENERIC_GETTY_PORT ?= ttyAMA1
27
28PLATFORM = versal-net-vnx-b2197-revA
29OPTEE_OS_PLATFORM = versal-net
30OPTEE_OS_COMMON_EXTRA_FLAGS = CFG_PKCS11_TA=y CFG_USER_TA_TARGET_pkcs11=ta_arm64 O=out/arm
31
32################################################################################
33# Paths to git projects and various binaries
34################################################################################
35TF_A_PATH ?= $(ROOT)/arm-trusted-firmware
36U-BOOT_PATH ?= $(ROOT)/u-boot
37BOOTGEN_PATH ?= $(ROOT)/bootgen
38LINUX_PATH ?= $(ROOT)/linux
39
40include common.mk
41
42################################################################################
43# Targets
44################################################################################
45
46all: tfa optee-os u-boot linux dtbo buildroot
47clean: tfa-clean optee-os-clean u-boot-clean linux-clean dtbo-clean buildroot-clean
48
49include toolchain.mk
50
51################################################################################
52# ARM Trusted Firmware
53################################################################################
54
55TF_A_EXPORTS = CROSS_COMPILE="$(AARCH64_CROSS_COMPILE)" \
56 CC="$(CCACHE)$(AARCH64_CROSS_COMPILE)gcc" \
57 LD="$(CCACHE)$(AARCH64_CROSS_COMPILE)ld"
58TF_A_FLAGS = PLAT=versal_net VERSAL_NET_CONSOLE=pl011 RESET_TO_BL31=1 SPD=opteed DEBUG=1 \
59 VERSAL_NET_ATF_MEM_BASE=0x26200000 VERSAL_NET_ATF_MEM_SIZE=0x100000
60
61tfa:
62 $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) bl31
63
64tfa-clean:
65 $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) clean
66
67################################################################################
68# OP-TEE
69#################################################################################
70
71optee-os: optee-os-common
72
73optee-os-clean: optee-os-clean-common
74
75################################################################################
76# U-Boot
77################################################################################
78
79U-BOOT_EXPORTS = CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
80U-BOOT_DTS = xilinx-versal-net-virt
81U-BOOT_DEFCONFIG_COMMON_FILES = \
82 $(UBOOT_PATH)/configs/xilinx_versal_net_virt_defconfig \
83 $(CURDIR)/kconfigs/versal.conf
84
85$(UBOOT_PATH)/.config: $(U-BOOT_CONFIG_COMMON_FILES)
86 cd $(UBOOT_PATH) && \
87 $(U-BOOT_EXPORTS) \
88 scripts/kconfig/merge_config.sh $(U-BOOT_DEFCONFIG_COMMON_FILES)
89
90u-boot: u-boot-defconfig
91 $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) DEVICE_TREE=$(U-BOOT_DTS) DTC_FLAGS="-@"
92
93u-boot-clean: u-boot-defconfig-clean
94 $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean
95
96u-boot-defconfig: $(UBOOT_PATH)/.config
97
98.PHONY: u-boot-defconfig-clean
99u-boot-defconfig-clean:
100 rm -f $(UBOOT_PATH)/.config
101
102###############################################################################
103# Device-Tree
104###############################################################################
105dtbo: linux
106 ${LINUX_PATH}/scripts/dtc/dtc -@ -I dts -O dtb -o versal/versal-optee.dtbo versal/versal-optee.dtso
107
108dtbo-clean:
109 rm -f versal/versal-optee.dtbo
110
111################################################################################
112# Linux kernel
113################################################################################
114
115LINUX_DEFCONFIG_COMMON_ARCH := arm64
116LINUX_DEFCONFIG_COMMON_FILES := \
117 $(LINUX_PATH)/arch/arm64/configs/xilinx_versal_net_defconfig \
118 $(CURDIR)/kconfigs/versal.conf
119
120linux-defconfig: $(LINUX_PATH)/.config
121
122LINUX_COMMON_FLAGS += ARCH=arm64 -j8
123
124linux: linux-common
125
126linux-defconfig-clean: linux-defconfig-clean-common
127
128LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64
129
130linux-clean: linux-clean-common
131
132LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64
133
134linux-cleaner: linux-cleaner-common
135
136###############################################################################
137# Buildroot
138###############################################################################
139
140BR2_TARGET_GENERIC_ISSUE ?= "OP-TEE embedded distrib for $(PLATFORM)"
141BR2_TARGET_ROOTFS_EXT2 ?= y
142BR2_PACKAGE_BUSYBOX_WATCHDOG ?= y
143
144# TF-A, Linux kernel, U-Boot and OP-TEE OS/Client/... are not built from their
145# related Buildroot native package.
146BR2_TARGET_ARM_TRUSTED_FIRMWARE ?= n
147BR2_LINUX_KERNEL ?= n
148BR2_TARGET_OPTEE_OS ?= n
149BR2_TARGET_UBOOT ?= n
150
151
152###############################################################################
153# Images
154###############################################################################
155image: bootimage
156image-clean: bootimage-clean
157
158###############################################################################
159# Boot Image
160###############################################################################
161
162bootimage: bootgen tfa optee-os u-boot linux dtbo fitimage
163 $(BOOTGEN_PATH)/bootgen -arch versalnet -image versal/bootImage-${PLATFORM}.bif -w -o versal/BOOT.BIN
164
165bootimage-clean: bootgen-clean tfa-clean optee-os-clean u-boot-clean linux-clean dtbo-clean fitimage-clean
166 rm -f versal/BOOT.BIN
167
168
169###############################################################################
170# Bootgen
171###############################################################################
172
173bootgen:
174 make -C $(BOOTGEN_PATH)
175
176bootgen-clean:
177 make -C $(BOOTGEN_PATH) clean
178
179
180###############################################################################
181# FIT Image
182###############################################################################
183
184fitimage: buildroot
185 ${U-BOOT_PATH}/tools/mkimage -f versal/fitImage-${PLATFORM}.its versal/${PLATFORM}.ub
186
187fitimage-clean: buildroot-clean
188 rm -f versal/${PLATFORM}.ub
189