1# 2# Makefile for rescue (bootstrap) code 3# 4 5# CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE) 6# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \ 7# -I$(srctree)/include/asm/arch 8# asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch 9# LD = gcc-cris -mlinux -march=v32 -nostdlib 10 11asflags-y += $(LINUXINCLUDE) 12ccflags-y += -O2 $(LINUXINCLUDE) 13 14ifdef CONFIG_ETRAX_AXISFLASHMAP 15 16arch-$(CONFIG_ETRAX_ARCH_V10) = v10 17arch-$(CONFIG_ETRAX_ARCH_V32) = v32 18 19ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds 20OBJCOPYFLAGS = -O binary --remove-section=.bss 21obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o 22obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o 23OBJECTS := $(obj-y) 24 25targets := rescue.o rescue.bin 26 27$(obj)/rescue.o: $(OBJECTS) FORCE 28 $(call if_changed,ld) 29 30$(obj)/rescue.bin: $(obj)/rescue.o FORCE 31 $(call if_changed,objcopy) 32 cp -p $(obj)/rescue.bin $(objtree) 33 34else 35$(obj)/rescue.bin: 36 37endif 38 39$(obj)/testrescue.bin: $(obj)/testrescue.o 40 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin 41# Pad it to 784 bytes 42 dd if=/dev/zero of=tmp2423 bs=1 count=784 43 cat tr.bin tmp2423 >testrescue_tmp.bin 44 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784 45 rm tr.bin tmp2423 testrescue_tmp.bin 46 47 48$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o 49 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin 50# Pad it to 784 bytes, that's what the rescue loader expects 51 dd if=/dev/zero of=tmp2423 bs=1 count=784 52 cat ktr.bin tmp2423 >kimagerescue_tmp.bin 53 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784 54 rm ktr.bin tmp2423 kimagerescue_tmp.bin 55 56