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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
#
# Copyright (C) 2017 Hauke Mehrtens
# Copyright (C) 2021-2023 Daniel Golle
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=arm-trusted-firmware-mediatek
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
PKG_SOURCE_DATE:=2023-07-24
PKG_SOURCE_VERSION:=00ac6db375b76e57e1f5e9e9bffa033e907c3581
PKG_MIRROR_HASH:=74fc18395532c4292f530da8d00fa1873ada4e05e600c0077a7b7f85ace0d913
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/trusted-firmware-a.mk
include $(INCLUDE_DIR)/package.mk
define Trusted-Firmware-A/Default
BUILD_TARGET:=mediatek
TFA_IMAGE:=bl2.img bl31.bin
BOOT_DEVICE:=
DDR3_FLYBY:=
DDR_TYPE:=
NAND_TYPE:=
BOARD_QFN:=
DRAM_USE_COMB:=
endef
define Trusted-Firmware-A/mt7622-nor-1ddr
NAME:=MediaTek MT7622 (SPI-NOR, 1x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=nor
endef
define Trusted-Firmware-A/mt7622-nor-2ddr
NAME:=MediaTek MT7622 (SPI-NOR, 2x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=nor
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-snand-1ddr
NAME:=MediaTek MT7622 (SPI-NAND, 1x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=snand
endef
define Trusted-Firmware-A/mt7622-snand-2ddr
NAME:=MediaTek MT7622 (SPI-NAND, 2x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=snand
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-emmc-1ddr
NAME:=MediaTek MT7622 (eMMC, 1x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=emmc
endef
define Trusted-Firmware-A/mt7622-emmc-2ddr
NAME:=MediaTek MT7622 (eMMC, 2x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=emmc
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-sdmmc-1ddr
NAME:=MediaTek MT7622 (SD card, 1x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=sdmmc
endef
define Trusted-Firmware-A/mt7622-sdmmc-2ddr
NAME:=MediaTek MT7622 (SD card, 2x DDR3)
BUILD_SUBTARGET:=mt7622
PLAT:=mt7622
BOOT_DEVICE:=sdmmc
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7981-nor-ddr3
NAME:=MediaTek MT7981 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-emmc-ddr3
NAME:=MediaTek MT7981 (eMMC, DDR3)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-sdmmc-ddr3
NAME:=MediaTek MT7981 (SD card, DDR3)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-snand-ddr3
NAME:=MediaTek MT7981 (SPI-NAND via SNFI, DDR3)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7981-spim-nand-ddr3
NAME:=MediaTek MT7981 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7981
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-nor-ddr4
NAME:=MediaTek MT7986 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7986-emmc-ddr4
NAME:=MediaTek MT7986 (eMMC, DDR4)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7986-sdmmc-ddr4
NAME:=MediaTek MT7986 (SD card, DDR4)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7986-snand-ddr4
NAME:=MediaTek MT7986 (SPI-NAND via SNFI, DDR4)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7986-spim-nand-ddr4
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr4
NAND_TYPE:=spim:2k+64
endef
define Trusted-Firmware-A/mt7986-nor-ddr3
NAME:=MediaTek MT7986 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-emmc-ddr3
NAME:=MediaTek MT7986 (eMMC, DDR3)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-sdmmc-ddr3
NAME:=MediaTek MT7986 (SD card, DDR3)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-snand-ddr3
NAME:=MediaTek MT7986 (SPI-NAND via SNFI, DDR3)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7986-spim-nand-ddr3
NAME:=MediaTek MT7986 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7986
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-nor-ddr3
NAME:=MediaTek MT7988 (SPI-NOR, DDR3)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-emmc-ddr3
NAME:=MediaTek MT7988 (eMMC, DDR3)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-sdmmc-ddr3
NAME:=MediaTek MT7988 (SD card, DDR3)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-snand-ddr3
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR3)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-spim-nand-ddr3
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR3)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr3
endef
define Trusted-Firmware-A/mt7988-nor-ddr4
NAME:=MediaTek MT7988 (SPI-NOR, DDR4)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-emmc-ddr4
NAME:=MediaTek MT7988 (eMMC, DDR4)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-sdmmc-ddr4
NAME:=MediaTek MT7988 (SD card, DDR4)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-snand-ddr4
NAME:=MediaTek MT7988 (SPI-NAND via SNFI, DDR4)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-spim-nand-ddr4
NAME:=MediaTek MT7988 (SPI-NAND via SPIM, DDR4)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DDR_TYPE:=ddr4
endef
define Trusted-Firmware-A/mt7988-nor-comb
NAME:=MediaTek MT7988 (SPI-NOR)
BOOT_DEVICE:=nor
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-emmc-comb
NAME:=MediaTek MT7988 (eMMC)
BOOT_DEVICE:=emmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-sdmmc-comb
NAME:=MediaTek MT7988 (SD card)
BOOT_DEVICE:=sdmmc
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-snand-comb
NAME:=MediaTek MT7988 (SPI-NAND via SNFI)
BOOT_DEVICE:=snand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
define Trusted-Firmware-A/mt7988-spim-nand-comb
NAME:=MediaTek MT7988 (SPI-NAND via SPIM)
BOOT_DEVICE:=spim-nand
BUILD_SUBTARGET:=filogic
PLAT:=mt7988
DRAM_USE_COMB:=1
endef
TFA_TARGETS:= \
mt7622-nor-1ddr \
mt7622-nor-2ddr \
mt7622-snand-1ddr \
mt7622-snand-2ddr \
mt7622-emmc-1ddr \
mt7622-emmc-2ddr \
mt7622-sdmmc-1ddr \
mt7622-sdmmc-2ddr \
mt7981-emmc-ddr3 \
mt7981-nor-ddr3 \
mt7981-sdmmc-ddr3 \
mt7986-snand-ddr3 \
mt7981-spim-nand-ddr3 \
mt7986-emmc-ddr3 \
mt7986-nor-ddr3 \
mt7986-sdmmc-ddr3 \
mt7986-snand-ddr3 \
mt7986-spim-nand-ddr3 \
mt7986-emmc-ddr4 \
mt7986-nor-ddr4 \
mt7986-sdmmc-ddr4 \
mt7986-snand-ddr4 \
mt7986-spim-nand-ddr4 \
mt7988-emmc-ddr3 \
mt7988-nor-ddr3 \
mt7988-sdmmc-ddr3 \
mt7988-snand-ddr3 \
mt7988-spim-nand-ddr3 \
mt7988-emmc-ddr4 \
mt7988-nor-ddr4 \
mt7988-sdmmc-ddr4 \
mt7988-snand-ddr4 \
mt7988-spim-nand-ddr4 \
mt7988-emmc-comb \
mt7988-nor-comb \
mt7988-sdmmc-comb \
mt7988-snand-comb \
mt7988-spim-nand-comb
TFA_MAKE_FLAGS += \
BOOT_DEVICE=$(BOOT_DEVICE) \
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
$(if $(findstring ddr4,$(DDR_TYPE)),DRAM_USE_DDR4=1) \
$(if $(BOARD_QFN),BOARD_QFN=1,BOARD_BGA=1) \
$(if $(NAND_TYPE),NAND_TYPE=$(NAND_TYPE)) \
HAVE_DRAM_OBJ_FILE=yes \
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
$(if $(DRAM_USE_COMB),DRAM_USE_COMB=1) \
all
define Package/trusted-firmware-a/install
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl2.img $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.img
$(INSTALL_DATA) $(PKG_BUILD_DIR)/build/$(PLAT)/release/bl31.bin $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31.bin
endef
$(eval $(call BuildPackage/Trusted-Firmware-A))
|