blob: ca3dab4f2557a525f52a1e1f1b8160fd65690c1a [file] [log] [blame]
Stefan Roese42743512007-06-01 15:27:11 +02001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
Stefan Roese42743512007-06-01 15:27:11 +02006#
7
8include $(TOPDIR)/config.mk
9include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
10
Wolfgang Denk29547c62011-03-31 16:26:29 -050011nandobj := $(OBJTREE)/nand_spl/
12
Stefan Roese42743512007-06-01 15:27:11 +020013LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
Haiying Wang39358732011-02-22 16:38:05 -050014LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
15 $(LDFLAGS_FINAL)
Stefan Roese42743512007-06-01 15:27:11 +020016AFLAGS += -DCONFIG_NAND_SPL
17CFLAGS += -DCONFIG_NAND_SPL
18
19SOBJS = start.o init.o resetvec.o
20COBJS = nand_boot.o nand_ecc.o ndfc.o sdram.o
21
22SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
23OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
24__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050025LNDIR := $(nandobj)board/$(BOARDDIR)
Stefan Roese42743512007-06-01 15:27:11 +020026
27ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
28
29all: $(obj).depend $(ALL)
30
31$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
32 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
33
34$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
35 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
36
Wolfgang Denk18d46c02009-08-17 14:00:53 +020037$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060038 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Stefan Roese42743512007-06-01 15:27:11 +020039 -Map $(nandobj)u-boot-spl.map \
40 -o $(nandobj)u-boot-spl
41
Wolfgang Denk18d46c02009-08-17 14:00:53 +020042$(nandobj)u-boot.lds: $(LDSCRIPT)
43 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
44
Stefan Roese42743512007-06-01 15:27:11 +020045# create symbolic links for common files
46
47# from cpu directory
48$(obj)ndfc.c:
49 @rm -f $(obj)ndfc.c
Stefan Roese913fd052009-07-16 15:12:48 +020050 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c
Stefan Roese42743512007-06-01 15:27:11 +020051
52$(obj)resetvec.S:
53 @rm -f $(obj)resetvec.S
Stefan Roese88fbf932010-04-15 16:07:28 +020054 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
Stefan Roese42743512007-06-01 15:27:11 +020055
56$(obj)start.S:
57 @rm -f $(obj)start.S
Stefan Roese88fbf932010-04-15 16:07:28 +020058 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S
Stefan Roese42743512007-06-01 15:27:11 +020059
60# from board directory
61$(obj)init.S:
62 @rm -f $(obj)init.S
63 ln -s $(SRCTREE)/board/amcc/bamboo/init.S $(obj)init.S
64
65# from nand_spl directory
66$(obj)nand_boot.c:
67 @rm -f $(obj)nand_boot.c
68 ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
69
Marcel Ziswileraea68562007-12-30 03:30:46 +010070# from drivers/mtd/nand directory
Stefan Roese42743512007-06-01 15:27:11 +020071$(obj)nand_ecc.c:
72 @rm -f $(obj)nand_ecc.c
Jean-Christophe PLAGNIOL-VILLARD82ca9742007-11-24 21:26:56 +010073 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c
Stefan Roese42743512007-06-01 15:27:11 +020074
Grzegorz Bernackia3813092007-09-11 12:57:52 +020075ifneq ($(OBJTREE), $(SRCTREE))
76$(obj)sdram.c:
77 @rm -f $(obj)sdram.c
78 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/sdram.c $(obj)sdram.c
79endif
80
Stefan Roese42743512007-06-01 15:27:11 +020081#########################################################################
82
83$(obj)%.o: $(obj)%.S
84 $(CC) $(AFLAGS) -c -o $@ $<
85
86$(obj)%.o: $(obj)%.c
87 $(CC) $(CFLAGS) -c -o $@ $<
88
89# defines $(obj).depend target
90include $(SRCTREE)/rules.mk
91
92sinclude $(obj).depend
93
94#########################################################################