2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 # (C) Copyright 2011 Freescale Semiconductor, Inc.
7 # SPDX-License-Identifier: GPL-2.0+
10 include $(TOPDIR)/config.mk
12 LIB = $(obj)libimx-common.o
14 ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 vf610))
17 ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
18 COBJS-y += timer.o cpu.o speed.o
19 COBJS-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
21 ifeq ($(SOC),$(filter $(SOC),mx6 mxs))
24 COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o
25 COBJS-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
26 COBJS := $(sort $(COBJS-y))
28 SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
29 OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
31 all: $(obj).depend $(LIB)
34 $(call cmd_link_o_target, $(OBJS))
36 $(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp: $(OBJTREE)/%.cfgtmp : $(SRCTREE)/%
38 $(CC) -E -x c $< $(CPPFLAGS) -o $@
40 $(OBJTREE)/u-boot.imx: $(OBJTREE)/u-boot.bin $(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp
41 $(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
42 -e $(CONFIG_SYS_TEXT_BASE) -d $< $@
44 $(OBJTREE)/SPL: $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp
45 $(OBJTREE)/tools/mkimage -n $(filter-out %.bin,$^) -T imximage \
46 -e $(CONFIG_SPL_TEXT_BASE) -d $< $@
48 $(OBJTREE)/u-boot-with-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
49 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
50 -I binary -O binary $< $(OBJTREE)/spl/u-boot-spl-pad.imx
51 $(OBJTREE)/tools/mkimage -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
52 -e $(CONFIG_SYS_TEXT_BASE) -C none -d $(OBJTREE)/u-boot.bin \
54 cat $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.uim > $@
55 rm $(OBJTREE)/spl/u-boot-spl-pad.imx $(OBJTREE)/u-boot.uim
57 $(OBJTREE)/u-boot-with-nand-spl.imx: $(OBJTREE)/SPL $(OBJTREE)/u-boot.bin
58 (echo -ne '\x00\x00\x00\x00\x46\x43\x42\x20\x01' && \
59 dd bs=1015 count=1 if=/dev/zero 2>/dev/null) | \
60 cat - $< > $(OBJTREE)/spl/u-boot-nand-spl.imx
61 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
62 -I binary -O binary $(OBJTREE)/spl/u-boot-nand-spl.imx \
63 $(OBJTREE)/spl/u-boot-nand-spl-pad.imx
64 rm $(OBJTREE)/spl/u-boot-nand-spl.imx
65 $(OBJTREE)/tools/mkimage -A arm -O U-Boot -a $(CONFIG_SYS_TEXT_BASE) \
66 -e $(CONFIG_SYS_TEXT_BASE) -C none -d $(OBJTREE)/u-boot.bin \
68 cat $(OBJTREE)/spl/u-boot-nand-spl-pad.imx $(OBJTREE)/u-boot.uim > $@
69 rm $(OBJTREE)/spl/u-boot-nand-spl-pad.imx $(OBJTREE)/u-boot.uim
72 #########################################################################
74 # defines $(obj).depend target
75 include $(SRCTREE)/rules.mk
77 sinclude $(obj).depend
79 #########################################################################