blob: d967846f74f871a47677566dae726d0ac99aec91 [file] [log] [blame]
Ron Madrid9ff89b72009-01-22 15:05:24 -08001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4# (C) Copyright 2008 Freescale Semiconductor
5# (C) Copyright Sheldon Instruments, Inc. 2008
6#
7# See file CREDITS for list of people who contributed to this
8# project.
9#
10# This program is free software; you can redistribute it and/or
11# modify it under the terms of the GNU General Public License as
12# published by the Free Software Foundation; either version 2 of
13# the License, or (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23# MA 02111-1307 USA
24#
25
26NAND_SPL := y
Ron Madrid9ff89b72009-01-22 15:05:24 -080027
28include $(TOPDIR)/config.mk
29
Wolfgang Denk29547c62011-03-31 16:26:29 -050030nandobj := $(OBJTREE)/nand_spl/
31
Ron Madrid9ff89b72009-01-22 15:05:24 -080032LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
Haiying Wang39358732011-02-22 16:38:05 -050033LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
34 $(LDFLAGS) $(LDFLAGS_FINAL)
Ron Madrid9ff89b72009-01-22 15:05:24 -080035AFLAGS += -DCONFIG_NAND_SPL
36CFLAGS += -DCONFIG_NAND_SPL
37
38SOBJS = start.o ticks.o
Scott Wood2b36fbb2012-12-06 13:33:17 +000039COBJS = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o spl_minimal.o \
Kim Phillips504b9242009-01-27 16:03:53 -060040 time.o cache.o
Ron Madrid9ff89b72009-01-22 15:05:24 -080041
42SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
43OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
44__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050045LNDIR := $(nandobj)board/$(BOARDDIR)
Ron Madrid9ff89b72009-01-22 15:05:24 -080046
47ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
48
49all: $(obj).depend $(ALL)
50
51$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
52 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
53
54$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
55 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
56
Wolfgang Denk18d46c02009-08-17 14:00:53 +020057$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060058 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Ron Madrid9ff89b72009-01-22 15:05:24 -080059 -Map $(nandobj)u-boot-spl.map \
60 -o $(nandobj)u-boot-spl
61
Wolfgang Denk18d46c02009-08-17 14:00:53 +020062$(nandobj)u-boot.lds: $(LDSCRIPT)
63 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
64
Ron Madrid9ff89b72009-01-22 15:05:24 -080065# create symbolic links for common files
66
67$(obj)start.S:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010068 @rm -f $@
Stefan Roese88fbf932010-04-15 16:07:28 +020069 ln -s $(SRCTREE)/arch/powerpc/cpu/mpc83xx/start.S $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080070
71$(obj)nand_boot_fsl_elbc.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010072 @rm -f $@
73 ln -s $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080074
75$(obj)sdram.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010076 @rm -f $@
77 ln -s $(SRCTREE)/board/$(BOARDDIR)/sdram.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080078
79$(obj)$(BOARD).c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010080 @rm -f $@
81 ln -s $(SRCTREE)/board/$(BOARDDIR)/$(BOARD).c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080082
83$(obj)ns16550.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010084 @rm -f $@
85 ln -s $(SRCTREE)/drivers/serial/ns16550.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080086
Scott Wood2b36fbb2012-12-06 13:33:17 +000087$(obj)spl_minimal.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010088 @rm -f $@
Scott Wood2b36fbb2012-12-06 13:33:17 +000089 ln -s $(SRCTREE)/arch/powerpc/cpu/mpc83xx/spl_minimal.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080090
Kim Phillips504b9242009-01-27 16:03:53 -060091$(obj)cache.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010092 @rm -f $@
Stefan Roese88fbf932010-04-15 16:07:28 +020093 ln -s $(SRCTREE)/arch/powerpc/lib/cache.c $@
Kim Phillips504b9242009-01-27 16:03:53 -060094
Ron Madrid9ff89b72009-01-22 15:05:24 -080095$(obj)time.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010096 @rm -f $@
Stefan Roese88fbf932010-04-15 16:07:28 +020097 ln -s $(SRCTREE)/arch/powerpc/lib/time.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080098
99$(obj)ticks.S:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +0100100 @rm -f $@
Stefan Roese88fbf932010-04-15 16:07:28 +0200101 ln -s $(SRCTREE)/arch/powerpc/lib/ticks.S $@
Ron Madrid9ff89b72009-01-22 15:05:24 -0800102
103#########################################################################
104
105$(obj)%.o: $(obj)%.S
106 $(CC) $(AFLAGS) -c -o $@ $<
107
108$(obj)%.o: $(obj)%.c
109 $(CC) $(CFLAGS) -c -o $@ $<
110
111# defines $(obj).depend target
112include $(SRCTREE)/rules.mk
113
114sinclude $(obj).depend
115
116#########################################################################