Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2007 |
| 3 | # Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | # |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 6 | # |
| 7 | |
| 8 | include $(TOPDIR)/config.mk |
| 9 | include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk |
| 10 | |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 11 | nandobj := $(OBJTREE)/nand_spl/ |
| 12 | |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 13 | LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 14 | LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \ |
| 15 | $(LDFLAGS_FINAL) |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 16 | AFLAGS += -DCONFIG_NAND_SPL |
| 17 | CFLAGS += -DCONFIG_NAND_SPL |
| 18 | |
Stefan Roese | a226c85 | 2008-06-02 17:13:55 +0200 | [diff] [blame] | 19 | SOBJS = start.o resetvec.o cache.o |
| 20 | COBJS = 44x_spd_ddr2.o nand_boot.o nand_ecc.o ndfc.o |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 21 | |
| 22 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 23 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 24 | __OBJS := $(SOBJS) $(COBJS) |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 25 | LNDIR := $(nandobj)board/$(BOARDDIR) |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 26 | |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 27 | all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 28 | |
| 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 Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 35 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds |
Scott Wood | 9d6b227 | 2010-12-10 15:13:39 -0600 | [diff] [blame] | 36 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 37 | -Map $(nandobj)u-boot-spl.map -o $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 38 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 39 | $(nandobj)u-boot.lds: $(LDSCRIPT) |
| 40 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 41 | |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 42 | # create symbolic links for common files |
| 43 | |
| 44 | # from cpu directory |
Stefan Roese | 3762825 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 45 | $(obj)44x_spd_ddr2.c: $(obj)ecc.h |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 46 | @rm -f $@ |
| 47 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c $@ |
Stefan Roese | a226c85 | 2008-06-02 17:13:55 +0200 | [diff] [blame] | 48 | |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 49 | $(obj)cache.S: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 50 | @rm -f $@ |
| 51 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 52 | |
Stefan Roese | a226c85 | 2008-06-02 17:13:55 +0200 | [diff] [blame] | 53 | $(obj)ecc.h: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 54 | @rm -f $@ |
| 55 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/ecc.h $@ |
Stefan Roese | a226c85 | 2008-06-02 17:13:55 +0200 | [diff] [blame] | 56 | |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 57 | $(obj)ndfc.c: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 58 | @rm -f $@ |
| 59 | ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 60 | |
| 61 | $(obj)resetvec.S: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 62 | @rm -f $@ |
| 63 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 64 | |
| 65 | $(obj)start.S: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 66 | @rm -f $@ |
| 67 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 68 | |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 69 | # from nand_spl directory |
| 70 | $(obj)nand_boot.c: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 71 | @rm -f $@ |
| 72 | ln -s $(SRCTREE)/nand_spl/nand_boot.c $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 73 | |
| 74 | # from drivers/nand directory |
| 75 | $(obj)nand_ecc.c: |
Masahiro Yamada | d1aacf2 | 2013-11-20 18:11:57 +0900 | [diff] [blame] | 76 | @rm -f $@ |
| 77 | ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $@ |
Stefan Roese | 720c585 | 2007-11-03 12:08:28 +0100 | [diff] [blame] | 78 | |
| 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 |
| 88 | include $(SRCTREE)/rules.mk |
| 89 | |
| 90 | sinclude $(obj).depend |
| 91 | |
| 92 | ######################################################################### |