blob: 5d9953b6f3de4b13b4399f09a60910f99405ae98 [file] [log] [blame]
Liu Yu2639e512010-01-18 19:03:28 +08001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
Dipen Dudhat831b6602011-04-09 12:52:32 -05005# Copyright 2009-2011 Freescale Semiconductor, Inc.
Liu Yu2639e512010-01-18 19:03:28 +08006#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02007# SPDX-License-Identifier: GPL-2.0+
Liu Yu2639e512010-01-18 19:03:28 +08008#
9
Haiying Wang31b90122010-11-10 15:37:13 -050010CONFIG_SYS_TEXT_BASE_SPL := 0xfff00000
Liu Yu2639e512010-01-18 19:03:28 +080011PAD_TO := 0xfff01000
12
Wolfgang Denk29547c62011-03-31 16:26:29 -050013nandobj := $(OBJTREE)/nand_spl/
14
Peter Tyserd53e8fd2010-04-12 22:28:02 -050015LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
Dipen Dudhat831b6602011-04-09 12:52:32 -050016LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
17 $(LDFLAGS) $(LDFLAGS_FINAL)
Liu Yu2639e512010-01-18 19:03:28 +080018AFLAGS += -DCONFIG_NAND_SPL
19CFLAGS += -DCONFIG_NAND_SPL
20
21SOBJS = start.o resetvec.o
Scott Wood5847d782012-09-20 16:35:21 -050022COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
Liu Yu2639e512010-01-18 19:03:28 +080023 nand_boot.o nand_boot_fsl_elbc.o ns16550.o tlb.o tlb_table.o
24
25SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
26OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
27__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050028LNDIR := $(nandobj)board/$(BOARDDIR)
Liu Yu2639e512010-01-18 19:03:28 +080029
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090030all: $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
Liu Yu2639e512010-01-18 19:03:28 +080031
32$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
33 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
34
35$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
36 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
37
Dipen Dudhat831b6602011-04-09 12:52:32 -050038$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
Liu Yu2639e512010-01-18 19:03:28 +080039 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090040 -Map $(nandobj)u-boot-spl.map -o $@
Liu Yu2639e512010-01-18 19:03:28 +080041
Albert ARIBAUDc24895e2013-02-25 00:59:00 +000042$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000043 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)/board/$(BOARDDIR) \
44 -ansi -D__ASSEMBLY__ -P - <$< >$@
Dipen Dudhat831b6602011-04-09 12:52:32 -050045
Liu Yu2639e512010-01-18 19:03:28 +080046# create symbolic links for common files
47
48$(obj)cache.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090049 @rm -f $@
50 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $@
Liu Yu2639e512010-01-18 19:03:28 +080051
52$(obj)cpu_init_early.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090053 @rm -f $@
54 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/cpu_init_early.c $@
Liu Yu2639e512010-01-18 19:03:28 +080055
Scott Wood5847d782012-09-20 16:35:21 -050056$(obj)spl_minimal.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090057 @rm -f $@
58 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/spl_minimal.c $@
Liu Yu2639e512010-01-18 19:03:28 +080059
60$(obj)fsl_law.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090061 @rm -f $@
62 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $@
Liu Yu2639e512010-01-18 19:03:28 +080063
64$(obj)law.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090065 @rm -f $@
66 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $@
Liu Yu2639e512010-01-18 19:03:28 +080067
68$(obj)nand_boot_fsl_elbc.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090069 @rm -f $@
70 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_elbc.c $@
Liu Yu2639e512010-01-18 19:03:28 +080071
72$(obj)ns16550.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090073 @rm -f $@
74 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $@
Liu Yu2639e512010-01-18 19:03:28 +080075
76$(obj)resetvec.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090077 @rm -f $@
78 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $@
Liu Yu2639e512010-01-18 19:03:28 +080079
80$(obj)fixed_ivor.S:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090081 @rm -f $@
82 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/fixed_ivor.S $@
Liu Yu2639e512010-01-18 19:03:28 +080083
84$(obj)start.S: $(obj)fixed_ivor.S
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090085 @rm -f $@
86 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/start.S $@
Liu Yu2639e512010-01-18 19:03:28 +080087
88$(obj)tlb.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090089 @rm -f $@
90 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc85xx/tlb.c $@
Liu Yu2639e512010-01-18 19:03:28 +080091
92$(obj)tlb_table.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090093 @rm -f $@
94 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $@
Liu Yu2639e512010-01-18 19:03:28 +080095
96ifneq ($(OBJTREE), $(SRCTREE))
97$(obj)nand_boot.c:
Masahiro Yamadad1aacf22013-11-20 18:11:57 +090098 @rm -f $@
99 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $@
Liu Yu2639e512010-01-18 19:03:28 +0800100endif
101
102#########################################################################
103
104$(obj)%.o: $(obj)%.S
105 $(CC) $(AFLAGS) -c -o $@ $<
106
107$(obj)%.o: $(obj)%.c
108 $(CC) $(CFLAGS) -c -o $@ $<