Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 1 | |
| 2 | include $(TOPDIR)/config.mk |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 3 | include $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/config.mk |
| 4 | |
| 5 | LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds |
| 6 | LDFLAGS = -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS) |
| 7 | AFLAGS += -DCONFIG_ONENAND_IPL |
| 8 | CFLAGS += -DCONFIG_ONENAND_IPL |
| 9 | OBJCLFAGS += --gap-fill=0x00 |
| 10 | |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 11 | SOBJS := low_levelinit.o |
| 12 | SOBJS += start.o |
| 13 | COBJS := apollon.o |
| 14 | COBJS += onenand_read.o |
| 15 | COBJS += onenand_boot.o |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 16 | |
| 17 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 18 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 19 | __OBJS := $(SOBJS) $(COBJS) |
| 20 | LNDIR := $(OBJTREE)/onenand_ipl/board/$(BOARDDIR) |
| 21 | |
| 22 | onenandobj := $(OBJTREE)/onenand_ipl/ |
| 23 | |
Kyungmin Park | 1bb707c | 2008-03-17 08:54:06 +0900 | [diff] [blame] | 24 | ALL = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-2k.bin $(onenandobj)onenand-ipl-4k.bin |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 25 | |
| 26 | all: $(obj).depend $(ALL) |
| 27 | |
| 28 | $(onenandobj)onenand-ipl-2k.bin: $(onenandobj)onenand-ipl |
| 29 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x800 -O binary $< $@ |
| 30 | |
Kyungmin Park | 1bb707c | 2008-03-17 08:54:06 +0900 | [diff] [blame] | 31 | $(onenandobj)onenand-ipl-4k.bin: $(onenandobj)onenand-ipl |
| 32 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x1000 -O binary $< $@ |
| 33 | |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 34 | $(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 Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 39 | -Map $@.map -o $@ |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 40 | |
| 41 | # create symbolic links from common files |
| 42 | |
| 43 | # from cpu directory |
| 44 | $(obj)start.S: |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 45 | @rm -f $@ |
| 46 | ln -s $(SRCTREE)/cpu/$(CPU)/start.S $@ |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 47 | |
| 48 | # from onenand_ipl directory |
| 49 | $(obj)onenand_ipl.h: |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 50 | @rm -f $@ |
| 51 | ln -s $(SRCTREE)/onenand_ipl/onenand_ipl.h $@ |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 52 | |
| 53 | $(obj)onenand_boot.c: $(obj)onenand_ipl.h |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 54 | @rm -f $@ |
| 55 | ln -s $(SRCTREE)/onenand_ipl/onenand_boot.c $@ |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 56 | |
| 57 | $(obj)onenand_read.c: $(obj)onenand_ipl.h |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 58 | @rm -f $@ |
| 59 | ln -s $(SRCTREE)/onenand_ipl/onenand_read.c $@ |
| 60 | |
| 61 | ifneq ($(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 $@ |
| 69 | endif |
| 70 | |
| 71 | ######################################################################### |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 72 | |
| 73 | $(obj)%.o: $(obj)%.S |
| 74 | $(CC) $(AFLAGS) -c -o $@ $< |
| 75 | |
| 76 | $(obj)%.o: $(obj)$.c |
| 77 | $(CC) $(CFLAGS) -c -o $@ $< |
| 78 | |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 79 | # defines $(obj).depend target |
Kyungmin Park | 751b9b5 | 2008-01-17 16:43:25 +0900 | [diff] [blame] | 80 | include $(SRCTREE)/rules.mk |
| 81 | |
| 82 | sinclude $(obj).depend |
Stefan Roese | f2302d4 | 2008-08-06 14:05:38 +0200 | [diff] [blame] | 83 | |
| 84 | ######################################################################### |