Marek Vasut | 451a0c3 | 2010-10-16 21:32:11 +0200 | [diff] [blame] | 1 | |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 2 | include $(TOPDIR)/config.mk |
Marek Vasut | 451a0c3 | 2010-10-16 21:32:11 +0200 | [diff] [blame] | 3 | include $(TOPDIR)/board/$(BOARDDIR)/config.mk |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 4 | |
| 5 | LDSCRIPT= $(TOPDIR)/onenand_ipl/board/$(BOARDDIR)/u-boot.onenand.lds |
Wolfgang Denk | 14d0a02 | 2010-10-07 21:51:12 +0200 | [diff] [blame] | 6 | LDFLAGS = -Bstatic -T $(onenandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(PLATFORM_LDFLAGS) |
Aneesh V | 401bb30 | 2011-07-13 05:11:07 +0000 | [diff] [blame] | 7 | AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_ONENAND_IPL |
| 8 | CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_ONENAND_IPL |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 9 | OBJCFLAGS += --gap-fill=0x00 |
| 10 | |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 11 | SOBJS += start.o |
| 12 | COBJS := vpac270.o |
| 13 | COBJS += onenand_read.o |
| 14 | COBJS += onenand_boot.o |
| 15 | |
| 16 | SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c)) |
| 17 | OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) |
| 18 | __OBJS := $(SOBJS) $(COBJS) |
| 19 | LNDIR := $(OBJTREE)/onenand_ipl/board/$(BOARDDIR) |
| 20 | |
| 21 | onenandobj := $(OBJTREE)/onenand_ipl/ |
| 22 | |
| 23 | ALL = $(onenandobj)onenand-ipl $(onenandobj)onenand-ipl.bin $(onenandobj)onenand-ipl-2k.bin |
| 24 | |
| 25 | all: $(obj).depend $(ALL) |
| 26 | |
| 27 | $(onenandobj)onenand-ipl-2k.bin: $(onenandobj)onenand-ipl |
Marek Vasut | 451a0c3 | 2010-10-16 21:32:11 +0200 | [diff] [blame] | 28 | $(OBJCOPY) ${OBJCFLAGS} --pad-to=0x0800 -O binary $< $@ |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 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 | |
| 60 | ifneq ($(OBJTREE), $(SRCTREE)) |
| 61 | $(obj)vpac270.c: |
| 62 | @rm -f $@ |
| 63 | ln -s $(SRCTREE)/onenand_ipl/board/$(BOARDDIR)/vpac270.c $@ |
Marek Vasut | 18a00df | 2010-03-07 23:35:48 +0100 | [diff] [blame] | 64 | endif |
| 65 | |
| 66 | ######################################################################### |
| 67 | |
| 68 | $(obj)%.o: $(obj)%.S |
| 69 | $(CC) $(AFLAGS) -c -o $@ $< |
| 70 | |
| 71 | $(obj)%.o: $(obj)$.c |
| 72 | $(CC) $(CFLAGS) -c -o $@ $< |
| 73 | |
| 74 | # defines $(obj).depend target |
| 75 | include $(SRCTREE)/rules.mk |
| 76 | |
| 77 | sinclude $(obj).depend |
| 78 | |
| 79 | ######################################################################### |