blob: fdfd015cf60031932d507ed86af72e2d6cf35631 [file] [log] [blame]
Chander Kashyap0d3c62e2011-05-24 20:02:57 +00001#
2# (C) Copyright 2006-2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
5# (C) Copyright 2008
6# Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
7#
8# (C) Copyright 2011
9# Chander Kashyap, Samsung Electronics, <k.chander@samsung.com>
10#
11# See file CREDITS for list of people who contributed to this
12# project.
13#
14# This program is free software; you can redistribute it and/or
15# modify it under the terms of the GNU General Public License as
16# published by the Free Software Foundation; either version 2 of
17# the License, or (at your option) any later version.
18#
19# This program is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with this program; if not, write to the Free Software
26# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27# MA 02111-1307 USA
28#
29
30CONFIG_MMC_SPL = y
31
32include $(TOPDIR)/config.mk
33
34LDSCRIPT= $(TOPDIR)/mmc_spl/board/$(BOARDDIR)/u-boot.lds
35LDFLAGS = -Bstatic -T $(mmcobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
36AFLAGS += -DCONFIG_MMC_SPL
37CFLAGS += -DCONFIG_MMC_SPL
Aneesh V401bb302011-07-13 05:11:07 +000038CFLAGS += -DCONFIG_SPL_BUILD
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000039
40SOBJS = start.o mem_setup.o lowlevel_init.o
41COBJS = mmc_boot.o
42
Chander Kashyap43c52f92011-06-02 18:07:32 +000043SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000044OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
45__OBJS := $(SOBJS) $(COBJS)
46LNDIR := $(OBJTREE)/mmc_spl/board/$(BOARDDIR)
47
48mmcobj := $(OBJTREE)/mmc_spl/
49
50
51MKV310_MMC_SPL_EXEC = mkv310_mmc_spl_exec
52MMC_SPL_BIN = u-boot-mmc-spl.bin
53
54ALL = $(mmcobj)u-boot-spl $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
55
56all: $(obj).depend $(ALL)
57
58$(mmcobj)$(MMC_SPL_BIN): $(mmcobj)u-boot-spl.bin tools/$(MKV310_MMC_SPL_EXEC)
59 ./tools/$(MKV310_MMC_SPL_EXEC) $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
60 rm -f tools/$(MKV310_MMC_SPL_EXEC)
61
62tools/$(MKV310_MMC_SPL_EXEC): tools/mkv310_image.c
63 $(HOSTCC) tools/mkv310_image.c -o tools/$(MKV310_MMC_SPL_EXEC)
64
65$(mmcobj)u-boot-spl.bin: $(mmcobj)u-boot-spl
66 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
67
68$(mmcobj)u-boot-spl: $(OBJS) $(mmcobj)u-boot.lds
69 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
70 -Map $(mmcobj)u-boot-spl.map \
71 -o $(mmcobj)u-boot-spl
72
73$(mmcobj)u-boot.lds: $(LDSCRIPT)
74 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
75
76# create symbolic links for common files
77
78# from cpu directory
Chander Kashyap43c52f92011-06-02 18:07:32 +000079start.S:
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000080 @rm -f $@
81 @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@
82
83# from board directory
Chander Kashyap43c52f92011-06-02 18:07:32 +000084mem_setup.S:
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000085 @rm -f $@
86 @ln -s $(TOPDIR)/board/samsung/smdkv310/mem_setup.S $@
87
Chander Kashyap43c52f92011-06-02 18:07:32 +000088lowlevel_init.S:
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000089 @rm -f $@
90 @ln -s $(TOPDIR)/board/samsung/smdkv310/lowlevel_init.S $@
91
92#########################################################################
93
Chander Kashyap43c52f92011-06-02 18:07:32 +000094$(obj)%.o: %.S
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000095 $(CC) $(AFLAGS) -c -o $@ $<
96
Chander Kashyap43c52f92011-06-02 18:07:32 +000097$(obj)%.o: %.c
Chander Kashyap0d3c62e2011-05-24 20:02:57 +000098 $(CC) $(CFLAGS) -c -o $@ $<
99
100# defines $(obj).depend target
101include $(SRCTREE)/rules.mk
102
103sinclude $(obj).depend
104
105#########################################################################