blob: f850ddd3416364bee5419367419c99501c9a5b3d [file] [log] [blame]
Marek Vasut451a0c32010-10-16 21:32:11 +02001
Marek Vasut18a00df2010-03-07 23:35:48 +01002include $(TOPDIR)/config.mk
Marek Vasut451a0c32010-10-16 21:32:11 +02003include $(TOPDIR)/board/$(BOARDDIR)/config.mk
Marek Vasut18a00df2010-03-07 23:35:48 +01004
5LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds
Wolfgang Denk14d0a022010-10-07 21:51:12 +02006LDFLAGS = -Bstatic -T $(onenandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
Aneesh V401bb302011-07-13 05:11:07 +00007AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_ONENAND_IPL
8CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_ONENAND_IPL
Marek Vasut18a00df2010-03-07 23:35:48 +01009OBJCFLAGS += --gap-fill=0x00
10
Marek Vasut18a00df2010-03-07 23:35:48 +010011SOBJS += start.o
12COBJS := vpac270.o
13COBJS += onenand_read.o
14COBJS += onenand_boot.o
15
16SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
17OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
18__OBJS := $(SOBJS) $(COBJS)
19LNDIR := $(OBJTREE)/onenand_ipl/board/$(BOARDDIR)
20
21onenandobj := $(OBJTREE)/onenand_ipl/
22
23ALL = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-2k.bin
24
25all: $(obj).depend $(ALL)
26
27$(onenandobj)onenand-ipl-2k.bin: $(onenandobj)onenand-ipl
Marek Vasut451a0c32010-10-16 21:32:11 +020028 $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x0800 -O binary $< $@
Marek Vasut18a00df2010-03-07 23:35:48 +010029
30$(onenandobj)onenand-ipl.bin: $(onenandobj)onenand-ipl
31 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
32
33$(onenandobj)onenand-ipl: $(OBJS) $(onenandobj)u-boot.lds
34 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
35 -Map $@.map -o $@
36
37$(onenandobj)u-boot.lds: $(LDSCRIPT)
38 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
39
40# create symbolic links from common files
41
42# from cpu directory
43$(obj)start.S:
44 @rm -f $@
45 ln -s $(SRCTREE)/$(CPUDIR)/start.S $@
46
47# from onenand_ipl directory
48$(obj)onenand_ipl.h:
49 @rm -f $@
50 ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@
51
52$(obj)onenand_boot.c: $(obj)onenand_ipl.h
53 @rm -f $@
54 ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@
55
56$(obj)onenand_read.c: $(obj)onenand_ipl.h
57 @rm -f $@
58 ln -s $(SRCTREE)/onenand_ipl/onenand_read.c $@
59
60ifneq ($(OBJTREE), $(SRCTREE))
61$(obj)vpac270.c:
62 @rm -f $@
63 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/vpac270.c $@
Marek Vasut18a00df2010-03-07 23:35:48 +010064endif
65
66#########################################################################
67
68$(obj)%.o: $(obj)%.S
69 $(CC) $(AFLAGS) -c -o $@ $<
70
71$(obj)%.o: $(obj)$.c
72 $(CC) $(CFLAGS) -c -o $@ $<
73
74# defines $(obj).depend target
75include $(SRCTREE)/rules.mk
76
77sinclude $(obj).depend
78
79#########################################################################