]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | # SPDX-License-Identifier: GPL-2.0+ |
18936ee2 JL |
2 | # |
3 | # (C) Copyright 2000-2006 | |
4 | # Wolfgang Denk, DENX Software Engineering, [email protected]. | |
5 | # | |
6 | # (C) Copyright 2011 Freescale Semiconductor, Inc. | |
18936ee2 | 7 | |
881df6ed | 8 | ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 imx8m imx9 vf610)) |
71f84ef0 | 9 | obj-y = iomux-v3.o |
ab3a990b | 10 | endif |
e0e4e533 | 11 | |
cd357ad1 | 12 | ifeq ($(SOC),$(filter $(SOC),imx8m)) |
bef9fdbe | 13 | ifneq ($(CONFIG_XPL_BUILD),y) |
e0e4e533 | 14 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o |
60afc500 | 15 | endif |
e0e4e533 PF |
16 | obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o |
17 | obj-$(CONFIG_FEC_MXC) += mac.o | |
5d3ba244 | 18 | obj-$(CONFIG_DWC_ETH_QOS) += mac.o |
e0e4e533 | 19 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o |
41b230bf | 20 | obj-$(CONFIG_IMX_HAB) += hab.o |
e0e4e533 PF |
21 | obj-y += cpu.o |
22 | endif | |
23 | ||
98f948ec | 24 | ifeq ($(SOC),$(filter $(SOC),imx8m imx9)) |
bef9fdbe | 25 | ifneq ($(CONFIG_XPL_BUILD),y) |
98f948ec PF |
26 | obj-y += fdt.o |
27 | endif | |
28 | endif | |
29 | ||
ea00e59b | 30 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) |
23b6a131 | 31 | obj-y += cpu.o speed.o |
89bc388a FE |
32 | ifneq ($(CONFIG_MX51),y) |
33 | obj-y += mmdc_size.o | |
34 | endif | |
23b6a131 | 35 | obj-$(CONFIG_GPT_TIMER) += timer.o |
71f84ef0 | 36 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o |
ea00e59b | 37 | endif |
881df6ed | 38 | ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imx9 imxrt)) |
71f84ef0 | 39 | obj-y += misc.o |
613cf239 | 40 | obj-$(CONFIG_CMD_PRIBLOB) += priblob.o |
bef9fdbe | 41 | obj-$(CONFIG_XPL_BUILD) += spl.o |
8870e459 | 42 | endif |
cd562c8d | 43 | ifeq ($(SOC),$(filter $(SOC),mx7)) |
0cf207ec | 44 | obj-y += cpu.o |
cd562c8d | 45 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o |
c1ef4863 | 46 | obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o |
92aff90b YL |
47 | endif |
48 | ifeq ($(SOC),$(filter $(SOC),mx7 imx8m)) | |
bef9fdbe | 49 | ifneq ($(CONFIG_XPL_BUILD),y) |
30e39ac7 | 50 | obj-$(CONFIG_FSL_MFGPROT) += cmd_mfgprot.o |
cd562c8d | 51 | endif |
92aff90b | 52 | endif |
0b6b8a3a MV |
53 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6 mx7)) |
54 | obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o | |
55 | endif | |
cd562c8d | 56 | ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) |
0cf207ec | 57 | obj-y += cache.o init.o |
6ce8b10b | 58 | obj-$(CONFIG_FEC_MXC) += mac.o |
de09c43b | 59 | obj-$(CONFIG_IMX_RDC) += rdc-sema.o |
bef9fdbe | 60 | ifneq ($(CONFIG_XPL_BUILD),y) |
6f6058bf | 61 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o |
20b9f2ea | 62 | endif |
c46760d5 | 63 | obj-$(CONFIG_$(XPL_)SATA) += sata.o |
d714a75f | 64 | obj-$(CONFIG_IMX_HAB) += hab.o |
46718353 | 65 | obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o |
164d9846 | 66 | endif |
1b409828 | 67 | ifeq ($(SOC),$(filter $(SOC),mx7ulp)) |
d9fba73a | 68 | obj-y += cache.o mmdc_size.o |
d714a75f | 69 | obj-$(CONFIG_IMX_HAB) += hab.o |
1b409828 | 70 | endif |
c7ea243c SM |
71 | ifeq ($(SOC),$(filter $(SOC),vf610)) |
72 | obj-y += ddrmc-vf610.o | |
548cc109 | 73 | obj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o |
c7ea243c | 74 | endif |
e8cd1f60 | 75 | ifeq ($(SOC),$(filter $(SOC),imx8)) |
bef9fdbe | 76 | ifneq ($(CONFIG_XPL_BUILD),y) |
e8cd1f60 YL |
77 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o |
78 | endif | |
79 | endif | |
bef9fdbe | 80 | ifneq ($(CONFIG_XPL_BUILD),y) |
71f84ef0 MY |
81 | obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o |
82 | obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o | |
0200020b | 83 | obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o |
1d43e24b | 84 | obj-$(CONFIG_CMD_NANDBCB) += cmd_nandbcb.o |
99f49fdd | 85 | endif |
18936ee2 | 86 | |
bef9fdbe | 87 | ifeq ($(CONFIG_XPL_BUILD),y) |
12b33390 | 88 | obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += image-container.o |
7d84978c YL |
89 | endif |
90 | ||
07816f08 YL |
91 | ifeq ($(SOC),$(filter $(SOC),imx8ulp imx9)) |
92 | obj-$(CONFIG_AHAB_BOOT) += ele_ahab.o | |
93 | endif | |
94 | ||
b3513c5d PF |
95 | PLUGIN = board/$(BOARDDIR)/plugin |
96 | ||
97 | ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y) | |
98 | ||
99 | $(PLUGIN).o: $(PLUGIN).S FORCE | |
100 | $(Q)mkdir -p $(dir $@) | |
101 | $(call if_changed_dep,as_o_S) | |
102 | ||
103 | $(PLUGIN).bin: $(PLUGIN).o FORCE | |
104 | $(Q)mkdir -p $(dir $@) | |
105 | $(OBJCOPY) -O binary --gap-fill 0xff $< $@ | |
106 | else | |
107 | ||
108 | $(PLUGIN).bin: | |
109 | ||
110 | endif | |
111 | ||
4e0c8abc | 112 | quiet_cmd_cpp_cfg = CFGS $@ |
5c86a8f7 | 113 | cmd_cpp_cfg = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $< |
4e0c8abc | 114 | |
f9167573 TP |
115 | # mkimage source config file |
116 | IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%) | |
4e0c8abc | 117 | |
f9167573 TP |
118 | # How to create a cpp processed config file, they all use the same source |
119 | %.cfgout: $(IMX_CONFIG) FORCE | |
4e0c8abc MY |
120 | $(Q)mkdir -p $(dir $@) |
121 | $(call if_changed_dep,cpp_cfg) | |
122 | ||
700315c9 PF |
123 | IMX_CONTAINER_CFG = $(CONFIG_IMX_CONTAINER_CFG:"%"=%) |
124 | container.cfg: $(IMX_CONTAINER_CFG) FORCE | |
125 | $(Q)mkdir -p $(dir $@) | |
126 | $(call if_changed_dep,cpp_cfg) | |
127 | ||
0e5c8ce7 | 128 | ifeq ($(CONFIG_ARCH_IMX8), y) |
d7961159 PF |
129 | CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh |
130 | IMAGE_TYPE := imx8image | |
bef9fdbe | 131 | ifeq ($(CONFIG_XPL_BUILD),y) |
caceb739 | 132 | SPL_DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG); if [ -f spl/u-boot-spl.cfgout ]; then $(CNTR_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi) |
4c45e43a | 133 | endif |
4ac94bfa | 134 | DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctree)/$(IMX_CONFIG); if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) u-boot-dtb.cfgout; echo $$?; fi) |
94df9885 PF |
135 | else ifeq ($(CONFIG_ARCH_IMX8M), y) |
136 | IMAGE_TYPE := imx8mimage | |
68de913c | 137 | DEPFILE_EXISTS := 0 |
9970da6f | 138 | else ifeq ($(CONFIG_ARCH_IMX9)$(CONFIG_ARCH_IMX8ULP), y) |
f637dfe8 MO |
139 | IMAGE_TYPE := imx8image |
140 | DEPFILE_EXISTS := 0 | |
d7961159 PF |
141 | else |
142 | IMAGE_TYPE := imximage | |
143 | DEPFILE_EXISTS := 0 | |
0e5c8ce7 PF |
144 | endif |
145 | ||
146 | MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
98463903 | 147 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) |
1f6a6648 | 148 | u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log |
4e0c8abc | 149 | |
f9167573 | 150 | u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE |
4e0c8abc MY |
151 | $(call if_changed,mkimage) |
152 | ||
95942f99 | 153 | quiet_cmd_u-boot-nand_imx = GEN $@ |
7dede403 HDF |
154 | cmd_u-boot-nand_imx = (dd bs=1024 count=1 if=/dev/zero 2>/dev/null) | cat - $< > [email protected] ; \ |
155 | (dd bs=10k count=1 if=/dev/zero 2>/dev/null) | cat [email protected] - > $@ ; \ | |
156 | rm -f [email protected] | |
95942f99 LC |
157 | |
158 | u-boot-nand.imx: u-boot.imx FORCE | |
159 | $(call if_changed,u-boot-nand_imx) | |
160 | ||
16c776d3 HS |
161 | ifeq ($(CONFIG_MULTI_DTB_FIT),y) |
162 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
98463903 | 163 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) |
16c776d3 HS |
164 | u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log |
165 | ||
166 | u-boot-dtb.imx: u-boot-fit-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE | |
167 | ifeq ($(DEPFILE_EXISTS),0) | |
168 | $(call if_changed,mkimage) | |
169 | endif | |
170 | else ifeq ($(CONFIG_OF_SEPARATE),y) | |
0e5c8ce7 | 171 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ |
98463903 | 172 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) |
1f6a6648 | 173 | u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log |
e64348f5 | 174 | |
f9167573 | 175 | u-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE |
d7961159 | 176 | ifeq ($(DEPFILE_EXISTS),0) |
e64348f5 SB |
177 | $(call if_changed,mkimage) |
178 | endif | |
d7961159 | 179 | endif |
e64348f5 | 180 | |
94df9885 PF |
181 | ifdef CONFIG_ARM64 |
182 | ifeq ($(CONFIG_ARCH_IMX8M), y) | |
68de913c PF |
183 | |
184 | SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE | |
94df9885 PF |
185 | |
186 | MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout \ | |
187 | -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) | |
188 | flash.bin: MKIMAGEOUTPUT = flash.log | |
189 | ||
68de913c PF |
190 | spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE |
191 | $(Q)mkdir -p $(dir $@) | |
192 | $(call if_changed_dep,cpp_cfg) | |
193 | ||
94df9885 | 194 | spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE |
94df9885 PF |
195 | |
196 | flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE | |
94df9885 PF |
197 | $(call if_changed,mkimage) |
198 | endif | |
94df9885 | 199 | |
caceb739 PF |
200 | ifeq ($(CONFIG_ARCH_IMX8), y) |
201 | SPL: | |
202 | ||
203 | MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000 | |
204 | flash.bin: MKIMAGEOUTPUT = flash.log | |
205 | ||
700315c9 PF |
206 | MKIMAGEFLAGS_u-boot.cnt = -n container.cfg -T $(IMAGE_TYPE) -e 0x100000 |
207 | u-boot.cnt: MKIMAGEOUTPUT = u-boot.cnt.log | |
208 | ||
209 | ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y) | |
210 | u-boot.cnt: u-boot.bin container.cfg FORCE | |
caceb739 | 211 | $(call if_changed,mkimage) |
700315c9 PF |
212 | flash.bin: spl/u-boot-spl.bin FORCE |
213 | $(call if_changed,mkimage) | |
d1c07785 PF |
214 | @flashbin_size=`wc -c flash.bin | awk '{print $$1}'`; \ |
215 | pad_cnt=$$(((flashbin_size + 0x400 - 1) / 0x400)); \ | |
216 | echo "append u-boot.cnt at $$pad_cnt KB"; \ | |
217 | dd if=u-boot.cnt of=flash.bin bs=1K seek=$$pad_cnt; | |
218 | else | |
219 | flash.bin: spl/u-boot-spl.bin FORCE | |
220 | $(call if_changed,mkimage) | |
221 | endif | |
caceb739 PF |
222 | endif |
223 | ||
9970da6f | 224 | ifeq ($(CONFIG_ARCH_IMX9)$(CONFIG_ARCH_IMX8ULP), y) |
f637dfe8 | 225 | |
aec0015a JF |
226 | quiet_cmd_cpp_cfg_imx9_check = CHECK $@ |
227 | cmd_cpp_cfg_imx9_check = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $< && $(srctree)/tools/imx9_image.sh $@ | |
f637dfe8 MO |
228 | |
229 | SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout u-boot-container.cfgout FORCE | |
230 | ||
231 | MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) | |
232 | flash.bin: MKIMAGEOUTPUT = flash.log | |
233 | ||
234 | spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE | |
235 | $(Q)mkdir -p $(dir $@) | |
aec0015a | 236 | $(call if_changed_dep,cpp_cfg_imx9_check) |
f637dfe8 MO |
237 | |
238 | spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE | |
239 | ||
240 | u-boot-container.cfgout: $(IMX_CONTAINER_CFG) FORCE | |
241 | $(Q)mkdir -p $(dir $@) | |
aec0015a | 242 | $(call if_changed_dep,cpp_cfg_imx9_check) |
f637dfe8 MO |
243 | |
244 | flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE | |
245 | $(call if_changed,mkimage) | |
881df6ed PF |
246 | endif |
247 | ||
94df9885 | 248 | else |
0e5c8ce7 PF |
249 | MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ |
250 | -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) | |
1f6a6648 SE |
251 | SPL: MKIMAGEOUTPUT = SPL.log |
252 | ||
f9167573 | 253 | SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout $(PLUGIN).bin FORCE |
4e0c8abc MY |
254 | $(call if_changed,mkimage) |
255 | ||
98463903 SG |
256 | MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_TEXT_BASE) \ |
257 | -e $(CONFIG_TEXT_BASE) -C none -T firmware | |
4e0c8abc MY |
258 | |
259 | u-boot.uim: u-boot.bin FORCE | |
260 | $(call if_changed,mkimage) | |
261 | ||
262 | OBJCOPYFLAGS += -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) | |
263 | append = cat $(filter-out $< $(PHONY), $^) >> $@ | |
264 | ||
265 | quiet_cmd_pad_cat = CAT $@ | |
266 | cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ | |
267 | ||
7034478a | 268 | u-boot-with-spl.imx: SPL $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE |
4e0c8abc MY |
269 | $(call if_changed,pad_cat) |
270 | ||
7034478a | 271 | u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE |
4e0c8abc MY |
272 | $(call if_changed,pad_cat) |
273 | ||
274 | quiet_cmd_u-boot-nand-spl_imx = GEN $@ | |
0297bd11 | 275 | cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ |
4e0c8abc MY |
276 | dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@ |
277 | ||
278 | spl/u-boot-nand-spl.imx: SPL FORCE | |
279 | $(call if_changed,u-boot-nand-spl_imx) | |
94df9885 | 280 | endif |
4e0c8abc | 281 | |
f9167573 | 282 | targets += $(addprefix ../../../,SPL spl/u-boot-spl.cfgout u-boot-dtb.cfgout u-boot.cfgout u-boot.uim spl/u-boot-nand-spl.imx) |
552a848e SB |
283 | |
284 | obj-$(CONFIG_MX5) += mx5/ | |
285 | obj-$(CONFIG_MX6) += mx6/ | |
286 | obj-$(CONFIG_MX7) += mx7/ | |
287 | obj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/ | |
9ef89ea9 | 288 | obj-$(CONFIG_ARCH_IMX8ULP) += imx8ulp/ |
cd357ad1 | 289 | obj-$(CONFIG_IMX8M) += imx8m/ |
b2b8b9be | 290 | obj-$(CONFIG_ARCH_IMX8) += imx8/ |
881df6ed | 291 | obj-$(CONFIG_ARCH_IMX9) += imx9/ |
77eb9a90 | 292 | obj-$(CONFIG_ARCH_IMXRT) += imxrt/ |
1cbebc78 PF |
293 | |
294 | obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o | |
748da8ab | 295 | obj-$(CONFIG_IMX8_ROMAPI) += romapi.o |