Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2008 |
| 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 | 0b86db7 | 2008-03-03 17:27:02 +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 | 0b86db7 | 2008-03-03 17:27:02 +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 | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 16 | AFLAGS += -DCONFIG_NAND_SPL |
| 17 | CFLAGS += -DCONFIG_NAND_SPL |
| 18 | |
| 19 | SOBJS := start.o |
Stefan Roese | 46fdeb1 | 2008-05-14 10:32:32 +0200 | [diff] [blame] | 20 | SOBJS += init.o |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 21 | SOBJS += resetvec.o |
| 22 | COBJS := ddr2_fixed.o |
| 23 | COBJS += nand_boot.o |
| 24 | COBJS += nand_ecc.o |
| 25 | COBJS += ndfc.o |
| 26 | |
| 27 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 28 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 29 | __OBJS := $(SOBJS) $(COBJS) |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 30 | LNDIR := $(nandobj)board/$(BOARDDIR) |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 31 | |
| 32 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 33 | |
| 34 | all: $(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 Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 42 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds |
Scott Wood | 9d6b227 | 2010-12-10 15:13:39 -0600 | [diff] [blame] | 43 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 44 | -Map $(nandobj)u-boot-spl.map \ |
| 45 | -o $(nandobj)u-boot-spl |
| 46 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 47 | $(nandobj)u-boot.lds: $(LDSCRIPT) |
| 48 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 49 | |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 50 | # create symbolic links for common files |
| 51 | |
| 52 | # from cpu directory |
| 53 | $(obj)ndfc.c: |
| 54 | @rm -f $(obj)ndfc.c |
Stefan Roese | 913fd05 | 2009-07-16 15:12:48 +0200 | [diff] [blame] | 55 | ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 56 | |
| 57 | $(obj)resetvec.S: |
| 58 | @rm -f $(obj)resetvec.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 59 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 60 | |
| 61 | $(obj)start.S: |
| 62 | @rm -f $(obj)start.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 63 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 64 | |
| 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 Roese | 46fdeb1 | 2008-05-14 10:32:32 +0200 | [diff] [blame] | 80 | ifneq ($(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 |
| 84 | endif |
| 85 | |
Stefan Roese | 0b86db7 | 2008-03-03 17:27:02 +0100 | [diff] [blame] | 86 | ######################################################################### |
| 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 |
| 95 | include $(SRCTREE)/rules.mk |
| 96 | |
| 97 | sinclude $(obj).depend |
| 98 | |
| 99 | ######################################################################### |