Makefile 1.2 KB
Newer Older
L
Linus Torvalds 已提交
1
#
2
# Makefile for rescue (bootstrap) code
L
Linus Torvalds 已提交
3
#
4 5

CC = gcc-cris -mlinux $(LINUXINCLUDE)
6 7
ccflags-y += -O2
asflags-y += -traditional
L
Linus Torvalds 已提交
8
LD = gcc-cris -mlinux -nostdlib
9
ldflags-y += -T $(obj)/rescue.ld
L
Linus Torvalds 已提交
10 11
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
12 13
obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
OBJECT := $(obj)/head.o
L
Linus Torvalds 已提交
14

15
targets := rescue.o rescue.bin
L
Linus Torvalds 已提交
16

17 18
$(obj)/rescue.o: $(OBJECT) FORCE
	$(call if_changed,ld)
L
Linus Torvalds 已提交
19

20 21 22 23 24 25
$(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
L
Linus Torvalds 已提交
26 27 28
# Pad it to 784 bytes
	dd if=/dev/zero of=tmp2423 bs=1 count=784
	cat tr.bin tmp2423 >testrescue_tmp.bin
29
	dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
L
Linus Torvalds 已提交
30 31
	rm tr.bin tmp2423 testrescue_tmp.bin

32 33
$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
	$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
L
Linus Torvalds 已提交
34 35 36
# 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
37
	dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
L
Linus Torvalds 已提交
38
	rm ktr.bin tmp2423 kimagerescue_tmp.bin