2005-04-16 18:20:36 -04:00
|
|
|
#
|
2007-11-30 10:11:38 -05:00
|
|
|
# Makefile for rescue (bootstrap) code
|
2005-04-16 18:20:36 -04:00
|
|
|
#
|
2005-07-27 14:44:30 -04:00
|
|
|
|
|
|
|
CC = gcc-cris -mlinux $(LINUXINCLUDE)
|
2008-01-17 05:22:41 -05:00
|
|
|
ccflags-y += -O2
|
|
|
|
asflags-y += -traditional
|
2005-04-16 18:20:36 -04:00
|
|
|
LD = gcc-cris -mlinux -nostdlib
|
2008-01-17 05:22:41 -05:00
|
|
|
ldflags-y += -T $(obj)/rescue.ld
|
2005-04-16 18:20:36 -04:00
|
|
|
OBJCOPY = objcopy-cris
|
|
|
|
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
2007-11-30 10:11:38 -05:00
|
|
|
obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
|
|
|
|
OBJECT := $(obj)/head.o
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2007-11-30 10:11:38 -05:00
|
|
|
targets := rescue.o rescue.bin
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2007-11-30 10:11:38 -05:00
|
|
|
$(obj)/rescue.o: $(OBJECT) FORCE
|
|
|
|
$(call if_changed,ld)
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2007-11-30 10:11:38 -05:00
|
|
|
$(obj)/rescue.bin: $(obj)/rescue.o FORCE
|
|
|
|
$(call if_changed,objcopy)
|
|
|
|
cp -p $(obj)/rescue.bin $(objtree)
|
|
|
|
|
|
|
|
$(obj)/testrescue.bin: $(obj)/testrescue.o
|
|
|
|
$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
|
2005-04-16 18:20:36 -04:00
|
|
|
# Pad it to 784 bytes
|
|
|
|
dd if=/dev/zero of=tmp2423 bs=1 count=784
|
|
|
|
cat tr.bin tmp2423 >testrescue_tmp.bin
|
2007-11-30 10:11:38 -05:00
|
|
|
dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
|
2005-04-16 18:20:36 -04:00
|
|
|
rm tr.bin tmp2423 testrescue_tmp.bin
|
|
|
|
|
2007-11-30 10:11:38 -05:00
|
|
|
$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
|
|
|
|
$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
|
2005-04-16 18:20:36 -04:00
|
|
|
# Pad it to 784 bytes, that's what the rescue loader expects
|
|
|
|
dd if=/dev/zero of=tmp2423 bs=1 count=784
|
|
|
|
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
|
2007-11-30 10:11:38 -05:00
|
|
|
dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
|
2005-04-16 18:20:36 -04:00
|
|
|
rm ktr.bin tmp2423 kimagerescue_tmp.bin
|