blob: f50d84b8c91a7fe844bd1f34cde658cb99274136 [file] [log] [blame]
Stefan Roese0b86db72008-03-03 17:27:02 +01001#
2# (C) Copyright 2008
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 Roese0b86db72008-03-03 17:27:02 +01006#
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 Roese0b86db72008-03-03 17:27:02 +010013LDSCRIPT= $(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 Roese0b86db72008-03-03 17:27:02 +010016AFLAGS += -DCONFIG_NAND_SPL
17CFLAGS += -DCONFIG_NAND_SPL
18
19SOBJS := start.o
Stefan Roese46fdeb12008-05-14 10:32:32 +020020SOBJS += init.o
Stefan Roese0b86db72008-03-03 17:27:02 +010021SOBJS += resetvec.o
22COBJS := ddr2_fixed.o
23COBJS += nand_boot.o
24COBJS += nand_ecc.o
25COBJS += ndfc.o
26
27SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
28OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
29__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050030LNDIR := $(nandobj)board/$(BOARDDIR)
Stefan Roese0b86db72008-03-03 17:27:02 +010031
32ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
33
34all: $(obj).depend $(ALL)
35
36$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
37 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
38
39$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
40 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
41
Wolfgang Denk18d46c02009-08-17 14:00:53 +020042$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060043 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Stefan Roese0b86db72008-03-03 17:27:02 +010044 -Map $(nandobj)u-boot-spl.map \
45 -o $(nandobj)u-boot-spl
46
Wolfgang Denk18d46c02009-08-17 14:00:53 +020047$(nandobj)u-boot.lds: $(LDSCRIPT)
48 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
49
Stefan Roese0b86db72008-03-03 17:27:02 +010050# create symbolic links for common files
51
52# from cpu directory
53$(obj)ndfc.c:
54 @rm -f $(obj)ndfc.c
Stefan Roese913fd052009-07-16 15:12:48 +020055 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c
Stefan Roese0b86db72008-03-03 17:27:02 +010056
57$(obj)resetvec.S:
58 @rm -f $(obj)resetvec.S
Stefan Roese88fbf932010-04-15 16:07:28 +020059 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
Stefan Roese0b86db72008-03-03 17:27:02 +010060
61$(obj)start.S:
62 @rm -f $(obj)start.S
Stefan Roese88fbf932010-04-15 16:07:28 +020063 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S
Stefan Roese0b86db72008-03-03 17:27:02 +010064
65# from board directory
66$(obj)init.S:
67 @rm -f $(obj)init.S
68 ln -s $(SRCTREE)/board/amcc/canyonlands/init.S $(obj)init.S
69
70# from nand_spl directory
71$(obj)nand_boot.c:
72 @rm -f $(obj)nand_boot.c
73 ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
74
75# from drivers/mtd/nand directory
76$(obj)nand_ecc.c:
77 @rm -f $(obj)nand_ecc.c
78 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c
79
Stefan Roese46fdeb12008-05-14 10:32:32 +020080ifneq ($(OBJTREE), $(SRCTREE))
81$(obj)ddr2_fixed.c:
82 @rm -f $(obj)ddr2_fixed.c
83 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/ddr2_fixed.c $(obj)ddr2_fixed.c
84endif
85
Stefan Roese0b86db72008-03-03 17:27:02 +010086#########################################################################
87
88$(obj)%.o: $(obj)%.S
89 $(CC) $(AFLAGS) -c -o $@ $<
90
91$(obj)%.o: $(obj)%.c
92 $(CC) $(CFLAGS) -c -o $@ $<
93
94# defines $(obj).depend target
95include $(SRCTREE)/rules.mk
96
97sinclude $(obj).depend
98
99#########################################################################