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