Makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. # SPDX-License-Identifier: GPL-2.0+
  2. #
  3. # (C) Copyright 2000-2006
  4. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. #
  6. # (C) Copyright 2011 Freescale Semiconductor, Inc.
  7. ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 imx8m vf610))
  8. obj-y = iomux-v3.o
  9. endif
  10. ifeq ($(SOC),$(filter $(SOC),imx8m))
  11. ifneq ($(CONFIG_SPL_BUILD),y)
  12. obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
  13. endif
  14. obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
  15. obj-$(CONFIG_FEC_MXC) += mac.o
  16. obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
  17. obj-$(CONFIG_IMX_HAB) += hab.o
  18. obj-y += cpu.o
  19. endif
  20. ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
  21. obj-y += cpu.o speed.o
  22. ifneq ($(CONFIG_MX51),y)
  23. obj-y += mmdc_size.o
  24. endif
  25. obj-$(CONFIG_GPT_TIMER) += timer.o
  26. obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
  27. endif
  28. ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imxrt))
  29. obj-y += misc.o
  30. obj-$(CONFIG_CMD_PRIBLOB) += priblob.o
  31. obj-$(CONFIG_SPL_BUILD) += spl.o
  32. endif
  33. ifeq ($(SOC),$(filter $(SOC),mx7))
  34. obj-y += cpu.o
  35. obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
  36. obj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o
  37. obj-$(CONFIG_FSL_MFGPROT) += cmd_mfgprot.o
  38. endif
  39. ifeq ($(SOC),$(filter $(SOC),mx5 mx6 mx7))
  40. obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
  41. endif
  42. ifeq ($(SOC),$(filter $(SOC),mx6 mx7))
  43. obj-y += cache.o init.o
  44. obj-$(CONFIG_FEC_MXC) += mac.o
  45. obj-$(CONFIG_IMX_RDC) += rdc-sema.o
  46. ifneq ($(CONFIG_SPL_BUILD),y)
  47. obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
  48. endif
  49. obj-$(CONFIG_SATA) += sata.o
  50. obj-$(CONFIG_IMX_HAB) += hab.o
  51. obj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o
  52. endif
  53. ifeq ($(SOC),$(filter $(SOC),mx7ulp))
  54. obj-y += cache.o mmdc_size.o
  55. obj-$(CONFIG_IMX_HAB) += hab.o
  56. endif
  57. ifeq ($(SOC),$(filter $(SOC),vf610))
  58. obj-y += ddrmc-vf610.o
  59. obj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o
  60. endif
  61. ifneq ($(CONFIG_SPL_BUILD),y)
  62. obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o
  63. obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
  64. obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o
  65. obj-$(CONFIG_CMD_NANDBCB) += cmd_nandbcb.o
  66. endif
  67. PLUGIN = board/$(BOARDDIR)/plugin
  68. ifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y)
  69. $(PLUGIN).o: $(PLUGIN).S FORCE
  70. $(Q)mkdir -p $(dir $@)
  71. $(call if_changed_dep,as_o_S)
  72. $(PLUGIN).bin: $(PLUGIN).o FORCE
  73. $(Q)mkdir -p $(dir $@)
  74. $(OBJCOPY) -O binary --gap-fill 0xff $< $@
  75. else
  76. $(PLUGIN).bin:
  77. endif
  78. quiet_cmd_cpp_cfg = CFGS $@
  79. cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $<
  80. # mkimage source config file
  81. IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
  82. # How to create a cpp processed config file, they all use the same source
  83. %.cfgout: $(IMX_CONFIG) FORCE
  84. $(Q)mkdir -p $(dir $@)
  85. $(call if_changed_dep,cpp_cfg)
  86. IMX_CONTAINER_CFG = $(CONFIG_IMX_CONTAINER_CFG:"%"=%)
  87. container.cfg: $(IMX_CONTAINER_CFG) FORCE
  88. $(Q)mkdir -p $(dir $@)
  89. $(call if_changed_dep,cpp_cfg)
  90. ifeq ($(CONFIG_ARCH_IMX8), y)
  91. CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh
  92. IMAGE_TYPE := imx8image
  93. ifeq ($(CONFIG_SPL_BUILD),y)
  94. 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)
  95. endif
  96. 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)
  97. else ifeq ($(CONFIG_ARCH_IMX8M), y)
  98. IMAGE_TYPE := imx8mimage
  99. IMX8M_DEPFILES := $(srctree)/tools/imx8m_image.sh
  100. 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 $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 0; echo $$?; fi)
  101. else
  102. IMAGE_TYPE := imximage
  103. DEPFILE_EXISTS := 0
  104. endif
  105. MKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
  106. -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE)
  107. u-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log
  108. u-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE
  109. $(call if_changed,mkimage)
  110. ifeq ($(CONFIG_MULTI_DTB_FIT),y)
  111. MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
  112. -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE)
  113. u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log
  114. u-boot-dtb.imx: u-boot-fit-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE
  115. ifeq ($(DEPFILE_EXISTS),0)
  116. $(call if_changed,mkimage)
  117. endif
  118. else ifeq ($(CONFIG_OF_SEPARATE),y)
  119. MKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
  120. -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE)
  121. u-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log
  122. u-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE
  123. ifeq ($(DEPFILE_EXISTS),0)
  124. $(call if_changed,mkimage)
  125. endif
  126. endif
  127. ifdef CONFIG_ARM64
  128. ifeq ($(CONFIG_ARCH_IMX8M), y)
  129. SPL:
  130. MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout \
  131. -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
  132. flash.bin: MKIMAGEOUTPUT = flash.log
  133. spl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE
  134. ifeq ($(DEPFILE_EXISTS),0)
  135. $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 1
  136. endif
  137. flash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE
  138. $(call if_changed,mkimage)
  139. endif
  140. ifeq ($(CONFIG_ARCH_IMX8), y)
  141. SPL:
  142. MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000
  143. flash.bin: MKIMAGEOUTPUT = flash.log
  144. MKIMAGEFLAGS_u-boot.cnt = -n container.cfg -T $(IMAGE_TYPE) -e 0x100000
  145. u-boot.cnt: MKIMAGEOUTPUT = u-boot.cnt.log
  146. ifeq ($(CONFIG_SPL_LOAD_IMX_CONTAINER), y)
  147. u-boot.cnt: u-boot.bin container.cfg FORCE
  148. $(call if_changed,mkimage)
  149. flash.bin: spl/u-boot-spl.bin FORCE
  150. $(call if_changed,mkimage)
  151. @flashbin_size=`wc -c flash.bin | awk '{print $$1}'`; \
  152. pad_cnt=$$(((flashbin_size + 0x400 - 1) / 0x400)); \
  153. echo "append u-boot.cnt at $$pad_cnt KB"; \
  154. dd if=u-boot.cnt of=flash.bin bs=1K seek=$$pad_cnt;
  155. else
  156. flash.bin: spl/u-boot-spl.bin FORCE
  157. $(call if_changed,mkimage)
  158. endif
  159. endif
  160. else
  161. MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
  162. -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
  163. SPL: MKIMAGEOUTPUT = SPL.log
  164. SPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout $(PLUGIN).bin FORCE
  165. $(call if_changed,mkimage)
  166. MKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
  167. -e $(CONFIG_SYS_TEXT_BASE) -C none -T firmware
  168. u-boot.uim: u-boot.bin FORCE
  169. $(call if_changed,mkimage)
  170. OBJCOPYFLAGS += -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
  171. append = cat $(filter-out $< $(PHONY), $^) >> $@
  172. quiet_cmd_pad_cat = CAT $@
  173. cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@
  174. u-boot-with-spl.imx: SPL $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE
  175. $(call if_changed,pad_cat)
  176. u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx $(if $(CONFIG_OF_SEPARATE),u-boot.img,u-boot.uim) FORCE
  177. $(call if_changed,pad_cat)
  178. quiet_cmd_u-boot-nand-spl_imx = GEN $@
  179. cmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \
  180. dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@
  181. spl/u-boot-nand-spl.imx: SPL FORCE
  182. $(call if_changed,u-boot-nand-spl_imx)
  183. endif
  184. targets += $(addprefix ../../../,SPL spl/u-boot-spl.cfgout u-boot-dtb.cfgout u-boot.cfgout u-boot.uim spl/u-boot-nand-spl.imx)
  185. obj-$(CONFIG_ARM64) += lowlevel.o
  186. obj-$(CONFIG_MX5) += mx5/
  187. obj-$(CONFIG_MX6) += mx6/
  188. obj-$(CONFIG_MX7) += mx7/
  189. obj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/
  190. obj-$(CONFIG_IMX8M) += imx8m/
  191. obj-$(CONFIG_ARCH_IMX8) += imx8/
  192. obj-$(CONFIG_ARCH_IMXRT) += imxrt/
  193. obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o