Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2010-2011 Freescale Semiconductor, Inc. |
| 3 | # |
| 4 | # See file CREDITS for list of people who contributed to this |
| 5 | # project. |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or |
| 8 | # modify it under the terms of the GNU General Public License as |
| 9 | # published by the Free Software Foundation; either version 2 of |
| 10 | # the License, or (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 20 | # MA 02111-1307 USA |
| 21 | # |
| 22 | NAND_SPL := y |
| 23 | PAD_TO := 0xfff01000 |
| 24 | |
| 25 | include $(TOPDIR)/config.mk |
| 26 | |
| 27 | nandobj := $(OBJTREE)/nand_spl/ |
| 28 | |
| 29 | LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds |
| 30 | LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \ |
| 31 | $(LDFLAGS) $(LDFLAGS_FINAL) |
| 32 | AFLAGS += -DCONFIG_NAND_SPL |
| 33 | CFLAGS += -DCONFIG_NAND_SPL |
| 34 | |
| 35 | SOBJS = start.o resetvec.o |
Scott Wood | 5847d78 | 2012-09-20 16:35:21 -0500 | [diff] [blame] | 36 | COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \ |
Scott Wood | fac8624 | 2012-08-17 19:46:29 -0500 | [diff] [blame] | 37 | nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o |
Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 38 | |
| 39 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 40 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 41 | __OBJS := $(SOBJS) $(COBJS) |
| 42 | LNDIR := $(nandobj)board/$(BOARDDIR) |
| 43 | |
| 44 | ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin |
| 45 | |
| 46 | all: $(obj).depend $(ALL) |
| 47 | |
| 48 | $(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl |
| 49 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@ |
| 50 | |
| 51 | $(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl |
| 52 | $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@ |
| 53 | |
| 54 | $(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds |
| 55 | cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \ |
| 56 | -Map $(nandobj)u-boot-spl.map \ |
| 57 | -o $(nandobj)u-boot-spl |
| 58 | |
Albert ARIBAUD | c24895e | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 59 | $(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) |
Scott Wood | 67de957 | 2012-11-13 12:30:39 +0000 | [diff] [blame] | 60 | $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \ |
| 61 | -ansi -D__ASSEMBLY__ -P - <$< >$@ |
Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 62 | |
| 63 | # create symbolic links for common files |
| 64 | |
| 65 | $(obj)cache.c: |
| 66 | @rm -f $(obj)cache.c |
| 67 | ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c |
| 68 | |
| 69 | $(obj)cpu_init_early.c: |
| 70 | @rm -f $(obj)cpu_init_early.c |
| 71 | ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c |
| 72 | |
Scott Wood | 5847d78 | 2012-09-20 16:35:21 -0500 | [diff] [blame] | 73 | $(obj)spl_minimal.c: |
| 74 | @rm -f $(obj)spl_minimal.c |
| 75 | ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $(obj)spl_minimal.c |
Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 76 | |
| 77 | $(obj)fsl_law.c: |
| 78 | @rm -f $(obj)fsl_law.c |
Scott Wood | 3d48872 | 2012-08-17 16:17:50 -0500 | [diff] [blame] | 79 | ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c |
Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 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 |
| 96 | ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S |
| 97 | |
| 98 | $(obj)fixed_ivor.S: |
| 99 | @rm -f $(obj)fixed_ivor.S |
| 100 | ln -sf $(SRCTREE)/$(CPUDIR)/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)/$(CPUDIR)/start.S $(obj)start.S |
| 105 | |
| 106 | $(obj)tlb.c: |
| 107 | @rm -f $(obj)tlb.c |
| 108 | ln -sf $(SRCTREE)/$(CPUDIR)/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 | |
| 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 |
Roy Zang | 3e9ecf8 | 2011-06-09 11:30:52 +0800 | [diff] [blame] | 118 | endif |
| 119 | |
| 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 | ######################################################################### |