blob: fb7d5612a1ce017cbb80ac857915d5326d8fb03f [file] [log] [blame]
Roy Zang3e9ecf82011-06-09 11:30:52 +08001#
2# Copyright 2010-2011 Freescale Semiconductor, Inc.
3#
4# See file CREDITS for list of people who contributed to this
5# project.
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2 of
10# the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20# MA 02111-1307 USA
21#
22NAND_SPL := y
23PAD_TO := 0xfff01000
24
25include $(TOPDIR)/config.mk
26
27nandobj := $(OBJTREE)/nand_spl/
28
29LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
30LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
31 $(LDFLAGS) $(LDFLAGS_FINAL)
32AFLAGS += -DCONFIG_NAND_SPL
33CFLAGS += -DCONFIG_NAND_SPL
34
35SOBJS = start.o resetvec.o
Scott Wood5847d782012-09-20 16:35:21 -050036COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
Scott Woodfac86242012-08-17 19:46:29 -050037 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
Roy Zang3e9ecf82011-06-09 11:30:52 +080038
39SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
40OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
41__OBJS := $(SOBJS) $(COBJS)
42LNDIR := $(nandobj)board/$(BOARDDIR)
43
44ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
45
46all: $(obj).depend $(ALL)
47
48$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
49 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
50
51$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
52 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
53
54$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
55 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
56 -Map $(nandobj)u-boot-spl.map \
57 -o $(nandobj)u-boot-spl
58
Albert ARIBAUDc24895e2013-02-25 00:59:00 +000059$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000060 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
61 -ansi -D__ASSEMBLY__ -P - <$< >$@
Roy Zang3e9ecf82011-06-09 11:30:52 +080062
63# create symbolic links for common files
64
65$(obj)cache.c:
66 @rm -f $(obj)cache.c
67 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
68
69$(obj)cpu_init_early.c:
70 @rm -f $(obj)cpu_init_early.c
71 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c
72
Scott Wood5847d782012-09-20 16:35:21 -050073$(obj)spl_minimal.c:
74 @rm -f $(obj)spl_minimal.c
75 ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $(obj)spl_minimal.c
Roy Zang3e9ecf82011-06-09 11:30:52 +080076
77$(obj)fsl_law.c:
78 @rm -f $(obj)fsl_law.c
Scott Wood3d488722012-08-17 16:17:50 -050079 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c
Roy Zang3e9ecf82011-06-09 11:30:52 +080080
81$(obj)law.c:
82 @rm -f $(obj)law.c
83 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
84
85$(obj)nand_boot_fsl_elbc.c:
86 @rm -f $(obj)nand_boot_fsl_elbc.c
87 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \
88 $(obj)nand_boot_fsl_elbc.c
89
90$(obj)ns16550.c:
91 @rm -f $(obj)ns16550.c
92 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
93
94$(obj)resetvec.S:
95 @rm -f $(obj)resetvec.S
96 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
97
98$(obj)fixed_ivor.S:
99 @rm -f $(obj)fixed_ivor.S
100 ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S
101
102$(obj)start.S: $(obj)fixed_ivor.S
103 @rm -f $(obj)start.S
104 ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S
105
106$(obj)tlb.c:
107 @rm -f $(obj)tlb.c
108 ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c
109
110$(obj)tlb_table.c:
111 @rm -f $(obj)tlb_table.c
112 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
113
114ifneq ($(OBJTREE), $(SRCTREE))
115$(obj)nand_boot.c:
116 @rm -f $(obj)nand_boot.c
117 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
Roy Zang3e9ecf82011-06-09 11:30:52 +0800118endif
119
120#########################################################################
121
122$(obj)%.o: $(obj)%.S
123 $(CC) $(AFLAGS) -c -o $@ $<
124
125$(obj)%.o: $(obj)%.c
126 $(CC) $(CFLAGS) -c -o $@ $<
127
128# defines $(obj).depend target
129include $(SRCTREE)/rules.mk
130
131sinclude $(obj).depend
132
133#########################################################################