ath79: do not build TP-Link tiny images by default
[oweals/openwrt.git] / package / boot / tfa-layerscape / Makefile
1 #
2 # Copyright 2019 NXP
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:=tfa-layerscape
11 PKG_VERSION:=LSDK-20.04
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://source.codeaurora.org/external/qoriq/qoriq-components/atf
16 PKG_SOURCE_VERSION:=4a82c939a0211196e2b80a495f966383803753bb
17 PKG_MIRROR_HASH:=31c264551ce800b646d7dcc5baa62cfbb4c8fa3299a93931c7ef71dc3e88380d
18 PKG_BUILD_DEPENDS:=tfa-layerscape/host
19
20 include $(INCLUDE_DIR)/host-build.mk
21 include $(INCLUDE_DIR)/package.mk
22
23 HOST_CFLAGS += -Wall -Werror -pedantic -std=c99
24 define Host/Compile
25         $(MAKE) -C \
26                 $(HOST_BUILD_DIR)/tools/fiptool \
27                 CFLAGS="$(HOST_CFLAGS)" \
28                 LDFLAGS="$(HOST_LDFLAGS)"
29         $(MAKE) -C \
30                 $(HOST_BUILD_DIR)/plat/nxp/tools \
31                 CFLAGS="$(HOST_CFLAGS)"
32 endef
33
34 define Host/Install
35         $(INSTALL_BIN) $(HOST_BUILD_DIR)/tools/fiptool/fiptool $(STAGING_DIR_HOST)/bin/tfa-fiptool
36         $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/create_pbl $(STAGING_DIR_HOST)/bin/tfa-create-pbl
37         $(INSTALL_BIN) $(HOST_BUILD_DIR)/plat/nxp/tools/byte_swap $(STAGING_DIR_HOST)/bin/tfa-byte-swap
38 endef
39
40 define Package/tfa-layerscape/ls1012afrdm
41   TITLE:=NXP LS1012AFRDM Trusted Firmware
42   PLAT:=ls1012afrdm
43   BOOT_MODE:=qspi
44   BIN_BL2:=build/ls1012afrdm/release/bl2_qspi.pbl
45   BIN_FIP:=build/ls1012afrdm/release/fip.bin
46 endef
47
48 define Package/tfa-layerscape/ls1012ardb
49   TITLE:=NXP LS1012ARDB Trusted Firmware
50   PLAT:=ls1012ardb
51   BOOT_MODE:=qspi
52   BIN_BL2:=build/ls1012ardb/release/bl2_qspi.pbl
53   BIN_FIP:=build/ls1012ardb/release/fip.bin
54 endef
55
56 define Package/tfa-layerscape/ls1012afrwy
57   TITLE:=NXP LS1012AFRWY Trusted Firmware
58   PLAT:=ls1012afrwy
59   BOOT_MODE:=qspi
60   BIN_BL2:=build/ls1012afrwy/release/bl2_qspi.pbl
61   BIN_FIP:=build/ls1012afrwy/release/fip.bin
62 endef
63
64 define Package/tfa-layerscape/ls1043ardb
65   TITLE:=NXP LS1043ARDB Trusted Firmware
66   PLAT:=ls1043ardb
67   BOOT_MODE:=nor
68   BIN_BL2:=build/ls1043ardb/release/bl2_nor.pbl
69   BIN_FIP:=build/ls1043ardb/release/fip.bin
70 endef
71
72 define Package/tfa-layerscape/ls1043ardb-sdboot
73   TITLE:=NXP LS1043ARDB SD Boot Trusted Firmware
74   PLAT:=ls1043ardb
75   BOOT_MODE:=sd
76   BIN_BL2:=build/ls1043ardb/release/bl2_sd.pbl
77   BIN_FIP:=build/ls1043ardb/release/fip.bin
78 endef
79
80 define Package/tfa-layerscape/ls1046ardb
81   TITLE:=NXP LS1046ARDB Trusted Firmware
82   PLAT:=ls1046ardb
83   BOOT_MODE:=qspi
84   BIN_BL2:=build/ls1046ardb/release/bl2_qspi.pbl
85   BIN_FIP:=build/ls1046ardb/release/fip.bin
86 endef
87
88 define Package/tfa-layerscape/ls1046ardb-sdboot
89   TITLE:=NXP LS1046ARDB SD Boot Trusted Firmware
90   PLAT:=ls1046ardb
91   BOOT_MODE:=sd
92   BIN_BL2:=build/ls1046ardb/release/bl2_sd.pbl
93   BIN_FIP:=build/ls1046ardb/release/fip.bin
94 endef
95
96 define Package/tfa-layerscape/ls1088ardb
97   TITLE:=NXP LS1088ARDB Trusted Firmware
98   PLAT:=ls1088ardb
99   BOOT_MODE:=qspi
100   BIN_BL2:=build/ls1088ardb/release/bl2_qspi.pbl
101   BIN_FIP:=build/ls1088ardb/release/fip.bin
102 endef
103
104 define Package/tfa-layerscape/ls1088ardb-sdboot
105   TITLE:=NXP LS1088ARDB SD Boot Trusted Firmware
106   PLAT:=ls1088ardb
107   BOOT_MODE:=sd
108   BIN_BL2:=build/ls1088ardb/release/bl2_sd.pbl
109   BIN_FIP:=build/ls1088ardb/release/fip.bin
110 endef
111
112 define Package/tfa-layerscape/ls2088ardb
113   TITLE:=NXP LS2088ARDB Trusted Firmware
114   PLAT:=ls2088ardb
115   BOOT_MODE:=nor
116   BIN_BL2:=build/ls2088ardb/release/bl2_nor.pbl
117   BIN_FIP:=build/ls2088ardb/release/fip.bin
118 endef
119
120 define Package/tfa-layerscape/Config
121   define Package/tfa-$(1)
122     SECTION:=boot
123     CATEGORY:=Boot Loaders
124     TITLE:=$(2)
125     DEPENDS:=@TARGET_layerscape_armv8_64b +layerscape-rcw +u-boot-$(1)
126     VARIANT:=$(1)
127     BIN_BL2:=$(3)
128     BIN_FIP:=$(4)
129   endef
130 endef
131
132 define Build/InstallDev
133         $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
134         $(CP) $(PKG_BUILD_DIR)/$(BIN_BL2) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.pbl
135         $(CP) $(PKG_BUILD_DIR)/$(BIN_FIP) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-fip.bin
136 endef
137
138 define Build/Compile
139         $(eval $(Package/tfa-layerscape/$(BUILD_VARIANT))) \
140         $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE=$(TARGET_CROSS) \
141                 fip pbl PLAT=$(PLAT) BOOT_MODE=$(BOOT_MODE) \
142                 RCW=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-rcw.bin \
143                 BL33=$(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-uboot.bin \
144                 FIPTOOL=$(STAGING_DIR_HOST)/bin/tfa-fiptool \
145                 CREATE_PBL=$(STAGING_DIR_HOST)/bin/tfa-create-pbl \
146                 BYTE_SWAP=$(STAGING_DIR_HOST)/bin/tfa-byte-swap
147 endef
148
149 TFAS := \
150   ls1012afrdm \
151   ls1012ardb \
152   ls1012afrwy \
153   ls1043ardb \
154   ls1043ardb-sdboot \
155   ls1046ardb \
156   ls1046ardb-sdboot \
157   ls1088ardb \
158   ls1088ardb-sdboot \
159   ls2088ardb
160
161 $(eval $(call HostBuild))
162 $(foreach tfa,$(TFAS), \
163   $(eval $(Package/tfa-layerscape/$(tfa))) \
164   $(eval $(call Package/tfa-layerscape/Config,$(tfa),$(TITLE),$(BIN_BL2),$(BIN_FIP))) \
165   $(eval $(call BuildPackage,tfa-$(tfa))) \
166 )