]>
Commit | Line | Data |
---|---|---|
1 | # SPDX-License-Identifier: GPL-2.0+ | |
2 | # | |
3 | # (C) Copyright 2000-2006 | |
4 | # Wolfgang Denk, DENX Software Engineering, [email protected]. | |
5 | # | |
6 | # (C) Copyright 2011 Freescale Semiconductor, Inc. | |
7 | ||
8 | ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 imx8m imx9 vf610)) | |
9 | obj-y = iomux-v3.o | |
10 | endif | |
11 | ||
12 | ifeq ($(SOC),$(filter $(SOC),imx8m)) | |
13 | ifneq ($(CONFIG_XPL_BUILD),y) | |
14 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o | |
15 | endif | |
16 | obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o | |
17 | obj-$(CONFIG_FEC_MXC) += mac.o | |
18 | obj-$(CONFIG_DWC_ETH_QOS) += mac.o | |
19 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o | |
20 | obj-$(CONFIG_IMX_HAB) += hab.o | |
21 | obj-y += cpu.o | |
22 | endif | |
23 | ||
24 | ifeq ($(SOC),$(filter $(SOC),imx8m imx9)) | |
25 | ifneq ($(CONFIG_XPL_BUILD),y) | |
26 | obj-y += fdt.o | |
27 | endif | |
28 | endif | |
29 | ||
30 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) | |
31 | obj-y += cpu.o speed.o | |
32 | ifneq ($(CONFIG_MX51),y) | |
33 | obj-y += mmdc_size.o | |
34 | endif | |
35 | obj-$(CONFIG_GPT_TIMER) += timer.o | |
36 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o | |
37 | endif | |
38 | ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imx9 imxrt)) | |
39 | obj-y += misc.o | |
40 | obj-$(CONFIG_CMD_PRIBLOB) += priblob.o | |
41 | obj-$(CONFIG_XPL_BUILD) += spl.o | |
42 | endif | |
43 | ifeq ($(SOC),$(filter $(SOC),mx7)) | |
44 | obj-y += cpu.o | |
45 | obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o | |
46 | obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o | |
47 | endif | |
48 | ifeq ($(SOC),$(filter $(SOC),mx7 imx8m)) | |
49 | ifneq ($(CONFIG_XPL_BUILD),y) | |
50 | obj-$(CONFIG_FSL_MFGPROT) += cmd_mfgprot.o | |
51 | endif | |
52 | endif | |
53 | ifeq ($(SOC),$(filter $(SOC),mx5 mx6 mx7)) | |
54 | obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o | |
55 | endif | |
56 | ifeq ($(SOC),$(filter $(SOC),mx6 mx7)) | |
57 | obj-y += cache.o init.o | |
58 | obj-$(CONFIG_FEC_MXC) += mac.o | |
59 | obj-$(CONFIG_IMX_RDC) += rdc-sema.o | |
60 | ifneq ($(CONFIG_XPL_BUILD),y) | |
61 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o | |
62 | endif | |
63 | obj-$(CONFIG_$(XPL_)SATA) += sata.o | |
64 | obj-$(CONFIG_IMX_HAB) += hab.o | |
65 | obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o | |
66 | endif | |
67 | ifeq ($(SOC),$(filter $(SOC),mx7ulp)) | |
68 | obj-y += cache.o mmdc_size.o | |
69 | obj-$(CONFIG_IMX_HAB) += hab.o | |
70 | endif | |
71 | ifeq ($(SOC),$(filter $(SOC),vf610)) | |
72 | obj-y += ddrmc-vf610.o | |
73 | obj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o | |
74 | endif | |
75 | ifeq ($(SOC),$(filter $(SOC),imx8)) | |
76 | ifneq ($(CONFIG_XPL_BUILD),y) | |
77 | obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o | |
78 | endif | |
79 | endif | |
80 | ifneq ($(CONFIG_XPL_BUILD),y) | |
81 | obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o | |
82 | obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o | |
83 | obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o | |
84 | obj-$(CONFIG_CMD_NANDBCB) += cmd_nandbcb.o | |
85 | endif | |
86 | ||
87 | ifeq ($(CONFIG_XPL_BUILD),y) | |
88 | obj-$(CONFIG_SPL_LOAD_IMX_CONTAINER) += image-container.o | |
89 | endif | |
90 | ||
91 | ifeq ($(SOC),$(filter $(SOC),imx8ulp imx9)) | |
92 | obj-$(CONFIG_AHAB_BOOT) += ele_ahab.o | |
93 | endif | |
94 | ||
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 | ||
112 | quiet_cmd_cpp_cfg = CFGS $@ | |
113 | cmd_cpp_cfg = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $< | |
114 | ||
115 | # mkimage source config file | |
116 | IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%) | |
117 | ||
118 | # How to create a cpp processed config file, they all use the same source | |
119 | %.cfgout: $(IMX_CONFIG) FORCE | |
120 | $(Q)mkdir -p $(dir $@) | |
121 | $(call if_changed_dep,cpp_cfg) | |
122 | ||
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 | ||
128 | ifeq ($(CONFIG_ARCH_IMX8), y) | |
129 | CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh | |
130 | IMAGE_TYPE := imx8image | |
131 | ifeq ($(CONFIG_XPL_BUILD),y) | |
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) | |
133 | endif | |
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) | |
135 | else ifeq ($(CONFIG_ARCH_IMX8M), y) | |
136 | IMAGE_TYPE := imx8mimage | |
137 | DEPFILE_EXISTS := 0 | |
138 | else ifeq ($(CONFIG_ARCH_IMX9)$(CONFIG_ARCH_IMX8ULP), y) | |
139 | IMAGE_TYPE := imx8image | |
140 | DEPFILE_EXISTS := 0 | |
141 | else | |
142 | IMAGE_TYPE := imximage | |
143 | DEPFILE_EXISTS := 0 | |
144 | endif | |
145 | ||
146 | MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
147 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) | |
148 | u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log | |
149 | ||
150 | u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE | |
151 | $(call if_changed,mkimage) | |
152 | ||
153 | quiet_cmd_u-boot-nand_imx = GEN $@ | |
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] | |
157 | ||
158 | u-boot-nand.imx: u-boot.imx FORCE | |
159 | $(call if_changed,u-boot-nand_imx) | |
160 | ||
161 | ifeq ($(CONFIG_MULTI_DTB_FIT),y) | |
162 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
163 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) | |
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) | |
171 | MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
172 | -T $(IMAGE_TYPE) -e $(CONFIG_TEXT_BASE) | |
173 | u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log | |
174 | ||
175 | u-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE | |
176 | ifeq ($(DEPFILE_EXISTS),0) | |
177 | $(call if_changed,mkimage) | |
178 | endif | |
179 | endif | |
180 | ||
181 | ifdef CONFIG_ARM64 | |
182 | ifeq ($(CONFIG_ARCH_IMX8M), y) | |
183 | ||
184 | SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE | |
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 | ||
190 | spl/u-boot-spl.cfgout: $(IMX_CONFIG) FORCE | |
191 | $(Q)mkdir -p $(dir $@) | |
192 | $(call if_changed_dep,cpp_cfg) | |
193 | ||
194 | spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE | |
195 | ||
196 | flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE | |
197 | $(call if_changed,mkimage) | |
198 | endif | |
199 | ||
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 | ||
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 | |
211 | $(call if_changed,mkimage) | |
212 | flash.bin: spl/u-boot-spl.bin FORCE | |
213 | $(call if_changed,mkimage) | |
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 | |
222 | endif | |
223 | ||
224 | ifeq ($(CONFIG_ARCH_IMX9)$(CONFIG_ARCH_IMX8ULP), y) | |
225 | ||
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 $@ | |
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 $@) | |
236 | $(call if_changed_dep,cpp_cfg_imx9_check) | |
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 $@) | |
242 | $(call if_changed_dep,cpp_cfg_imx9_check) | |
243 | ||
244 | flash.bin: spl/u-boot-spl-ddr.bin container.cfgout FORCE | |
245 | $(call if_changed,mkimage) | |
246 | endif | |
247 | ||
248 | else | |
249 | MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ | |
250 | -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) | |
251 | SPL: MKIMAGEOUTPUT = SPL.log | |
252 | ||
253 | SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout $(PLUGIN).bin FORCE | |
254 | $(call if_changed,mkimage) | |
255 | ||
256 | MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_TEXT_BASE) \ | |
257 | -e $(CONFIG_TEXT_BASE) -C none -T firmware | |
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 | ||
268 | u-boot-with-spl.imx: SPL $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE | |
269 | $(call if_changed,pad_cat) | |
270 | ||
271 | u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE | |
272 | $(call if_changed,pad_cat) | |
273 | ||
274 | quiet_cmd_u-boot-nand-spl_imx = GEN $@ | |
275 | cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ | |
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) | |
280 | endif | |
281 | ||
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) | |
283 | ||
284 | obj-$(CONFIG_MX5) += mx5/ | |
285 | obj-$(CONFIG_MX6) += mx6/ | |
286 | obj-$(CONFIG_MX7) += mx7/ | |
287 | obj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/ | |
288 | obj-$(CONFIG_ARCH_IMX8ULP) += imx8ulp/ | |
289 | obj-$(CONFIG_IMX8M) += imx8m/ | |
290 | obj-$(CONFIG_ARCH_IMX8) += imx8/ | |
291 | obj-$(CONFIG_ARCH_IMX9) += imx9/ | |
292 | obj-$(CONFIG_ARCH_IMXRT) += imxrt/ | |
293 | ||
294 | obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o | |
295 | obj-$(CONFIG_IMX8_ROMAPI) += romapi.o |