183d290c5STom Rini# SPDX-License-Identifier: GPL-2.0+ 2552a848eSStefano Babic# 3552a848eSStefano Babic# (C) Copyright 2000-2006 4552a848eSStefano Babic# Wolfgang Denk, DENX Software Engineering, wd@denx.de. 5552a848eSStefano Babic# 6552a848eSStefano Babic# (C) Copyright 2011 Freescale Semiconductor, Inc. 7552a848eSStefano Babic 8cd357ad1SPeng Fanifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 mx7 imx8m vf610)) 9552a848eSStefano Babicobj-y = iomux-v3.o 10552a848eSStefano Babicendif 11e0e4e533SPeng Fan 12cd357ad1SPeng Fanifeq ($(SOC),$(filter $(SOC),imx8m)) 1360afc500SPeng Fanifneq ($(CONFIG_SPL_BUILD),y) 14e0e4e533SPeng Fanobj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o 1560afc500SPeng Fanendif 16e0e4e533SPeng Fanobj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o 17e0e4e533SPeng Fanobj-$(CONFIG_FEC_MXC) += mac.o 18e0e4e533SPeng Fanobj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o 19e0e4e533SPeng Fanobj-y += cpu.o 20e0e4e533SPeng Fanendif 21e0e4e533SPeng Fan 22552a848eSStefano Babicifeq ($(SOC),$(filter $(SOC),mx5 mx6)) 2323b6a131SStefan Agnerobj-y += cpu.o speed.o 2423b6a131SStefan Agnerobj-$(CONFIG_GPT_TIMER) += timer.o 25552a848eSStefano Babicobj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o 26552a848eSStefano Babicendif 27c1e0940fSPeng Fanifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8)) 28552a848eSStefano Babicobj-y += misc.o 29552a848eSStefano Babicobj-$(CONFIG_SPL_BUILD) += spl.o 30552a848eSStefano Babicendif 31552a848eSStefano Babicifeq ($(SOC),$(filter $(SOC),mx7)) 32552a848eSStefano Babicobj-y += cpu.o 33552a848eSStefano Babicobj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o 34c1ef4863SPeng Fanobj-$(CONFIG_ENV_IS_IN_MMC) += mmc_env.o 35552a848eSStefano Babicendif 360b6b8a3aSMarek Vasutifeq ($(SOC),$(filter $(SOC),mx5 mx6 mx7)) 370b6b8a3aSMarek Vasutobj-$(CONFIG_IMX_VIDEO_SKIP) += video.o 380b6b8a3aSMarek Vasutendif 39552a848eSStefano Babicifeq ($(SOC),$(filter $(SOC),mx6 mx7)) 40552a848eSStefano Babicobj-y += cache.o init.o 416ce8b10bSPeng Fanobj-$(CONFIG_FEC_MXC) += mac.o 42552a848eSStefano Babicobj-$(CONFIG_IMX_RDC) += rdc-sema.o 4320b9f2eaSTom Riniifneq ($(CONFIG_SPL_BUILD),y) 44552a848eSStefano Babicobj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o 4520b9f2eaSTom Riniendif 466ce8b10bSPeng Fanobj-$(CONFIG_SATA) += sata.o 47552a848eSStefano Babicobj-$(CONFIG_SECURE_BOOT) += hab.o 4846718353SStefan Agnerobj-$(CONFIG_SYSCOUNTER_TIMER) += syscounter.o 49552a848eSStefano Babicendif 50552a848eSStefano Babicifeq ($(SOC),$(filter $(SOC),mx7ulp)) 51552a848eSStefano Babicobj-y += cache.o 52552a848eSStefano Babicobj-$(CONFIG_SECURE_BOOT) += hab.o 53552a848eSStefano Babicendif 54552a848eSStefano Babicifeq ($(SOC),$(filter $(SOC),vf610)) 55552a848eSStefano Babicobj-y += ddrmc-vf610.o 56*548cc109SLukasz Majewskiobj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o 57552a848eSStefano Babicendif 58552a848eSStefano Babicifneq ($(CONFIG_SPL_BUILD),y) 59552a848eSStefano Babicobj-$(CONFIG_CMD_BMODE) += cmd_bmode.o 60552a848eSStefano Babicobj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o 61552a848eSStefano Babicobj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o 62552a848eSStefano Babicendif 63552a848eSStefano Babic 6443e6f94cSMarcel Ziswilerifneq ($(CONFIG_BOARD_SIZE_LIMIT),) 6543e6f94cSMarcel ZiswilerBOARD_SIZE_CHECK = \ 6643e6f94cSMarcel Ziswiler @actual=`wc -c $@ | awk '{print $$1}'`; \ 6743e6f94cSMarcel Ziswiler limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \ 6843e6f94cSMarcel Ziswiler if test $$actual -gt $$limit; then \ 6943e6f94cSMarcel Ziswiler echo "$@ exceeds file size limit:" >&2 ; \ 7043e6f94cSMarcel Ziswiler echo " limit: $$limit bytes" >&2 ; \ 7143e6f94cSMarcel Ziswiler echo " actual: $$actual bytes" >&2 ; \ 7243e6f94cSMarcel Ziswiler echo " excess: $$((actual - limit)) bytes" >&2; \ 7343e6f94cSMarcel Ziswiler exit 1; \ 7443e6f94cSMarcel Ziswiler fi 7543e6f94cSMarcel Ziswilerelse 7643e6f94cSMarcel ZiswilerBOARD_SIZE_CHECK = 7743e6f94cSMarcel Ziswilerendif 7843e6f94cSMarcel Ziswiler 79552a848eSStefano BabicPLUGIN = board/$(BOARDDIR)/plugin 80552a848eSStefano Babic 81552a848eSStefano Babicifeq ($(CONFIG_USE_IMXIMG_PLUGIN),y) 82552a848eSStefano Babic 83552a848eSStefano Babic$(PLUGIN).o: $(PLUGIN).S FORCE 84552a848eSStefano Babic $(Q)mkdir -p $(dir $@) 85552a848eSStefano Babic $(call if_changed_dep,as_o_S) 86552a848eSStefano Babic 87552a848eSStefano Babic$(PLUGIN).bin: $(PLUGIN).o FORCE 88552a848eSStefano Babic $(Q)mkdir -p $(dir $@) 89552a848eSStefano Babic $(OBJCOPY) -O binary --gap-fill 0xff $< $@ 90552a848eSStefano Babicelse 91552a848eSStefano Babic 92552a848eSStefano Babic$(PLUGIN).bin: 93552a848eSStefano Babic 94552a848eSStefano Babicendif 95552a848eSStefano Babic 96552a848eSStefano Babicquiet_cmd_cpp_cfg = CFGS $@ 97552a848eSStefano Babic cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $< 98552a848eSStefano Babic 99f9167573STrent Piepho# mkimage source config file 100f9167573STrent PiephoIMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%) 101552a848eSStefano Babic 102f9167573STrent Piepho# How to create a cpp processed config file, they all use the same source 103f9167573STrent Piepho%.cfgout: $(IMX_CONFIG) FORCE 104552a848eSStefano Babic $(Q)mkdir -p $(dir $@) 105552a848eSStefano Babic $(call if_changed_dep,cpp_cfg) 106552a848eSStefano Babic 1070e5c8ce7SPeng Fanifeq ($(CONFIG_ARCH_IMX8), y) 108d7961159SPeng FanCNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh 109d7961159SPeng FanIMAGE_TYPE := imx8image 110caceb739SPeng FanSPL_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) 1114ac94bfaSPeng FanDEPFILE_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) 11294df9885SPeng Fanelse ifeq ($(CONFIG_ARCH_IMX8M), y) 11394df9885SPeng FanIMAGE_TYPE := imx8mimage 11494df9885SPeng FanIMX8M_DEPFILES := $(srctree)/tools/imx8m_image.sh 11594df9885SPeng FanDEPFILE_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) 116d7961159SPeng Fanelse 117d7961159SPeng FanIMAGE_TYPE := imximage 118d7961159SPeng FanDEPFILE_EXISTS := 0 1190e5c8ce7SPeng Fanendif 1200e5c8ce7SPeng Fan 1210e5c8ce7SPeng FanMKIMAGEFLAGS_u-boot.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ 1220e5c8ce7SPeng Fan -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE) 123552a848eSStefano Babicu-boot.imx: MKIMAGEOUTPUT = u-boot.imx.log 124552a848eSStefano Babic 125f9167573STrent Piephou-boot.imx: u-boot.bin u-boot.cfgout $(PLUGIN).bin FORCE 126552a848eSStefano Babic $(call if_changed,mkimage) 12743e6f94cSMarcel Ziswiler $(BOARD_SIZE_CHECK) 128552a848eSStefano Babic 129552a848eSStefano Babicifeq ($(CONFIG_OF_SEPARATE),y) 1300e5c8ce7SPeng FanMKIMAGEFLAGS_u-boot-dtb.imx = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ 1310e5c8ce7SPeng Fan -T $(IMAGE_TYPE) -e $(CONFIG_SYS_TEXT_BASE) 132552a848eSStefano Babicu-boot-dtb.imx: MKIMAGEOUTPUT = u-boot-dtb.imx.log 133552a848eSStefano Babic 134f9167573STrent Piephou-boot-dtb.imx: u-boot-dtb.bin u-boot-dtb.cfgout $(PLUGIN).bin FORCE 135d7961159SPeng Fanifeq ($(DEPFILE_EXISTS),0) 136552a848eSStefano Babic $(call if_changed,mkimage) 137552a848eSStefano Babicendif 138d7961159SPeng Fanendif 139552a848eSStefano Babic 14094df9885SPeng Fanifdef CONFIG_ARM64 14194df9885SPeng Fanifeq ($(CONFIG_ARCH_IMX8M), y) 14294df9885SPeng FanSPL: 14394df9885SPeng Fan 14494df9885SPeng FanMKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout \ 14594df9885SPeng Fan -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) 14694df9885SPeng Fanflash.bin: MKIMAGEOUTPUT = flash.log 14794df9885SPeng Fan 14894df9885SPeng Fanspl/u-boot-spl-ddr.bin: spl/u-boot-spl.bin spl/u-boot-spl.cfgout FORCE 14994df9885SPeng Fanifeq ($(DEPFILE_EXISTS),0) 15094df9885SPeng Fan $(IMX8M_DEPFILES) spl/u-boot-spl.cfgout 1 15194df9885SPeng Fanendif 15294df9885SPeng Fan 15394df9885SPeng Fanflash.bin: spl/u-boot-spl-ddr.bin u-boot.itb FORCE 15494df9885SPeng Fanifeq ($(DEPFILE_EXISTS),0) 15594df9885SPeng Fan $(call if_changed,mkimage) 15694df9885SPeng Fanendif 15794df9885SPeng Fanendif 15894df9885SPeng Fan 159caceb739SPeng Fanifeq ($(CONFIG_ARCH_IMX8), y) 160caceb739SPeng FanSPL: 161caceb739SPeng Fan 162caceb739SPeng FanMKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000 163caceb739SPeng Fanflash.bin: MKIMAGEOUTPUT = flash.log 164caceb739SPeng Fan 165caceb739SPeng Fanflash.bin: spl/u-boot-spl.bin u-boot.itb FORCE 166caceb739SPeng Fanifeq ($(SPL_DEPFILE_EXISTS),0) 167caceb739SPeng Fan $(call if_changed,mkimage) 168caceb739SPeng Fanendif 169caceb739SPeng Fanendif 170caceb739SPeng Fan 17194df9885SPeng Fanelse 1720e5c8ce7SPeng FanMKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \ 1730e5c8ce7SPeng Fan -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE) 174552a848eSStefano BabicSPL: MKIMAGEOUTPUT = SPL.log 175552a848eSStefano Babic 176f9167573STrent PiephoSPL: spl/u-boot-spl.bin spl/u-boot-spl.cfgout $(PLUGIN).bin FORCE 177552a848eSStefano Babic $(call if_changed,mkimage) 178552a848eSStefano Babic 179552a848eSStefano BabicMKIMAGEFLAGS_u-boot.uim = -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \ 180552a848eSStefano Babic -e $(CONFIG_SYS_TEXT_BASE) -C none -T firmware 181552a848eSStefano Babic 182552a848eSStefano Babicu-boot.uim: u-boot.bin FORCE 183552a848eSStefano Babic $(call if_changed,mkimage) 184552a848eSStefano Babic 185552a848eSStefano BabicOBJCOPYFLAGS += -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) 186552a848eSStefano Babicappend = cat $(filter-out $< $(PHONY), $^) >> $@ 187552a848eSStefano Babic 188552a848eSStefano Babicquiet_cmd_pad_cat = CAT $@ 189552a848eSStefano Babiccmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ 190552a848eSStefano Babic 191552a848eSStefano Babicu-boot-with-spl.imx: SPL u-boot.uim FORCE 192552a848eSStefano Babic $(call if_changed,pad_cat) 193552a848eSStefano Babic 194552a848eSStefano Babicu-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE 195552a848eSStefano Babic $(call if_changed,pad_cat) 196552a848eSStefano Babic 197552a848eSStefano Babicquiet_cmd_u-boot-nand-spl_imx = GEN $@ 198552a848eSStefano Babiccmd_u-boot-nand-spl_imx = (printf '\000\000\000\000\106\103\102\040\001' && \ 199552a848eSStefano Babic dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | cat - $< > $@ 200552a848eSStefano Babic 201552a848eSStefano Babicspl/u-boot-nand-spl.imx: SPL FORCE 202552a848eSStefano Babic $(call if_changed,u-boot-nand-spl_imx) 20394df9885SPeng Fanendif 204552a848eSStefano Babic 205f9167573STrent Piephotargets += $(addprefix ../../../,SPL spl/u-boot-spl.cfgout u-boot-dtb.cfgout u-boot.cfgout u-boot.uim spl/u-boot-nand-spl.imx) 206552a848eSStefano Babic 207de274663SPeng Fanobj-$(CONFIG_ARM64) += sip.o 208de274663SPeng Fan 209552a848eSStefano Babicobj-$(CONFIG_MX5) += mx5/ 210552a848eSStefano Babicobj-$(CONFIG_MX6) += mx6/ 211552a848eSStefano Babicobj-$(CONFIG_MX7) += mx7/ 212552a848eSStefano Babicobj-$(CONFIG_ARCH_MX7ULP) += mx7ulp/ 213cd357ad1SPeng Fanobj-$(CONFIG_IMX8M) += imx8m/ 214b2b8b9beSPeng Fanobj-$(CONFIG_ARCH_IMX8) += imx8/ 215