blob: 92b604e9f56b444806f98a4e644e0411c4fdc9ae [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
Stefan Roese42743512007-06-01 15:27:11 +02008include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
9
Wolfgang Denk29547c62011-03-31 16:26:29 -050010nandobj := $(OBJTREE)/nand_spl/
11
Stefan Roese42743512007-06-01 15:27:11 +020012LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
Haiying Wang39358732011-02-22 16:38:05 -050013LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
14 $(LDFLAGS_FINAL)
Stefan Roese42743512007-06-01 15:27:11 +020015AFLAGS += -DCONFIG_NAND_SPL
16CFLAGS += -DCONFIG_NAND_SPL
17
18SOBJS = start.o init.o resetvec.o
19COBJS = nand_boot.o nand_ecc.o ndfc.o sdram.o
20
Masahiro Yamada59f15f22014-02-04 17:24:24 +090021SRCS := $(addprefix $(obj)/,$(SOBJS:.o=.S) $(COBJS:.o=.c))
22OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
Stefan Roese42743512007-06-01 15:27:11 +020023__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050024LNDIR := $(nandobj)board/$(BOARDDIR)
Stefan Roese42743512007-06-01 15:27:11 +020025
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090026all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
Stefan Roese42743512007-06-01 15:27:11 +020027
28$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
29 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
30
31$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
32 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
33
Wolfgang Denk18d46c02009-08-17 14:00:53 +020034$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060035 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090036 -Map $(nandobj)u-boot-spl.map -o $@
Stefan Roese42743512007-06-01 15:27:11 +020037
Wolfgang Denk18d46c02009-08-17 14:00:53 +020038$(nandobj)u-boot.lds: $(LDSCRIPT)
39 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
40
Stefan Roese42743512007-06-01 15:27:11 +020041# create symbolic links for common files
42
43# from cpu directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090044$(obj)/ndfc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090045 @rm -f $@
46 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
Stefan Roese42743512007-06-01 15:27:11 +020047
Masahiro Yamada59f15f22014-02-04 17:24:24 +090048$(obj)/resetvec.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090049 @rm -f $@
50 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
Stefan Roese42743512007-06-01 15:27:11 +020051
Masahiro Yamada59f15f22014-02-04 17:24:24 +090052$(obj)/start.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090053 @rm -f $@
54 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
Stefan Roese42743512007-06-01 15:27:11 +020055
56# from board directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090057$(obj)/init.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090058 @rm -f $@
59 ln -s $(SRCTREE)/board/amcc/bamboo/init.S $@
Stefan Roese42743512007-06-01 15:27:11 +020060
61# from nand_spl directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090062$(obj)/nand_boot.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090063 @rm -f $@
64 ln -s $(SRCTREE)/nand_spl/nand_boot.c $@
Stefan Roese42743512007-06-01 15:27:11 +020065
Marcel Ziswileraea68562007-12-30 03:30:46 +010066# from drivers/mtd/nand directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090067$(obj)/nand_ecc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090068 @rm -f $@
69 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@