blob: 5899b9efe835ea5f99958feeebf8f485c41c1653 [file] [log] [blame]
Stefan Roese720c5852007-11-03 12:08:28 +01001#
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 Roese720c5852007-11-03 12:08:28 +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 Roese720c5852007-11-03 12:08:28 +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 Roese720c5852007-11-03 12:08:28 +010016AFLAGS += -DCONFIG_NAND_SPL
17CFLAGS += -DCONFIG_NAND_SPL
18
Stefan Roesea226c852008-06-02 17:13:55 +020019SOBJS = start.o resetvec.o cache.o
20COBJS = 44x_spd_ddr2.o nand_boot.o nand_ecc.o ndfc.o
Stefan Roese720c5852007-11-03 12:08:28 +010021
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 Roese720c5852007-11-03 12:08:28 +010026
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090027all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
Stefan Roese720c5852007-11-03 12:08:28 +010028
29$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
30 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
31
32$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
33 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
34
Wolfgang Denk18d46c02009-08-17 14:00:53 +020035$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060036 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090037 -Map $(nandobj)u-boot-spl.map -o $@
Stefan Roese720c5852007-11-03 12:08:28 +010038
Wolfgang Denk18d46c02009-08-17 14:00:53 +020039$(nandobj)u-boot.lds: $(LDSCRIPT)
40 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
41
Stefan Roese720c5852007-11-03 12:08:28 +010042# create symbolic links for common files
43
44# from cpu directory
Stefan Roese37628252008-08-06 14:05:38 +020045$(obj)44x_spd_ddr2.c: $(obj)ecc.h
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090046 @rm -f $@
47 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c $@
Stefan Roesea226c852008-06-02 17:13:55 +020048
Stefan Roese720c5852007-11-03 12:08:28 +010049$(obj)cache.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090050 @rm -f $@
51 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $@
Stefan Roese720c5852007-11-03 12:08:28 +010052
Stefan Roesea226c852008-06-02 17:13:55 +020053$(obj)ecc.h:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090054 @rm -f $@
55 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/ecc.h $@
Stefan Roesea226c852008-06-02 17:13:55 +020056
Stefan Roese720c5852007-11-03 12:08:28 +010057$(obj)ndfc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090058 @rm -f $@
59 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
Stefan Roese720c5852007-11-03 12:08:28 +010060
61$(obj)resetvec.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090062 @rm -f $@
63 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
Stefan Roese720c5852007-11-03 12:08:28 +010064
65$(obj)start.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090066 @rm -f $@
67 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
Stefan Roese720c5852007-11-03 12:08:28 +010068
Stefan Roese720c5852007-11-03 12:08:28 +010069# from nand_spl directory
70$(obj)nand_boot.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090071 @rm -f $@
72 ln -s $(SRCTREE)/nand_spl/nand_boot.c $@
Stefan Roese720c5852007-11-03 12:08:28 +010073
74# from drivers/nand directory
75$(obj)nand_ecc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090076 @rm -f $@
77 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@
Stefan Roese720c5852007-11-03 12:08:28 +010078
79#########################################################################
80
81$(obj)%.o: $(obj)%.S
82 $(CC) $(AFLAGS) -c -o $@ $<
83
84$(obj)%.o: $(obj)%.c
85 $(CC) $(CFLAGS) -c -o $@ $<
86
87# defines $(obj).depend target
88include $(SRCTREE)/rules.mk
89
90sinclude $(obj).depend
91
92#########################################################################