Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2007 |
| 3 | # Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | # |
| 5 | # Copyright 2009 Freescale Semiconductor, Inc. |
| 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 |
| 27 | TEXT_BASE := 0xfff00000 |
| 28 | PAD_TO := 0xfff01000 |
| 29 | |
| 30 | include $(TOPDIR)/config.mk |
| 31 | |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame^] | 32 | LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 33 | LDFLAGS = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS) |
| 34 | AFLAGS += -DCONFIG_NAND_SPL |
| 35 | CFLAGS += -DCONFIG_NAND_SPL |
| 36 | |
| 37 | SOBJS = start.o resetvec.o |
| 38 | COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \ |
| 39 | nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o |
| 40 | |
| 41 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 42 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 43 | __OBJS := $(SOBJS) $(COBJS) |
| 44 | LNDIR := $(OBJTREE)/nand_spl/board/$(BOARDDIR) |
| 45 | |
| 46 | nandobj := $(OBJTREE)/nand_spl/ |
| 47 | |
| 48 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 49 | |
| 50 | all: $(obj).depend $(ALL) |
| 51 | |
| 52 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 53 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 54 | |
| 55 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 56 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 57 | |
| 58 | $(nandobj)u-boot-spl: $(OBJS) |
| 59 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
| 60 | -Map $(nandobj)u-boot-spl.map \ |
| 61 | -o $(nandobj)u-boot-spl |
| 62 | |
| 63 | # create symbolic links for common files |
| 64 | |
| 65 | $(obj)cache.c: |
| 66 | @rm -f $(obj)cache.c |
| 67 | ln -sf $(SRCTREE)/lib_ppc/cache.c $(obj)cache.c |
| 68 | |
| 69 | $(obj)cpu_init_early.c: |
| 70 | @rm -f $(obj)cpu_init_early.c |
| 71 | ln -sf $(SRCTREE)/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c |
| 72 | |
| 73 | $(obj)cpu_init_nand.c: |
| 74 | @rm -f $(obj)cpu_init_nand.c |
| 75 | ln -sf $(SRCTREE)/cpu/mpc85xx/cpu_init_nand.c $(obj)cpu_init_nand.c |
| 76 | |
| 77 | $(obj)fsl_law.c: |
| 78 | @rm -f $(obj)fsl_law.c |
| 79 | ln -sf $(SRCTREE)/drivers/misc/fsl_law.c $(obj)fsl_law.c |
| 80 | |
| 81 | $(obj)law.c: |
| 82 | @rm -f $(obj)law.c |
| 83 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c |
| 84 | |
| 85 | $(obj)nand_boot_fsl_elbc.c: |
| 86 | @rm -f $(obj)nand_boot_fsl_elbc.c |
| 87 | ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ |
| 88 | $(obj)nand_boot_fsl_elbc.c |
| 89 | |
| 90 | $(obj)ns16550.c: |
| 91 | @rm -f $(obj)ns16550.c |
| 92 | ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c |
| 93 | |
| 94 | $(obj)resetvec.S: |
| 95 | @rm -f $(obj)resetvec.S |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame^] | 96 | ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 97 | |
| 98 | $(obj)fixed_ivor.S: |
| 99 | @rm -f $(obj)fixed_ivor.S |
| 100 | ln -sf $(SRCTREE)/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S |
| 101 | |
| 102 | $(obj)start.S: $(obj)fixed_ivor.S |
| 103 | @rm -f $(obj)start.S |
| 104 | ln -sf $(SRCTREE)/cpu/mpc85xx/start.S $(obj)start.S |
| 105 | |
| 106 | $(obj)tlb.c: |
| 107 | @rm -f $(obj)tlb.c |
| 108 | ln -sf $(SRCTREE)/cpu/mpc85xx/tlb.c $(obj)tlb.c |
| 109 | |
| 110 | $(obj)tlb_table.c: |
| 111 | @rm -f $(obj)tlb_table.c |
| 112 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c |
| 113 | |
Kumar Gala | e8967d9 | 2009-10-26 21:18:33 -0500 | [diff] [blame] | 114 | ifneq ($(OBJTREE), $(SRCTREE)) |
| 115 | $(obj)nand_boot.c: |
| 116 | @rm -f $(obj)nand_boot.c |
| 117 | ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c |
| 118 | endif |
| 119 | |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 120 | ######################################################################### |
| 121 | |
| 122 | $(obj)%.o: $(obj)%.S |
| 123 | $(CC) $(AFLAGS) -c -o $@ $< |
| 124 | |
| 125 | $(obj)%.o: $(obj)%.c |
| 126 | $(CC) $(CFLAGS) -c -o $@ $< |
| 127 | |
| 128 | # defines $(obj).depend target |
| 129 | include $(SRCTREE)/rules.mk |
| 130 | |
| 131 | sinclude $(obj).depend |
| 132 | |
| 133 | ######################################################################### |