blob: 193efffb56507a3e822c59ca646bc4887346ff76 [file] [log] [blame]
Kyungmin Park33174212008-01-17 16:43:25 +09001
2include $(TOPDIR)/config.mk
Kyungmin Park33174212008-01-17 16:43:25 +09003include $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/config.mk
4
5LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds
Wolfgang Denk18d46c02009-08-17 14:00:53 +02006LDFLAGS = -Bstatic -T $(onenandobj)u-boot.lds -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
Magnus Lilja1ec96d82009-06-13 20:50:00 +02007AFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
8CFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
Shinya Kuribayashi28e4d042009-06-07 21:45:16 +09009OBJCFLAGS += --gap-fill=0x00
Kyungmin Park33174212008-01-17 16:43:25 +090010
Stefan Roese37628252008-08-06 14:05:38 +020011SOBJS := low_levelinit.o
12SOBJS += start.o
13COBJS := apollon.o
14COBJS += onenand_read.o
15COBJS += onenand_boot.o
Kyungmin Park33174212008-01-17 16:43:25 +090016
17SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
18OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
19__OBJS := $(SOBJS) $(COBJS)
20LNDIR := $(OBJTREE)/onenand_ipl/board/$(BOARDDIR)
21
22onenandobj := $(OBJTREE)/onenand_ipl/
23
Kyungmin Park05d23182008-03-17 08:54:06 +090024ALL = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-2k.bin $(onenandobj)onenand-ipl-4k.bin
Kyungmin Park33174212008-01-17 16:43:25 +090025
26all: $(obj).depend $(ALL)
27
28$(onenandobj)onenand-ipl-2k.bin: $(onenandobj)onenand-ipl
29 $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x800 -O binary $< $@
30
Kyungmin Park05d23182008-03-17 08:54:06 +090031$(onenandobj)onenand-ipl-4k.bin: $(onenandobj)onenand-ipl
32 $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x1000 -O binary $< $@
33
Kyungmin Park33174212008-01-17 16:43:25 +090034$(onenandobj)onenand-ipl.bin: $(onenandobj)onenand-ipl
35 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
36
Wolfgang Denk18d46c02009-08-17 14:00:53 +020037$(onenandobj)onenand-ipl: $(OBJS) $(onenandobj)u-boot.lds
Kyungmin Park33174212008-01-17 16:43:25 +090038 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
Stefan Roese37628252008-08-06 14:05:38 +020039 -Map $@.map -o $@
Kyungmin Park33174212008-01-17 16:43:25 +090040
Wolfgang Denk18d46c02009-08-17 14:00:53 +020041$(onenandobj)u-boot.lds: $(LDSCRIPT)
42 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
43
Kyungmin Park33174212008-01-17 16:43:25 +090044# create symbolic links from common files
45
46# from cpu directory
47$(obj)start.S:
Stefan Roese37628252008-08-06 14:05:38 +020048 @rm -f $@
49 ln -s $(SRCTREE)/cpu/$(CPU)/start.S $@
Kyungmin Park33174212008-01-17 16:43:25 +090050
51# from onenand_ipl directory
52$(obj)onenand_ipl.h:
Stefan Roese37628252008-08-06 14:05:38 +020053 @rm -f $@
54 ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@
Kyungmin Park33174212008-01-17 16:43:25 +090055
56$(obj)onenand_boot.c: $(obj)onenand_ipl.h
Stefan Roese37628252008-08-06 14:05:38 +020057 @rm -f $@
58 ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@
Kyungmin Park33174212008-01-17 16:43:25 +090059
60$(obj)onenand_read.c: $(obj)onenand_ipl.h
Stefan Roese37628252008-08-06 14:05:38 +020061 @rm -f $@
62 ln -s $(SRCTREE)/onenand_ipl/onenand_read.c $@
63
64ifneq ($(OBJTREE), $(SRCTREE))
65$(obj)apollon.c:
66 @rm -f $@
67 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/apollon.c $@
68
69$(obj)low_levelinit.S:
70 @rm -f $@
71 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/low_levelinit.S $@
72endif
73
74#########################################################################
Kyungmin Park33174212008-01-17 16:43:25 +090075
76$(obj)%.o: $(obj)%.S
77 $(CC) $(AFLAGS) -c -o $@ $<
78
79$(obj)%.o: $(obj)$.c
80 $(CC) $(CFLAGS) -c -o $@ $<
81
Stefan Roese37628252008-08-06 14:05:38 +020082# defines $(obj).depend target
Kyungmin Park33174212008-01-17 16:43:25 +090083include $(SRCTREE)/rules.mk
84
85sinclude $(obj).depend
Stefan Roese37628252008-08-06 14:05:38 +020086
87#########################################################################