Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2007 |
| 3 | # Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | # |
Dipen Dudhat | 831b660 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 5 | # Copyright 2009-2011 Freescale Semiconductor, Inc. |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 6 | # |
| 7 | # See file CREDITS for list of people who contributed to this |
| 8 | # project. |
| 9 | # |
| 10 | # This program is free software; you can redistribute it and/or |
| 11 | # modify it under the terms of the GNU General Public License as |
| 12 | # published by the Free Software Foundation; either version 2 of |
| 13 | # the License, or (at your option) any later version. |
| 14 | # |
| 15 | # This program is distributed in the hope that it will be useful, |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | # GNU General Public License for more details. |
| 19 | # |
| 20 | # You should have received a copy of the GNU General Public License |
| 21 | # along with this program; if not, write to the Free Software |
| 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 23 | # MA 02111-1307 USA |
| 24 | # |
| 25 | |
| 26 | NAND_SPL := y |
Haiying Wang | 31b9012 | 2010-11-10 15:37:13 -0500 | [diff] [blame] | 27 | CONFIG_SYS_TEXT_BASE_SPL := 0xfff00000 |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 28 | PAD_TO := 0xfff01000 |
| 29 | |
| 30 | include $(TOPDIR)/config.mk |
| 31 | |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 32 | nandobj := $(OBJTREE)/nand_spl/ |
| 33 | |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 34 | LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds |
Dipen Dudhat | 831b660 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 35 | LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \ |
| 36 | $(LDFLAGS) $(LDFLAGS_FINAL) |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 37 | AFLAGS += -DCONFIG_NAND_SPL |
| 38 | CFLAGS += -DCONFIG_NAND_SPL |
| 39 | |
| 40 | SOBJS = start.o resetvec.o |
| 41 | COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \ |
| 42 | nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o |
| 43 | |
| 44 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 45 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 46 | __OBJS := $(SOBJS) $(COBJS) |
Wolfgang Denk | 29547c6 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 47 | LNDIR := $(nandobj)board/$(BOARDDIR) |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 48 | |
| 49 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 50 | |
| 51 | all: $(obj).depend $(ALL) |
| 52 | |
| 53 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 54 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 55 | |
| 56 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 57 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 58 | |
Dipen Dudhat | 831b660 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 59 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 60 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
| 61 | -Map $(nandobj)u-boot-spl.map \ |
| 62 | -o $(nandobj)u-boot-spl |
| 63 | |
Dipen Dudhat | 831b660 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 64 | $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) |
| 65 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@ |
| 66 | |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 67 | # create symbolic links for common files |
| 68 | |
| 69 | $(obj)cache.c: |
| 70 | @rm -f $(obj)cache.c |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 71 | ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 72 | |
| 73 | $(obj)cpu_init_early.c: |
| 74 | @rm -f $(obj)cpu_init_early.c |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 75 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 76 | |
| 77 | $(obj)cpu_init_nand.c: |
| 78 | @rm -f $(obj)cpu_init_nand.c |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 79 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_nand.c $(obj)cpu_init_nand.c |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 80 | |
| 81 | $(obj)fsl_law.c: |
| 82 | @rm -f $(obj)fsl_law.c |
| 83 | ln -sf $(SRCTREE)/drivers/misc/fsl_law.c $(obj)fsl_law.c |
| 84 | |
| 85 | $(obj)law.c: |
| 86 | @rm -f $(obj)law.c |
| 87 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c |
| 88 | |
| 89 | $(obj)nand_boot_fsl_elbc.c: |
| 90 | @rm -f $(obj)nand_boot_fsl_elbc.c |
| 91 | ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ |
| 92 | $(obj)nand_boot_fsl_elbc.c |
| 93 | |
| 94 | $(obj)ns16550.c: |
| 95 | @rm -f $(obj)ns16550.c |
| 96 | ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c |
| 97 | |
| 98 | $(obj)resetvec.S: |
| 99 | @rm -f $(obj)resetvec.S |
Peter Tyser | d53e8fd | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 100 | ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 101 | |
| 102 | $(obj)fixed_ivor.S: |
| 103 | @rm -f $(obj)fixed_ivor.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 104 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 105 | |
| 106 | $(obj)start.S: $(obj)fixed_ivor.S |
| 107 | @rm -f $(obj)start.S |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 108 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 109 | |
| 110 | $(obj)tlb.c: |
| 111 | @rm -f $(obj)tlb.c |
Stefan Roese | 88fbf93 | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 112 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c |
Liu Yu | 2639e51 | 2010-01-18 19:03:28 +0800 | [diff] [blame] | 113 | |
| 114 | $(obj)tlb_table.c: |
| 115 | @rm -f $(obj)tlb_table.c |
| 116 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c |
| 117 | |
| 118 | ifneq ($(OBJTREE), $(SRCTREE)) |
| 119 | $(obj)nand_boot.c: |
| 120 | @rm -f $(obj)nand_boot.c |
| 121 | ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c |
| 122 | endif |
| 123 | |
| 124 | ######################################################################### |
| 125 | |
| 126 | $(obj)%.o: $(obj)%.S |
| 127 | $(CC) $(AFLAGS) -c -o $@ $< |
| 128 | |
| 129 | $(obj)%.o: $(obj)%.c |
| 130 | $(CC) $(CFLAGS) -c -o $@ $< |
| 131 | |
| 132 | # defines $(obj).depend target |
| 133 | include $(SRCTREE)/rules.mk |
| 134 | |
| 135 | sinclude $(obj).depend |
| 136 | |
| 137 | ######################################################################### |