blob: 52bd0bd1dd22f20e2d11e5d5e492b0e4ed2fb67a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +01002# Makefile for rescue (bootstrap) code
Linus Torvalds1da177e2005-04-16 15:20:36 -07003#
Mikael Starvik3e41d652005-07-27 11:44:30 -07004
Jesper Nilsson66ab3a72009-04-21 11:44:57 +02005# 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
Jesper Nilssonbdb144b2008-06-29 23:15:19 +020011asflags-y += $(LINUXINCLUDE)
Jesper Nilsson66ab3a72009-04-21 11:44:57 +020012ccflags-y += -O2 $(LINUXINCLUDE)
13arch-$(CONFIG_ETRAX_ARCH_V10) = v10
14arch-$(CONFIG_ETRAX_ARCH_V32) = v32
15
16ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds
Linus Torvalds1da177e2005-04-16 15:20:36 -070017OBJCOPYFLAGS = -O binary --remove-section=.bss
Jesper Nilsson66ab3a72009-04-21 11:44:57 +020018obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
19obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
20OBJECTS := $(obj-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010022targets := rescue.o rescue.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Jesper Nilsson66ab3a72009-04-21 11:44:57 +020024$(obj)/rescue.o: $(OBJECTS) FORCE
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010025 $(call if_changed,ld)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010027$(obj)/rescue.bin: $(obj)/rescue.o FORCE
28 $(call if_changed,objcopy)
29 cp -p $(obj)/rescue.bin $(objtree)
30
31$(obj)/testrescue.bin: $(obj)/testrescue.o
32 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070033# Pad it to 784 bytes
34 dd if=/dev/zero of=tmp2423 bs=1 count=784
35 cat tr.bin tmp2423 >testrescue_tmp.bin
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010036 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 rm tr.bin tmp2423 testrescue_tmp.bin
38
Jesper Nilsson66ab3a72009-04-21 11:44:57 +020039
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010040$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
41 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070042# Pad it to 784 bytes, that's what the rescue loader expects
43 dd if=/dev/zero of=tmp2423 bs=1 count=784
44 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
Jesper Nilsson63e6b9a2007-11-30 16:11:38 +010045 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 rm ktr.bin tmp2423 kimagerescue_tmp.bin
Jesper Nilsson66ab3a72009-04-21 11:44:57 +020047