blob: 38f67264498d2e15cd9a6c5073f7364917917fcc [file] [log] [blame]
Roy Zang3f7f6b82011-06-09 11:30:52 +08001#
2# Copyright 2010-2011 Freescale Semiconductor, Inc.
3#
Wolfgang Denk1a459662013-07-08 09:37:19 +02004# SPDX-License-Identifier: GPL-2.0+
Roy Zang3f7f6b82011-06-09 11:30:52 +08005#
Roy Zang3f7f6b82011-06-09 11:30:52 +08006
Masahiro Yamadaa0b14c32014-02-04 17:24:13 +09007PAD_TO := 0xfff01000
Roy Zang3f7f6b82011-06-09 11:30:52 +08008
Masahiro Yamada5ee828c2014-03-11 11:05:21 +09009nandobj := $(objtree)/nand_spl/
Roy Zang3f7f6b82011-06-09 11:30:52 +080010
Masahiro Yamada4379ac62014-03-11 11:05:19 +090011LDSCRIPT= $(srctree)/$(CPUDIR)/u-boot-nand_spl.lds
Roy Zang3f7f6b82011-06-09 11:30:52 +080012LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
13 $(LDFLAGS) $(LDFLAGS_FINAL)
Masahiro Yamada6825a952014-02-04 17:24:28 +090014asflags-y += -DCONFIG_NAND_SPL
15ccflags-y += -DCONFIG_NAND_SPL
Roy Zang3f7f6b82011-06-09 11:30:52 +080016
17SOBJS = start.o resetvec.o
Scott Woodb9735cb2012-09-20 16:35:21 -050018COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
Scott Wood59629c22012-08-17 19:46:29 -050019 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
Roy Zang3f7f6b82011-06-09 11:30:52 +080020
Masahiro Yamada9e414032014-02-04 17:24:24 +090021OBJS := $(addprefix $(obj)/,$(SOBJS) $(COBJS))
Roy Zang3f7f6b82011-06-09 11:30:52 +080022__OBJS := $(SOBJS) $(COBJS)
23LNDIR := $(nandobj)board/$(BOARDDIR)
24
Masahiro Yamada6825a952014-02-04 17:24:28 +090025targets += $(__OBJS)
26
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090027all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
Roy Zang3f7f6b82011-06-09 11:30:52 +080028
29$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
Masahiro Yamada95ddcd62014-02-24 11:12:12 +090030 $(OBJCOPY) $(OBJCOPYFLAGS) --pad-to=$(PAD_TO) -O binary $< $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080031
32$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
Masahiro Yamada95ddcd62014-02-24 11:12:12 +090033 $(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080034
35$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
36 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090037 -Map $(nandobj)u-boot-spl.map -o $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080038
Albert ARIBAUDef123c52013-02-25 00:59:00 +000039$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
Masahiro Yamada6825a952014-02-04 17:24:28 +090040 $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
Scott Wooda6d0f622012-11-13 12:30:39 +000041 -ansi -D__ASSEMBLY__ -P - <$< >$@
Roy Zang3f7f6b82011-06-09 11:30:52 +080042
43# create symbolic links for common files
44
Masahiro Yamada9e414032014-02-04 17:24:24 +090045$(obj)/cache.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090046 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090047 ln -sf $(srctree)/arch/powerpc/lib/cache.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080048
Masahiro Yamada9e414032014-02-04 17:24:24 +090049$(obj)/cpu_init_early.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090050 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090051 ln -sf $(srctree)/$(CPUDIR)/cpu_init_early.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080052
Masahiro Yamada9e414032014-02-04 17:24:24 +090053$(obj)/spl_minimal.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090054 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090055 ln -sf $(srctree)/$(CPUDIR)/spl_minimal.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080056
Masahiro Yamada9e414032014-02-04 17:24:24 +090057$(obj)/fsl_law.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090058 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090059 ln -sf $(srctree)/arch/powerpc/cpu/mpc8xxx/law.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080060
Masahiro Yamada9e414032014-02-04 17:24:24 +090061$(obj)/law.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090062 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090063 ln -sf $(srctree)/board/$(BOARDDIR)/law.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080064
Masahiro Yamada9e414032014-02-04 17:24:24 +090065$(obj)/nand_boot_fsl_elbc.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090066 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090067 ln -sf $(srctree)/nand_spl/nand_boot_fsl_elbc.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080068
Masahiro Yamada9e414032014-02-04 17:24:24 +090069$(obj)/ns16550.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090070 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090071 ln -sf $(srctree)/drivers/serial/ns16550.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080072
Masahiro Yamada9e414032014-02-04 17:24:24 +090073$(obj)/resetvec.S:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090074 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090075 ln -s $(srctree)/$(CPUDIR)/resetvec.S $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080076
Masahiro Yamada9e414032014-02-04 17:24:24 +090077$(obj)/fixed_ivor.S:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090078 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090079 ln -sf $(srctree)/$(CPUDIR)/fixed_ivor.S $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080080
Masahiro Yamada9e414032014-02-04 17:24:24 +090081$(obj)/start.S: $(obj)/fixed_ivor.S
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090082 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090083 ln -sf $(srctree)/$(CPUDIR)/start.S $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080084
Masahiro Yamada9e414032014-02-04 17:24:24 +090085$(obj)/tlb.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090086 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090087 ln -sf $(srctree)/$(CPUDIR)/tlb.c $@
Roy Zang3f7f6b82011-06-09 11:30:52 +080088
Masahiro Yamada9e414032014-02-04 17:24:24 +090089$(obj)/tlb_table.c:
Masahiro Yamada5310b8b2013-11-20 18:11:57 +090090 @rm -f $@
Masahiro Yamada01286322014-03-11 11:05:20 +090091 ln -sf $(srctree)/board/$(BOARDDIR)/tlb.c $@