blob: a0e1455e3730569063186fce23cf5335c45fc724 [file] [log] [blame]
Mingkai Huc2a6dca2009-09-23 15:20:37 +08001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
5# Copyright 2009 Freescale Semiconductor, Inc.
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
Haiying Wang31b90122010-11-10 15:37:13 -050027CONFIG_SYS_TEXT_BASE_SPL := 0xfff00000
Mingkai Huc2a6dca2009-09-23 15:20:37 +080028PAD_TO := 0xfff01000
29
30include $(TOPDIR)/config.mk
31
Wolfgang Denk29547c62011-03-31 16:26:29 -050032nandobj := $(OBJTREE)/nand_spl/
33
Peter Tyserd53e8fd2010-04-12 22:28:02 -050034LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
Haiying Wang39358732011-02-22 16:38:05 -050035LDFLAGS := -T $(LDSCRIPT) -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS) \
36 $(LDFLAGS_FINAL)
Mingkai Huc2a6dca2009-09-23 15:20:37 +080037AFLAGS += -DCONFIG_NAND_SPL
38CFLAGS += -DCONFIG_NAND_SPL
39
40SOBJS = start.o resetvec.o
41COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
42 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
43
44SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
45OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
46__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050047LNDIR := $(nandobj)board/$(BOARDDIR)
Mingkai Huc2a6dca2009-09-23 15:20:37 +080048
49ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
50
51all: $(obj).depend $(ALL)
52
53$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
54 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
55
56$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
57 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
58
59$(nandobj)u-boot-spl: $(OBJS)
60 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
61 -Map $(nandobj)u-boot-spl.map \
62 -o $(nandobj)u-boot-spl
63
64# create symbolic links for common files
65
66$(obj)cache.c:
67 @rm -f $(obj)cache.c
Stefan Roese88fbf932010-04-15 16:07:28 +020068 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
Mingkai Huc2a6dca2009-09-23 15:20:37 +080069
70$(obj)cpu_init_early.c:
71 @rm -f $(obj)cpu_init_early.c
Stefan Roese88fbf932010-04-15 16:07:28 +020072 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c
Mingkai Huc2a6dca2009-09-23 15:20:37 +080073
74$(obj)cpu_init_nand.c:
75 @rm -f $(obj)cpu_init_nand.c
Stefan Roese88fbf932010-04-15 16:07:28 +020076 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c $(obj)cpu_init_nand.c
Mingkai Huc2a6dca2009-09-23 15:20:37 +080077
78$(obj)fsl_law.c:
79 @rm -f $(obj)fsl_law.c
80 ln -sf $(SRCTREE)/drivers/misc/fsl_law.c $(obj)fsl_law.c
81
82$(obj)law.c:
83 @rm -f $(obj)law.c
84 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
85
86$(obj)nand_boot_fsl_elbc.c:
87 @rm -f $(obj)nand_boot_fsl_elbc.c
88 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \
89 $(obj)nand_boot_fsl_elbc.c
90
91$(obj)ns16550.c:
92 @rm -f $(obj)ns16550.c
93 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
94
95$(obj)resetvec.S:
96 @rm -f $(obj)resetvec.S
Peter Tyserd53e8fd2010-04-12 22:28:02 -050097 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
Mingkai Huc2a6dca2009-09-23 15:20:37 +080098
99$(obj)fixed_ivor.S:
100 @rm -f $(obj)fixed_ivor.S
Stefan Roese88fbf932010-04-15 16:07:28 +0200101 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S
Mingkai Huc2a6dca2009-09-23 15:20:37 +0800102
103$(obj)start.S: $(obj)fixed_ivor.S
104 @rm -f $(obj)start.S
Stefan Roese88fbf932010-04-15 16:07:28 +0200105 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S
Mingkai Huc2a6dca2009-09-23 15:20:37 +0800106
107$(obj)tlb.c:
108 @rm -f $(obj)tlb.c
Stefan Roese88fbf932010-04-15 16:07:28 +0200109 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c
Mingkai Huc2a6dca2009-09-23 15:20:37 +0800110
111$(obj)tlb_table.c:
112 @rm -f $(obj)tlb_table.c
113 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
114
Kumar Galaaea58f42009-10-26 21:18:33 -0500115ifneq ($(OBJTREE), $(SRCTREE))
116$(obj)nand_boot.c:
117 @rm -f $(obj)nand_boot.c
118 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
119endif
120
Mingkai Huc2a6dca2009-09-23 15:20:37 +0800121#########################################################################
122
123$(obj)%.o: $(obj)%.S
124 $(CC) $(AFLAGS) -c -o $@ $<
125
126$(obj)%.o: $(obj)%.c
127 $(CC) $(CFLAGS) -c -o $@ $<
128
129# defines $(obj).depend target
130include $(SRCTREE)/rules.mk
131
132sinclude $(obj).depend
133
134#########################################################################