2 # Makefile for rescue (bootstrap) code
5 ccflags-y += -O2 $(LINUXINCLUDE)
6 asflags-y += $(LINUXINCLUDE)
7 ldflags-y += -T $(obj)/rescue.ld
8 OBJCOPYFLAGS = -O binary --remove-section=.bss
9 obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
10 OBJECT := $(obj)/head.o
12 targets := rescue.o rescue.bin
14 $(obj)/rescue.o: $(OBJECT) FORCE
17 $(obj)/rescue.bin: $(obj)/rescue.o FORCE
18 $(call if_changed,objcopy)
19 cp -p $(obj)/rescue.bin $(objtree)
21 $(obj)/testrescue.bin: $(obj)/testrescue.o
22 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
24 dd if=/dev/zero of=tmp2423 bs=1 count=784
25 cat tr.bin tmp2423 >testrescue_tmp.bin
26 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
27 rm tr.bin tmp2423 testrescue_tmp.bin
29 $(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
30 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
31 # Pad it to 784 bytes, that's what the rescue loader expects
32 dd if=/dev/zero of=tmp2423 bs=1 count=784
33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
34 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
35 rm ktr.bin tmp2423 kimagerescue_tmp.bin