aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/arm-trusted-firmware-mediatek/Makefile
blob: 41ab0aeea13d7d34227adc49f4f4c29134f6cae4 (plain)
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
#
# Copyright (C) 2017 Hauke Mehrtens
# Copyright (C) 2020 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:=$(AUTORELEASE)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
PKG_SOURCE_DATE:=2020-11-09
PKG_SOURCE_VERSION:=03017334ccd8c0fac12e7db36749b95b9a7d745f
PKG_MIRROR_HASH:=b211b2f9143d4debc7ad8dc959cb606888af20af790855dd66c87e451b6a1bc7

PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>

include $(INCLUDE_DIR)/trusted-firmware-a.mk
include $(INCLUDE_DIR)/package.mk

define Download/mt7622-header-emmc
  URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0
  URL_FILE:=header_emmc.bin
  FILE:=mt7622-header_emmc.bin
  HASH:=0a09c55d90c5fc375c59468a4331555f77cbc3e1dd107ca83b5b8c9625f38d8c
endef

define Download/mt7622-header-sdmmc
  URL:=https://raw.githubusercontent.com/frank-w/BPI-R64-ATF/a36efa5f7435b8079479d13b562fedc0aa0d42f0
  URL_FILE:=header_sdmmc.bin
  FILE:=mt7622-header_sdmmc.bin
  HASH:=242908c04e25289d25ba9fab61a1930425af173051c43d275d1ac9877d6accb1
endef

define Package/arm-trusted-firmware-mt7622/Default
  SECTION:=boot
  CATEGORY:=Boot Loaders
  TITLE:=ARM Trusted Firmware for MT7622
  DEPENDS:=@TARGET_mediatek_mt7622
endef

define Package/arm-trusted-firmware-mt7622-nor
  $(call Package/arm-trusted-firmware-mt7622/Default)
  VARIANT:=nor
endef

define Package/arm-trusted-firmware-mt7622-snand
  $(call Package/arm-trusted-firmware-mt7622/Default)
  VARIANT:=snand
endef

define Package/arm-trusted-firmware-mt7622-emmc
  $(call Package/arm-trusted-firmware-mt7622/Default)
  VARIANT:=emmc
endef

define Package/arm-trusted-firmware-mt7622-sdmmc
  $(call Package/arm-trusted-firmware-mt7622/Default)
  VARIANT:=sdmmc
endef

MAKE_VARS = \
	CROSS_COMPILE="$(TARGET_CROSS)"

MAKE_FLAGS += \
	PLAT=mt7622 \
	BOOT_DEVICE=$(BUILD_VARIANT) \
	all

define Build/Prepare
	$(call Build/Prepare/Default)
ifeq ($(BUILD_VARIANT),emmc)
	$(eval $(call Download,mt7622-header-emmc))
endif
ifeq ($(BUILD_VARIANT),sdmmc)
	$(eval $(call Download,mt7622-header-sdmmc))
endif
endef

define Build/InstallDev
	$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
	$(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.bin $(STAGING_DIR_IMAGE)/mt7622-bl2-$(BUILD_VARIANT).bin
	$(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl2.img $(STAGING_DIR_IMAGE)/mt7622-bl2-$(BUILD_VARIANT).img
# bl31.bin turns out to be identical for all build variants
	$(CP) $(PKG_BUILD_DIR)/build/mt7622/release/bl31.bin $(STAGING_DIR_IMAGE)/mt7622-bl31.bin
ifeq ($(BUILD_VARIANT),emmc)
	$(CP) $(DL_DIR)/mt7622-header_emmc.bin $(STAGING_DIR_IMAGE)
endif
ifeq ($(BUILD_VARIANT),sdmmc)
	$(CP) $(DL_DIR)/mt7622-header_sdmmc.bin $(STAGING_DIR_IMAGE)
endif
endef

define Package/arm-trusted-firmware-mt7622-nor/install
endef
Package/arm-trusted-firmware-mt7622-snand/install = $(Package/arm-trusted-firmware-mt7622-nor/install)
Package/arm-trusted-firmware-mt7622-emmc/install = $(Package/arm-trusted-firmware-mt7622-nor/install)
Package/arm-trusted-firmware-mt7622-sdmmc/install = $(Package/arm-trusted-firmware-mt7622-nor/install)

$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-nor))
$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-snand))
$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-emmc))
$(eval $(call BuildPackage,arm-trusted-firmware-mt7622-sdmmc))