blob: 451f469b0c42885b610217b0427136d9518ff94b [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
37COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
Matthew McClintock90a2c6c2012-08-13 10:00:40 +000038 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o \
39 ../common.o
Roy Zang3e9ecf82011-06-09 11:30:52 +080040
41SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
42OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
43__OBJS := $(SOBJS) $(COBJS)
44LNDIR := $(nandobj)board/$(BOARDDIR)
45
46ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
47
48all: $(obj).depend $(ALL)
49
50$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
51 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
52
53$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
54 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
55
56$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
57 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
58 -Map $(nandobj)u-boot-spl.map \
59 -o $(nandobj)u-boot-spl
60
Marek Vasuta0603a32012-10-19 05:00:10 +000061# The following line expands into whole rule which generates $(LSTSCRIPT),
62# the file containing u-boots LG-array linker section. This is included into
63# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file.
64$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS)))
65$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) $(LSTSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000066 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
67 -ansi -D__ASSEMBLY__ -P - <$< >$@
Roy Zang3e9ecf82011-06-09 11:30:52 +080068
69# create symbolic links for common files
70
71$(obj)cache.c:
72 @rm -f $(obj)cache.c
73 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
74
75$(obj)cpu_init_early.c:
76 @rm -f $(obj)cpu_init_early.c
77 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c
78
79$(obj)cpu_init_nand.c:
80 @rm -f $(obj)cpu_init_nand.c
81 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_nand.c $(obj)cpu_init_nand.c
82
83$(obj)fsl_law.c:
84 @rm -f $(obj)fsl_law.c
Scott Wood3d488722012-08-17 16:17:50 -050085 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c
Roy Zang3e9ecf82011-06-09 11:30:52 +080086
87$(obj)law.c:
88 @rm -f $(obj)law.c
89 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
90
91$(obj)nand_boot_fsl_elbc.c:
92 @rm -f $(obj)nand_boot_fsl_elbc.c
93 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \
94 $(obj)nand_boot_fsl_elbc.c
95
96$(obj)ns16550.c:
97 @rm -f $(obj)ns16550.c
98 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
99
100$(obj)resetvec.S:
101 @rm -f $(obj)resetvec.S
102 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
103
104$(obj)fixed_ivor.S:
105 @rm -f $(obj)fixed_ivor.S
106 ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S
107
108$(obj)start.S: $(obj)fixed_ivor.S
109 @rm -f $(obj)start.S
110 ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S
111
112$(obj)tlb.c:
113 @rm -f $(obj)tlb.c
114 ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c
115
116$(obj)tlb_table.c:
117 @rm -f $(obj)tlb_table.c
118 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
119
120ifneq ($(OBJTREE), $(SRCTREE))
121$(obj)nand_boot.c:
122 @rm -f $(obj)nand_boot.c
123 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
Matthew McClintock90a2c6c2012-08-13 10:00:40 +0000124$(obj)../common.c:
125 @rm -f $(obj)../common.c
126 ln -s $(SRCTREE)/nand_spl/board/freescale/common.c $(obj)../common.c
Roy Zang3e9ecf82011-06-09 11:30:52 +0800127endif
128
129#########################################################################
130
131$(obj)%.o: $(obj)%.S
132 $(CC) $(AFLAGS) -c -o $@ $<
133
134$(obj)%.o: $(obj)%.c
135 $(CC) $(CFLAGS) -c -o $@ $<
136
137# defines $(obj).depend target
138include $(SRCTREE)/rules.mk
139
140sinclude $(obj).depend
141
142#########################################################################