blob: 6f1df01135ed6f3b4fd278cf2a1a3c9739f10abc [file] [log] [blame]
Kyungmin Park751b9b52008-01-17 16:43:25 +09001
2include $(TOPDIR)/config.mk
Kyungmin Park751b9b52008-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 Denk1aada9c2009-08-17 14:00:53 +02006LDFLAGS = -Bstatic -T $(onenandobj)u-boot.lds -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
Magnus Liljadf812382009-06-13 20:50:00 +02007AFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
8CFLAGS += -DCONFIG_PRELOADER -DCONFIG_ONENAND_IPL
Shinya Kuribayashiaa446a52009-06-07 21:45:16 +09009OBJCFLAGS += --gap-fill=0x00
Kyungmin Park751b9b52008-01-17 16:43:25 +090010
Stefan Roesef2302d42008-08-06 14:05:38 +020011SOBJS := low_levelinit.o
12SOBJS += start.o
13COBJS := apollon.o
14COBJS += onenand_read.o
15COBJS += onenand_boot.o
Kyungmin Park751b9b52008-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 Park1bb707c2008-03-17 08:54:06 +090024ALL = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-2k.bin $(onenandobj)onenand-ipl-4k.bin
Kyungmin Park751b9b52008-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 Park1bb707c2008-03-17 08:54:06 +090031$(onenandobj)onenand-ipl-4k.bin: $(onenandobj)onenand-ipl
32 $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x1000 -O binary $< $@
33
Kyungmin Park751b9b52008-01-17 16:43:25 +090034$(onenandobj)onenand-ipl.bin: $(onenandobj)onenand-ipl
35 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
36
Wolfgang Denk1aada9c2009-08-17 14:00:53 +020037$(onenandobj)onenand-ipl: $(OBJS) $(onenandobj)u-boot.lds
Kyungmin Park751b9b52008-01-17 16:43:25 +090038 cd $(LNDIR) && $(LD) $(LDFLAGS) $$UNDEF_SYM $(__OBJS) \
Stefan Roesef2302d42008-08-06 14:05:38 +020039 -Map $@.map -o $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090040
Wolfgang Denk1aada9c2009-08-17 14:00:53 +020041$(onenandobj)u-boot.lds: $(LDSCRIPT)
42 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
43
Kyungmin Park751b9b52008-01-17 16:43:25 +090044# create symbolic links from common files
45
46# from cpu directory
47$(obj)start.S:
Stefan Roesef2302d42008-08-06 14:05:38 +020048 @rm -f $@
Peter Tyser03b70042010-04-12 22:28:02 -050049 ln -s $(SRCTREE)/$(CPUDIR)/start.S $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090050
51# from onenand_ipl directory
52$(obj)onenand_ipl.h:
Stefan Roesef2302d42008-08-06 14:05:38 +020053 @rm -f $@
54 ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090055
56$(obj)onenand_boot.c: $(obj)onenand_ipl.h
Stefan Roesef2302d42008-08-06 14:05:38 +020057 @rm -f $@
58 ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090059
60$(obj)onenand_read.c: $(obj)onenand_ipl.h
Stefan Roesef2302d42008-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 Park751b9b52008-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 Roesef2302d42008-08-06 14:05:38 +020082# defines $(obj).depend target
Kyungmin Park751b9b52008-01-17 16:43:25 +090083include $(SRCTREE)/rules.mk
84
85sinclude $(obj).depend
Stefan Roesef2302d42008-08-06 14:05:38 +020086
87#########################################################################