blob: 85f48380d5e84c79a03475efc787ea4fc6c9c3de [file] [log] [blame]
Chander Kashyap7fc795f2011-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
Chander Kashyapc9076522011-07-27 20:36:30 +000037AFLAGS += -DCONFIG_SPL_BUILD
Chander Kashyap7fc795f2011-05-24 20:02:57 +000038CFLAGS += -DCONFIG_MMC_SPL
Aneesh V552a3192011-07-13 05:11:07 +000039CFLAGS += -DCONFIG_SPL_BUILD
Chander Kashyap7fc795f2011-05-24 20:02:57 +000040
41SOBJS = start.o mem_setup.o lowlevel_init.o
42COBJS = mmc_boot.o
43
Chander Kashyap80b0af52011-06-02 18:07:32 +000044SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
Chander Kashyap7fc795f2011-05-24 20:02:57 +000045OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
46__OBJS := $(SOBJS) $(COBJS)
47LNDIR := $(OBJTREE)/mmc_spl/board/$(BOARDDIR)
48
49mmcobj := $(OBJTREE)/mmc_spl/
50
51
52MKV310_MMC_SPL_EXEC = mkv310_mmc_spl_exec
53MMC_SPL_BIN = u-boot-mmc-spl.bin
54
55ALL = $(mmcobj)u-boot-spl $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
56
57all: $(obj).depend $(ALL)
58
59$(mmcobj)$(MMC_SPL_BIN): $(mmcobj)u-boot-spl.bin tools/$(MKV310_MMC_SPL_EXEC)
60 ./tools/$(MKV310_MMC_SPL_EXEC) $(mmcobj)u-boot-spl.bin $(mmcobj)$(MMC_SPL_BIN)
61 rm -f tools/$(MKV310_MMC_SPL_EXEC)
62
63tools/$(MKV310_MMC_SPL_EXEC): tools/mkv310_image.c
64 $(HOSTCC) tools/mkv310_image.c -o tools/$(MKV310_MMC_SPL_EXEC)
65
66$(mmcobj)u-boot-spl.bin: $(mmcobj)u-boot-spl
67 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
68
69$(mmcobj)u-boot-spl: $(OBJS) $(mmcobj)u-boot.lds
70 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
71 -Map $(mmcobj)u-boot-spl.map \
72 -o $(mmcobj)u-boot-spl
73
74$(mmcobj)u-boot.lds: $(LDSCRIPT)
75 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
76
77# create symbolic links for common files
78
79# from cpu directory
Chander Kashyap80b0af52011-06-02 18:07:32 +000080start.S:
Chander Kashyap7fc795f2011-05-24 20:02:57 +000081 @rm -f $@
82 @ln -s $(TOPDIR)/arch/arm/cpu/armv7/start.S $@
83
84# from board directory
Chander Kashyap80b0af52011-06-02 18:07:32 +000085mem_setup.S:
Chander Kashyap7fc795f2011-05-24 20:02:57 +000086 @rm -f $@
87 @ln -s $(TOPDIR)/board/samsung/smdkv310/mem_setup.S $@
88
Chander Kashyap80b0af52011-06-02 18:07:32 +000089lowlevel_init.S:
Chander Kashyap7fc795f2011-05-24 20:02:57 +000090 @rm -f $@
91 @ln -s $(TOPDIR)/board/samsung/smdkv310/lowlevel_init.S $@
92
93#########################################################################
94
Chander Kashyap80b0af52011-06-02 18:07:32 +000095$(obj)%.o: %.S
Chander Kashyap7fc795f2011-05-24 20:02:57 +000096 $(CC) $(AFLAGS) -c -o $@ $<
97
Chander Kashyap80b0af52011-06-02 18:07:32 +000098$(obj)%.o: %.c
Chander Kashyap7fc795f2011-05-24 20:02:57 +000099 $(CC) $(CFLAGS) -c -o $@ $<
100
101# defines $(obj).depend target
102include $(SRCTREE)/rules.mk
103
104sinclude $(obj).depend
105
106#########################################################################