1 # SPDX-License-Identifier: GPL-2.0
3 # Makefile for rescue (bootstrap) code
6 # CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
7 # ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \
8 # -I$(srctree)/include/asm/arch
9 # asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
10 # LD = gcc-cris -mlinux -march=v32 -nostdlib
12 ifdef CONFIG_ETRAX_AXISFLASHMAP
14 arch-
$(CONFIG_ETRAX_ARCH_V10
) = v10
15 arch-
$(CONFIG_ETRAX_ARCH_V32
) = v32
17 ldflags-y
+= -T
$(srctree
)/$(src
)/rescue_
$(arch-y
).lds
18 OBJCOPYFLAGS
= -O binary
--remove-section
=.bss
19 obj-
$(CONFIG_ETRAX_ARCH_V32
) = $(obj
)/head_v32.o
20 obj-
$(CONFIG_ETRAX_ARCH_V10
) = $(obj
)/head_v10.o
23 targets
:= rescue.o rescue.bin
25 $(obj
)/rescue.o
: $(OBJECTS
) FORCE
28 $(obj
)/rescue.bin
: $(obj
)/rescue.o FORCE
29 $(call if_changed
,objcopy
)
30 cp
-p
$(obj
)/rescue.bin
$(objtree
)
37 $(obj
)/testrescue.bin
: $(obj
)/testrescue.o
38 $(OBJCOPY
) $(OBJCOPYFLAGS
) $(obj
)/testrescue.o tr.bin
40 dd if
=/dev
/zero of
=tmp2423 bs
=1 count
=784
41 cat tr.bin tmp2423
>testrescue_tmp.bin
42 dd if
=testrescue_tmp.bin of
=$(obj
)/testrescue.bin bs
=1 count
=784
43 rm tr.bin tmp2423 testrescue_tmp.bin
46 $(obj
)/kimagerescue.bin
: $(obj
)/kimagerescue.o
47 $(OBJCOPY
) $(OBJCOPYFLAGS
) $(obj
)/kimagerescue.o ktr.bin
48 # Pad it to 784 bytes, that's what the rescue loader expects
49 dd if
=/dev
/zero of
=tmp2423 bs
=1 count
=784
50 cat ktr.bin tmp2423
>kimagerescue_tmp.bin
51 dd if
=kimagerescue_tmp.bin of
=$(obj
)/kimagerescue.bin bs
=1 count
=784
52 rm ktr.bin tmp2423 kimagerescue_tmp.bin