blob: f975b725eb5a6bd7b5ed54b33668d2151757d5a8 [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)
Masahiro Yamada0d68fb12014-02-04 17:24:28 +090015asflags-y += -DCONFIG_NAND_SPL
16ccflags-y += -DCONFIG_NAND_SPL
Stefan Roese42743512007-06-01 15:27:11 +020017
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 +090021OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
Stefan Roese42743512007-06-01 15:27:11 +020022__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050023LNDIR := $(nandobj)board/$(BOARDDIR)
Stefan Roese42743512007-06-01 15:27:11 +020024
Masahiro Yamada0d68fb12014-02-04 17:24:28 +090025targets += $(__OBJS)
26
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090027all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
Stefan Roese42743512007-06-01 15:27:11 +020028
29$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
Masahiro Yamadac9c83ba2014-02-24 11:12:12 +090030 $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(PAD_TO) -O binary $< $@
Stefan Roese42743512007-06-01 15:27:11 +020031
32$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
Masahiro Yamadac9c83ba2014-02-24 11:12:12 +090033 $(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@
Stefan Roese42743512007-06-01 15:27:11 +020034
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 Roese42743512007-06-01 15:27:11 +020038
Wolfgang Denk18d46c02009-08-17 14:00:53 +020039$(nandobj)u-boot.lds: $(LDSCRIPT)
Masahiro Yamada0d68fb12014-02-04 17:24:28 +090040 $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
Wolfgang Denk18d46c02009-08-17 14:00:53 +020041
Stefan Roese42743512007-06-01 15:27:11 +020042# create symbolic links for common files
43
44# from cpu directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090045$(obj)/ndfc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090046 @rm -f $@
47 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@
Stefan Roese42743512007-06-01 15:27:11 +020048
Masahiro Yamada59f15f22014-02-04 17:24:24 +090049$(obj)/resetvec.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090050 @rm -f $@
51 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@
Stefan Roese42743512007-06-01 15:27:11 +020052
Masahiro Yamada59f15f22014-02-04 17:24:24 +090053$(obj)/start.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090054 @rm -f $@
55 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@
Stefan Roese42743512007-06-01 15:27:11 +020056
57# from board directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090058$(obj)/init.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090059 @rm -f $@
60 ln -s $(SRCTREE)/board/amcc/bamboo/init.S $@
Stefan Roese42743512007-06-01 15:27:11 +020061
62# from nand_spl directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090063$(obj)/nand_boot.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090064 @rm -f $@
65 ln -s $(SRCTREE)/nand_spl/nand_boot.c $@
Stefan Roese42743512007-06-01 15:27:11 +020066
Marcel Ziswileraea68562007-12-30 03:30:46 +010067# from drivers/mtd/nand directory
Masahiro Yamada59f15f22014-02-04 17:24:24 +090068$(obj)/nand_ecc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090069 @rm -f $@
70 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@