blob: 9b2c0d7f35711b81fcef00fc19bfb9cf64299370 [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
Marek Vasuta0603a32012-10-19 05:00:10 +000030LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
Roy Zang3e9ecf82011-06-09 11:30:52 +080031LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
32 $(LDFLAGS) $(LDFLAGS_FINAL)
33AFLAGS += -DCONFIG_NAND_SPL
34CFLAGS += -DCONFIG_NAND_SPL
35
36SOBJS = start.o resetvec.o
Scott Wood5847d782012-09-20 16:35:21 -050037COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
Scott Woodfac86242012-08-17 19:46:29 -050038 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
Roy Zang3e9ecf82011-06-09 11:30:52 +080039
40SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
41OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
42__OBJS := $(SOBJS) $(COBJS)
43LNDIR := $(nandobj)board/$(BOARDDIR)
44
45ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
46
47all: $(obj).depend $(ALL)
48
49$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
50 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
51
52$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
53 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
54
55$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
56 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
57 -Map $(nandobj)u-boot-spl.map \
58 -o $(nandobj)u-boot-spl
59
Marek Vasuta0603a32012-10-19 05:00:10 +000060# The following line expands into whole rule which generates $(LSTSCRIPT),
61# the file containing u-boots LG-array linker section. This is included into
62# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file.
63$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS)))
64$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) $(LSTSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000065 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
66 -ansi -D__ASSEMBLY__ -P - <$< >$@
Roy Zang3e9ecf82011-06-09 11:30:52 +080067
68# create symbolic links for common files
69
70$(obj)cache.c:
71 @rm -f $(obj)cache.c
72 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
73
74$(obj)cpu_init_early.c:
75 @rm -f $(obj)cpu_init_early.c
76 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c
77
Scott Wood5847d782012-09-20 16:35:21 -050078$(obj)spl_minimal.c:
79 @rm -f $(obj)spl_minimal.c
80 ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $(obj)spl_minimal.c
Roy Zang3e9ecf82011-06-09 11:30:52 +080081
82$(obj)fsl_law.c:
83 @rm -f $(obj)fsl_law.c
Scott Wood3d488722012-08-17 16:17:50 -050084 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c
Roy Zang3e9ecf82011-06-09 11:30:52 +080085
86$(obj)law.c:
87 @rm -f $(obj)law.c
88 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
89
90$(obj)nand_boot_fsl_elbc.c:
91 @rm -f $(obj)nand_boot_fsl_elbc.c
92 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \
93 $(obj)nand_boot_fsl_elbc.c
94
95$(obj)ns16550.c:
96 @rm -f $(obj)ns16550.c
97 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
98
99$(obj)resetvec.S:
100 @rm -f $(obj)resetvec.S
101 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
102
103$(obj)fixed_ivor.S:
104 @rm -f $(obj)fixed_ivor.S
105 ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S
106
107$(obj)start.S: $(obj)fixed_ivor.S
108 @rm -f $(obj)start.S
109 ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S
110
111$(obj)tlb.c:
112 @rm -f $(obj)tlb.c
113 ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c
114
115$(obj)tlb_table.c:
116 @rm -f $(obj)tlb_table.c
117 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
118
119ifneq ($(OBJTREE), $(SRCTREE))
120$(obj)nand_boot.c:
121 @rm -f $(obj)nand_boot.c
122 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
Roy Zang3e9ecf82011-06-09 11:30:52 +0800123endif
124
125#########################################################################
126
127$(obj)%.o: $(obj)%.S
128 $(CC) $(AFLAGS) -c -o $@ $<
129
130$(obj)%.o: $(obj)%.c
131 $(CC) $(CFLAGS) -c -o $@ $<
132
133# defines $(obj).depend target
134include $(SRCTREE)/rules.mk
135
136sinclude $(obj).depend
137
138#########################################################################