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 | # |
Dipen Dudhat | e1f7038 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 5 | # Copyright 2009-2011 Freescale Semiconductor, Inc. |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +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 | 96196a1 | 2010-11-10 15:37:13 -0500 | [diff] [blame] | 27 | CONFIG_SYS_TEXT_BASE_SPL := 0xfff00000 |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 28 | PAD_TO := 0xfff01000 |
| 29 | |
| 30 | include $(TOPDIR)/config.mk |
| 31 | |
Wolfgang Denk | 3b258e2 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 32 | nandobj := $(OBJTREE)/nand_spl/ |
| 33 | |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 34 | LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds |
Marek Vasut | 97b24d3 | 2012-10-19 05:00:10 +0000 | [diff] [blame] | 35 | LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst |
Dipen Dudhat | e1f7038 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 36 | LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \ |
| 37 | $(LDFLAGS) $(LDFLAGS_FINAL) |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 38 | AFLAGS += -DCONFIG_NAND_SPL |
| 39 | CFLAGS += -DCONFIG_NAND_SPL |
| 40 | |
| 41 | SOBJS = start.o resetvec.o |
Scott Wood | b9735cb | 2012-09-20 16:35:21 -0500 | [diff] [blame] | 42 | COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \ |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 43 | nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o |
| 44 | |
| 45 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 46 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 47 | __OBJS := $(SOBJS) $(COBJS) |
Wolfgang Denk | 3b258e2 | 2011-03-31 16:26:29 -0500 | [diff] [blame] | 48 | LNDIR := $(nandobj)board/$(BOARDDIR) |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 49 | |
| 50 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 51 | |
| 52 | all: $(obj).depend $(ALL) |
| 53 | |
| 54 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 55 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 56 | |
| 57 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 58 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 59 | |
Dipen Dudhat | e1f7038 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 60 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 61 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
| 62 | -Map $(nandobj)u-boot-spl.map \ |
| 63 | -o $(nandobj)u-boot-spl |
| 64 | |
Marek Vasut | 97b24d3 | 2012-10-19 05:00:10 +0000 | [diff] [blame] | 65 | # The following line expands into whole rule which generates $(LSTSCRIPT), |
| 66 | # the file containing u-boots LG-array linker section. This is included into |
| 67 | # $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file. |
| 68 | $(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS))) |
| 69 | $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) $(LSTSCRIPT) |
Scott Wood | a6d0f62 | 2012-11-13 12:30:39 +0000 | [diff] [blame] | 70 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ |
| 71 | -ansi -D__ASSEMBLY__ -P - <$< >$@ |
Dipen Dudhat | e1f7038 | 2011-04-09 12:52:32 -0500 | [diff] [blame] | 72 | |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 73 | # create symbolic links for common files |
| 74 | |
| 75 | $(obj)cache.c: |
| 76 | @rm -f $(obj)cache.c |
Stefan Roese | a47a12b | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 77 | ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 78 | |
| 79 | $(obj)cpu_init_early.c: |
| 80 | @rm -f $(obj)cpu_init_early.c |
Stefan Roese | a47a12b | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 81 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $(obj)cpu_init_early.c |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 82 | |
Scott Wood | b9735cb | 2012-09-20 16:35:21 -0500 | [diff] [blame] | 83 | $(obj)spl_minimal.c: |
| 84 | @rm -f $(obj)spl_minimal.c |
| 85 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $(obj)spl_minimal.c |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 86 | |
| 87 | $(obj)fsl_law.c: |
| 88 | @rm -f $(obj)fsl_law.c |
Scott Wood | 8bc50f0 | 2012-08-17 16:17:50 -0500 | [diff] [blame] | 89 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 90 | |
| 91 | $(obj)law.c: |
| 92 | @rm -f $(obj)law.c |
| 93 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c |
| 94 | |
| 95 | $(obj)nand_boot_fsl_elbc.c: |
| 96 | @rm -f $(obj)nand_boot_fsl_elbc.c |
| 97 | ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c \ |
| 98 | $(obj)nand_boot_fsl_elbc.c |
| 99 | |
| 100 | $(obj)ns16550.c: |
| 101 | @rm -f $(obj)ns16550.c |
| 102 | ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c |
| 103 | |
| 104 | $(obj)resetvec.S: |
| 105 | @rm -f $(obj)resetvec.S |
Peter Tyser | 03b7004 | 2010-04-12 22:28:02 -0500 | [diff] [blame] | 106 | ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 107 | |
| 108 | $(obj)fixed_ivor.S: |
| 109 | @rm -f $(obj)fixed_ivor.S |
Stefan Roese | a47a12b | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 110 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $(obj)fixed_ivor.S |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 111 | |
| 112 | $(obj)start.S: $(obj)fixed_ivor.S |
| 113 | @rm -f $(obj)start.S |
Stefan Roese | a47a12b | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 114 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $(obj)start.S |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 115 | |
| 116 | $(obj)tlb.c: |
| 117 | @rm -f $(obj)tlb.c |
Stefan Roese | a47a12b | 2010-04-15 16:07:28 +0200 | [diff] [blame] | 118 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $(obj)tlb.c |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 119 | |
| 120 | $(obj)tlb_table.c: |
| 121 | @rm -f $(obj)tlb_table.c |
| 122 | ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c |
| 123 | |
Kumar Gala | e8967d9 | 2009-10-26 21:18:33 -0500 | [diff] [blame] | 124 | ifneq ($(OBJTREE), $(SRCTREE)) |
| 125 | $(obj)nand_boot.c: |
| 126 | @rm -f $(obj)nand_boot.c |
| 127 | ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c |
| 128 | endif |
| 129 | |
Mingkai Hu | 9a1a0ae | 2009-09-23 15:20:37 +0800 | [diff] [blame] | 130 | ######################################################################### |
| 131 | |
| 132 | $(obj)%.o: $(obj)%.S |
| 133 | $(CC) $(AFLAGS) -c -o $@ $< |
| 134 | |
| 135 | $(obj)%.o: $(obj)%.c |
| 136 | $(CC) $(CFLAGS) -c -o $@ $< |
| 137 | |
| 138 | # defines $(obj).depend target |
| 139 | include $(SRCTREE)/rules.mk |
| 140 | |
| 141 | sinclude $(obj).depend |
| 142 | |
| 143 | ######################################################################### |