blob: 727a05280631df41fff152c1e798d92c504b4c5d [file] [log] [blame]
Jason Liu83aa8fe2011-11-25 00:18:01 +00001#
2# (C) Copyright 2000-2006
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
5# (C) Copyright 2011 Freescale Semiconductor, Inc.
6#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02007# SPDX-License-Identifier: GPL-2.0+
Jason Liu83aa8fe2011-11-25 00:18:01 +00008#
9
10include $(TOPDIR)/config.mk
11
12LIB = $(obj)libimx-common.o
13
Alison Wang831beaf2013-05-27 22:55:41 +000014ifeq ($(SOC),$(filter $(SOC),mx25 mx35 mx5 mx6 vf610))
Benoît Thébaudeau689a1582013-05-03 10:32:13 +000015COBJS-y = iomux-v3.o
16endif
Stefano Babic8c7238e2012-09-05 20:16:36 +000017ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
Benoît Thébaudeau689a1582013-05-03 10:32:13 +000018COBJS-y += timer.o cpu.o speed.o
Stefano Babic8c7238e2012-09-05 20:16:36 +000019COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o
20endif
Stefan Roese05b0ef42013-04-09 21:06:08 +000021ifeq ($(SOC),$(filter $(SOC),mx6 mxs))
22COBJS-y += misc.o
23endif
Troy Kisky0ca618c2012-08-15 10:31:20 +000024COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o
Eric Nelsonb94cfae2013-03-09 07:06:09 +000025COBJS-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
Troy Kiskyd4fdc992012-07-19 08:18:25 +000026COBJS := $(sort $(COBJS-y))
Jason Liu83aa8fe2011-11-25 00:18:01 +000027
28SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
29OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
30
31all: $(obj).depend $(LIB)
32
33$(LIB): $(OBJS)
34 $(call cmd_link_o_target, $(OBJS))
35
Troy Kiskya18d7862013-01-18 16:14:24 +000036$(OBJTREE)/$(patsubst "%",%,$(CONFIG_IMX_CONFIG)).cfgtmp: $(OBJTREE)/%.cfgtmp : $(SRCTREE)/%
37 mkdir -p $(dir $@)
38 $(CC) -E -x c $< $(CPPFLAGS) -o $@
39
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 $< $@
43
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 $< $@
47
Benoît Thébaudeaub2c79202013-04-11 09:35:56 +000048$(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
Marek Vasut652c09d2013-04-21 05:52:24 +000051 $(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 \
53 $(OBJTREE)/u-boot.uim
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
Benoît Thébaudeaub2c79202013-04-11 09:35:56 +000056
Benoît Thébaudeau393b98d2013-04-11 09:35:57 +000057$(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
Marek Vasut652c09d2013-04-21 05:52:24 +000065 $(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 \
67 $(OBJTREE)/u-boot.uim
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
Benoît Thébaudeau393b98d2013-04-11 09:35:57 +000070
Troy Kiskya18d7862013-01-18 16:14:24 +000071
Jason Liu83aa8fe2011-11-25 00:18:01 +000072#########################################################################
73
74# defines $(obj).depend target
75include $(SRCTREE)/rules.mk
76
77sinclude $(obj).depend
78
79#########################################################################