Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [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 | 4274351 | 2007-06-01 15:27:11 +0200 | [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 | 4274351 | 2007-06-01 15:27:11 +0200 | [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 | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 16 | AFLAGS += -DCONFIG_NAND_SPL |
| 17 | CFLAGS += -DCONFIG_NAND_SPL |
| 18 | |
| 19 | SOBJS = start.o init.o resetvec.o |
| 20 | COBJS = nand_boot.o nand_ecc.o ndfc.o sdram.o |
| 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 | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 26 | |
| 27 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 28 | |
| 29 | all: $(obj).depend $(ALL) |
| 30 | |
| 31 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 32 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 33 | |
| 34 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 35 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 36 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 37 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds |
Scott Wood | 9d6b227 | 2010-12-10 15:13:39 -0600 | [diff] [blame] | 38 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 39 | -Map $(nandobj)u-boot-spl.map \ |
| 40 | -o $(nandobj)u-boot-spl |
| 41 | |
Wolfgang Denk | 18d46c0 | 2009-08-17 14:00:53 +0200 | [diff] [blame] | 42 | $(nandobj)u-boot.lds: $(LDSCRIPT) |
| 43 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 44 | |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 45 | # create symbolic links for common files |
| 46 | |
| 47 | # from cpu directory |
| 48 | $(obj)ndfc.c: |
| 49 | @rm -f $(obj)ndfc.c |
Stefan Roese | 913fd05 | 2009-07-16 15:12:48 +0200 | [diff] [blame] | 50 | ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 51 | |
| 52 | $(obj)resetvec.S: |
| 53 | @rm -f $(obj)resetvec.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 54 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 55 | |
| 56 | $(obj)start.S: |
| 57 | @rm -f $(obj)start.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 58 | ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 59 | |
| 60 | # from board directory |
| 61 | $(obj)init.S: |
| 62 | @rm -f $(obj)init.S |
| 63 | ln -s $(SRCTREE)/board/amcc/bamboo/init.S $(obj)init.S |
| 64 | |
| 65 | # from nand_spl directory |
| 66 | $(obj)nand_boot.c: |
| 67 | @rm -f $(obj)nand_boot.c |
| 68 | ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c |
| 69 | |
Marcel Ziswiler | aea6856 | 2007-12-30 03:30:46 +0100 | [diff] [blame] | 70 | # from drivers/mtd/nand directory |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 71 | $(obj)nand_ecc.c: |
| 72 | @rm -f $(obj)nand_ecc.c |
Jean-Christophe PLAGNIOL-VILLARD | 82ca974 | 2007-11-24 21:26:56 +0100 | [diff] [blame] | 73 | ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 74 | |
Grzegorz Bernacki | a381309 | 2007-09-11 12:57:52 +0200 | [diff] [blame] | 75 | ifneq ($(OBJTREE), $(SRCTREE)) |
| 76 | $(obj)sdram.c: |
| 77 | @rm -f $(obj)sdram.c |
| 78 | ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/sdram.c $(obj)sdram.c |
| 79 | endif |
| 80 | |
Stefan Roese | 4274351 | 2007-06-01 15:27:11 +0200 | [diff] [blame] | 81 | ######################################################################### |
| 82 | |
| 83 | $(obj)%.o: $(obj)%.S |
| 84 | $(CC) $(AFLAGS) -c -o $@ $< |
| 85 | |
| 86 | $(obj)%.o: $(obj)%.c |
| 87 | $(CC) $(CFLAGS) -c -o $@ $< |
| 88 | |
| 89 | # defines $(obj).depend target |
| 90 | include $(SRCTREE)/rules.mk |
| 91 | |
| 92 | sinclude $(obj).depend |
| 93 | |
| 94 | ######################################################################### |