blob: ac7a8f05e6ce27551ab0e1334d66a7a9b279cfc7 [file] [log] [blame]
Marek Vasut1e847582010-03-07 23:35:48 +01001IPL =onenand_ipl
2include $(TOPDIR)/config.mk
3
4LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds
Wolfgang Denk0708bc62010-10-07 21:51:12 +02005LDFLAGS = -Bstatic -T $(onenandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS)
Marek Vasut1e847582010-03-07 23:35:48 +01006AFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
7CFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
8OBJCFLAGS += --gap-fill=0x00
9
10SOBJS := lowlevel_init.o
11SOBJS += 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
28 $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x5c040400 -O binary $< $@
29
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 $@
64
65$(obj)lowlevel_init.S:
66 @rm -f $@
67 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/lowlevel_init.S $@
68endif
69
70#########################################################################
71
72$(obj)%.o: $(obj)%.S
73 $(CC) $(AFLAGS) -c -o $@ $<
74
75$(obj)%.o: $(obj)$.c
76 $(CC) $(CFLAGS) -c -o $@ $<
77
78# defines $(obj).depend target
79include $(SRCTREE)/rules.mk
80
81sinclude $(obj).depend
82
83#########################################################################