blob: 20199c7f73aa227214b02107fbd143a787772359 [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
27TEXT_BASE := 0xfff00000
28
29include $(TOPDIR)/config.mk
30
31LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
32LDFLAGS = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
33AFLAGS += -DCONFIG_NAND_SPL
34CFLAGS += -DCONFIG_NAND_SPL
35
36SOBJS = start.o ticks.o
Kim Phillips504b9242009-01-27 16:03:53 -060037COBJS = nand_boot_fsl_elbc.o $(BOARD).o sdram.o ns16550.o nand_init.o \
38 time.o cache.o
Ron Madrid9ff89b72009-01-22 15:05:24 -080039
40SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
41OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
42__OBJS := $(SOBJS) $(COBJS)
43LNDIR := $(OBJTREE)/nand_spl/board/$(BOARDDIR)
44
45nandobj := $(OBJTREE)/nand_spl/
46
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
57$(nandobj)u-boot-spl: $(OBJS)
58 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
59 -Map $(nandobj)u-boot-spl.map \
60 -o $(nandobj)u-boot-spl
61
62# create symbolic links for common files
63
64$(obj)start.S:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010065 @rm -f $@
66 ln -s $(SRCTREE)/cpu/mpc83xx/start.S $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080067
68$(obj)nand_boot_fsl_elbc.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010069 @rm -f $@
70 ln -s $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080071
72$(obj)sdram.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010073 @rm -f $@
74 ln -s $(SRCTREE)/board/$(BOARDDIR)/sdram.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080075
76$(obj)$(BOARD).c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010077 @rm -f $@
78 ln -s $(SRCTREE)/board/$(BOARDDIR)/$(BOARD).c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080079
80$(obj)ns16550.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010081 @rm -f $@
82 ln -s $(SRCTREE)/drivers/serial/ns16550.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080083
84$(obj)nand_init.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010085 @rm -f $@
86 ln -s $(SRCTREE)/cpu/mpc83xx/nand_init.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080087
Kim Phillips504b9242009-01-27 16:03:53 -060088$(obj)cache.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010089 @rm -f $@
90 ln -s $(SRCTREE)/lib_ppc/cache.c $@
Kim Phillips504b9242009-01-27 16:03:53 -060091
Ron Madrid9ff89b72009-01-22 15:05:24 -080092$(obj)time.c:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010093 @rm -f $@
94 ln -s $(SRCTREE)/lib_ppc/time.c $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080095
96$(obj)ticks.S:
Wolfgang Denkc2dcb8a2009-03-09 10:51:39 +010097 @rm -f $@
98 ln -s $(SRCTREE)/lib_ppc/ticks.S $@
Ron Madrid9ff89b72009-01-22 15:05:24 -080099
100#########################################################################
101
102$(obj)%.o: $(obj)%.S
103 $(CC) $(AFLAGS) -c -o $@ $<
104
105$(obj)%.o: $(obj)%.c
106 $(CC) $(CFLAGS) -c -o $@ $<
107
108# defines $(obj).depend target
109include $(SRCTREE)/rules.mk
110
111sinclude $(obj).depend
112
113#########################################################################