arm-trusted-firmware-mvebu: fix topology for ESPRESSObin V3-V5 (1GB 1CS)
[openwrt/openwrt.git] / package / boot / arm-trusted-firmware-mvebu / Makefile
1 #
2 # Copyright (C) 2019 Sartura Ltd.
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=arm-trusted-firmware-mvebu
11 PKG_VERSION:=2.3
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=trusted-firmware-a-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot
16 PKG_HASH:=37f917922bcef181164908c470a2f941006791c0113d738c498d39d95d543b21
17 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/trusted-firmware-a-$(PKG_VERSION)
18
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=docs/license.rst
21
22 PKG_MAINTAINER:=Vladimir Vid <vladimir.vid@sartura.hr>
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/arm-trusted-firmware-mvebu
27 SECTION:=boot
28 CATEGORY:=Boot Loaders
29 DEPENDS:=@TARGET_mvebu_cortexa53
30 VARIANT:=$(subst arm-trusted-firmware-mvebu-,,$(1))
31 endef
32
33 define Package/arm-trusted-firmware-mvebu-espressobin-512mb
34 $(Package/arm-trusted-firmware-mvebu)
35 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin (512MB)
36 DEPENDS:=+u-boot-espressobin
37 UBOOT:=espressobin
38 DDR_TOPOLOGY:=0
39 CLOCKSPRESET:=CPU_800_DDR_800
40 PLAT:=a3700
41 endef
42
43 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs
44 $(Package/arm-trusted-firmware-mvebu)
45 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 1CS)
46 DEPENDS:=+u-boot-espressobin
47 UBOOT:=espressobin
48 DDR_TOPOLOGY:=4
49 CLOCKSPRESET:=CPU_800_DDR_800
50 PLAT:=a3700
51 endef
52
53 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs-emmc
54 $(Package/arm-trusted-firmware-mvebu)
55 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 1CS, eMMC)
56 DEPENDS:=+u-boot-espressobin-emmc
57 UBOOT:=espressobin-emmc
58 DDR_TOPOLOGY:=4
59 CLOCKSPRESET:=CPU_800_DDR_800
60 PLAT:=a3700
61 endef
62
63 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs
64 $(Package/arm-trusted-firmware-mvebu)
65 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB, 2CS)
66 DEPENDS:=+u-boot-espressobin
67 UBOOT:=espressobin
68 DDR_TOPOLOGY:=2
69 CLOCKSPRESET:=CPU_800_DDR_800
70 PLAT:=a3700
71 endef
72
73 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs-emmc
74 $(Package/arm-trusted-firmware-mvebu)
75 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (1GB 2CS, eMMC)
76 DEPENDS:=+u-boot-espressobin-emmc
77 UBOOT:=espressobin-emmc
78 DDR_TOPOLOGY:=2
79 CLOCKSPRESET:=CPU_800_DDR_800
80 PLAT:=a3700
81 endef
82
83 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb
84 $(Package/arm-trusted-firmware-mvebu)
85 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (2GB)
86 DEPENDS:=+u-boot-espressobin
87 UBOOT:=espressobin
88 DDR_TOPOLOGY:=7
89 CLOCKSPRESET:=CPU_800_DDR_800
90 PLAT:=a3700
91 endef
92
93 define Package/arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb-emmc
94 $(Package/arm-trusted-firmware-mvebu)
95 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V3-V5 (2GB, eMMC)
96 DEPENDS:=+u-boot-espressobin-emmc
97 UBOOT:=espressobin-emmc
98 DDR_TOPOLOGY:=7
99 CLOCKSPRESET:=CPU_800_DDR_800
100 PLAT:=a3700
101 endef
102
103 define Package/arm-trusted-firmware-mvebu-espressobin-v7-1gb
104 $(Package/arm-trusted-firmware-mvebu)
105 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (1GB)
106 DEPENDS:=+u-boot-espressobin
107 UBOOT:=espressobin
108 DDR_TOPOLOGY:=5
109 CLOCKSPRESET:=CPU_800_DDR_800
110 PLAT:=a3700
111 endef
112
113 define Package/arm-trusted-firmware-mvebu-espressobin-v7-1gb-emmc
114 $(Package/arm-trusted-firmware-mvebu)
115 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (1GB, eMMC)
116 DEPENDS:=+u-boot-espressobin
117 UBOOT:=espressobin-emmc
118 DDR_TOPOLOGY:=5
119 CLOCKSPRESET:=CPU_800_DDR_800
120 PLAT:=a3700
121 endef
122
123 define Package/arm-trusted-firmware-mvebu-espressobin-v7-2gb
124 $(Package/arm-trusted-firmware-mvebu)
125 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (2GB)
126 DEPENDS:=+u-boot-espressobin
127 UBOOT:=espressobin
128 DDR_TOPOLOGY:=6
129 CLOCKSPRESET:=CPU_800_DDR_800
130 PLAT:=a3700
131 endef
132
133 define Package/arm-trusted-firmware-mvebu-espressobin-v7-2gb-emmc
134 $(Package/arm-trusted-firmware-mvebu)
135 TITLE:=ARM Trusted Firmware for Marvell ESPRESSObin V7 (2GB, eMMC)
136 DEPENDS:=+u-boot-espressobin
137 UBOOT:=espressobin-emmc
138 DDR_TOPOLOGY:=6
139 CLOCKSPRESET:=CPU_800_DDR_800
140 PLAT:=a3700
141 endef
142
143 define Package/arm-trusted-firmware-mvebu-udpu
144 $(Package/arm-trusted-firmware-mvebu)
145 TITLE:=ARM Trusted Firmware for Methode uDPU
146 DEPENDS:=+u-boot-uDPU
147 UBOOT:=uDPU
148 DDR_TOPOLOGY:=0
149 CLOCKSPRESET:=CPU_1000_DDR_800
150 PLAT:=a3700
151 endef
152
153 A3700_UTILS_NAME:=a3700-utils
154 A3700_UTILS_RELEASE:=09679790
155 A3700_UTILS_SOURCE=$(A3700_UTILS_NAME)-$(A3700_UTILS_RELEASE).tar.bz2
156
157 define Download/a3700-utils
158 FILE:=$(A3700_UTILS_SOURCE)
159 PROTO:=git
160 URL:=https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell.git
161 VERSION:=096797908ddd69a679fd55595c41fc02809829a9
162 MIRROR_HASH:=9276d63d41b2e221c2fd5cceee988ca26eff5005747787f084868b3940173b7a
163 SUBDIR:=$(A3700_UTILS_NAME)
164 endef
165
166 MV_DDR_NAME:=mv-ddr-marvell
167 MV_DDR_RELEASE:=mainline
168 MV_DDR_SOURCE:=$(MV_DDR_NAME)-$(MV_DDR_RELEASE).tar.bz2
169
170 define Download/mv-ddr-marvell
171 FILE:=$(MV_DDR_SOURCE)
172 PROTO:=git
173 URL:=https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git
174 VERSION:=a881467ef0f0185e6570dd0483023fde93cbb5f5
175 MIRROR_HASH:=19f34817616c583b2b5f2612705857cf2120f6c2132355217899b1403c3fd336
176 SUBDIR:=$(MV_DDR_NAME)
177 endef
178
179 LINARO_NAME:=gcc-linaro
180 LINARO_RELEASE:=6
181 LINARO_VERSION:=5.0-2018.12-$(HOST_ARCH)_arm-linux-gnueabi
182 LINARO_SOURCE=$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION).tar.xz
183
184 define Download/gcc-linaro
185 FILE:=$(LINARO_SOURCE)
186 URL:=https://releases.linaro.org/components/toolchain/binaries/latest-$(LINARO_RELEASE)/arm-linux-gnueabi/
187 HASH:=2d4a92d6c8b384ae404b2e02c1c412e3ec18f9b714135acf046b2b1b510e9ace
188 endef
189
190 define Build/Prepare
191 # Download sources
192 $(eval $(call Download,a3700-utils))
193 $(eval $(call Download,mv-ddr-marvell))
194 $(eval $(call Download,gcc-linaro))
195
196 $(call Build/Prepare/Default,)
197
198 mkdir -p $(STAGING_DIR_IMAGE)
199 $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(A3700_UTILS_SOURCE)
200 $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(MV_DDR_SOURCE)
201 $(TAR) -C $(STAGING_DIR_IMAGE) -xf $(DL_DIR)/$(LINARO_SOURCE)
202 endef
203
204 export GCC_HONOUR_COPTS=s
205
206 TARGET_CFLAGS = ""
207
208 define Build/Compile
209 $(eval $(Package/arm-trusted-firmware-mvebu-$(BUILD_VARIANT))) \
210 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
211 CROSS_COMPILE=$(TARGET_CROSS) \
212 OPENSSL_DIR=$(STAGING_DIR_HOST) \
213 CROSS_CM3=$(STAGING_DIR_IMAGE)/$(LINARO_NAME)-$(LINARO_RELEASE).$(LINARO_VERSION)/bin/arm-linux-gnueabi- \
214 BL33=$(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.bin \
215 MV_DDR_PATH=$(STAGING_DIR_IMAGE)/$(MV_DDR_NAME) \
216 WTP=$(STAGING_DIR_IMAGE)/$(A3700_UTILS_NAME) \
217 DDR_TOPOLOGY=$(DDR_TOPOLOGY) \
218 CLOCKSPRESET=$(CLOCKSPRESET) \
219 PLAT=$(PLAT) \
220 all \
221 fip
222 endef
223
224 define Build/InstallDev
225 $(INSTALL_DIR) $(BIN_DIR)/flash-image-$(BUILD_VARIANT)
226 $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/flash-image.bin $(BIN_DIR)/flash-image-$(BUILD_VARIANT)/
227 $(CP) $(PKG_BUILD_DIR)/build/$(PLAT)/release/uart-images.tgz $(BIN_DIR)/flash-image-$(BUILD_VARIANT)/
228 endef
229
230 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-512mb))
231 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs))
232 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-1cs-emmc))
233 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs))
234 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-1gb-2cs-emmc))
235 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb))
236 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v3-v5-2gb-emmc))
237 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-1gb))
238 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-1gb-emmc))
239 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-2gb))
240 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-espressobin-v7-2gb-emmc))
241 $(eval $(call BuildPackage,arm-trusted-firmware-mvebu-udpu))