blob: 49a8e9072fae93027382735ddaa75b6ee6b5fc37 [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
6LDFLAGS = -Bstatic -T $(LDSCRIPT) -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
37$(onenandobj)onenand-ipl: $(OBJS)
38 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
41# create symbolic links from common files
42
43# from cpu directory
44$(obj)start.S:
Stefan Roesef2302d42008-08-06 14:05:38 +020045 @rm -f $@
46 ln -s $(SRCTREE)/cpu/$(CPU)/start.S $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090047
48# from onenand_ipl directory
49$(obj)onenand_ipl.h:
Stefan Roesef2302d42008-08-06 14:05:38 +020050 @rm -f $@
51 ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090052
53$(obj)onenand_boot.c: $(obj)onenand_ipl.h
Stefan Roesef2302d42008-08-06 14:05:38 +020054 @rm -f $@
55 ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@
Kyungmin Park751b9b52008-01-17 16:43:25 +090056
57$(obj)onenand_read.c: $(obj)onenand_ipl.h
Stefan Roesef2302d42008-08-06 14:05:38 +020058 @rm -f $@
59 ln -s $(SRCTREE)/onenand_ipl/onenand_read.c $@
60
61ifneq ($(OBJTREE), $(SRCTREE))
62$(obj)apollon.c:
63 @rm -f $@
64 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/apollon.c $@
65
66$(obj)low_levelinit.S:
67 @rm -f $@
68 ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/low_levelinit.S $@
69endif
70
71#########################################################################
Kyungmin Park751b9b52008-01-17 16:43:25 +090072
73$(obj)%.o: $(obj)%.S
74 $(CC) $(AFLAGS) -c -o $@ $<
75
76$(obj)%.o: $(obj)$.c
77 $(CC) $(CFLAGS) -c -o $@ $<
78
Stefan Roesef2302d42008-08-06 14:05:38 +020079# defines $(obj).depend target
Kyungmin Park751b9b52008-01-17 16:43:25 +090080include $(SRCTREE)/rules.mk
81
82sinclude $(obj).depend
Stefan Roesef2302d42008-08-06 14:05:38 +020083
84#########################################################################