]>
Commit | Line | Data |
---|---|---|
3f7f6b85 RZ |
1 | # |
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 | # | |
22 | NAND_SPL := y | |
23 | PAD_TO := 0xfff01000 | |
24 | ||
25 | include $(TOPDIR)/config.mk | |
26 | ||
27 | nandobj := $(OBJTREE)/nand_spl/ | |
28 | ||
29 | LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds | |
97b24d3d | 30 | LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst |
3f7f6b85 RZ |
31 | LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \ |
32 | $(LDFLAGS) $(LDFLAGS_FINAL) | |
33 | AFLAGS += -DCONFIG_NAND_SPL | |
34 | CFLAGS += -DCONFIG_NAND_SPL | |
35 | ||
36 | SOBJS = start.o resetvec.o | |
37 | COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \ | |
02ea538c MM |
38 | nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o \ |
39 | ../common.o | |
3f7f6b85 RZ |
40 | |
41 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) | |
42 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) | |
43 | __OBJS := $(SOBJS) $(COBJS) | |
44 | LNDIR := $(nandobj)board/$(BOARDDIR) | |
45 | ||
46 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin | |
47 | ||
48 | all: $(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 | ||
97b24d3d MV |
61 | # 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) | |
a6d0f62a SW |
66 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ |
67 | -ansi -D__ASSEMBLY__ -P - <$< >$@ | |
3f7f6b85 RZ |
68 | |
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 | |
8bc50f0b | 85 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c |
3f7f6b85 RZ |
86 | |
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 | ||
120 | ifneq ($(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 | |
02ea538c MM |
124 | $(obj)../common.c: |
125 | @rm -f $(obj)../common.c | |
126 | ln -s $(SRCTREE)/nand_spl/board/freescale/common.c $(obj)../common.c | |
3f7f6b85 RZ |
127 | endif |
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 | |
138 | include $(SRCTREE)/rules.mk | |
139 | ||
140 | sinclude $(obj).depend | |
141 | ||
142 | ######################################################################### |