2005-04-17 06:20:36 +08:00
|
|
|
#
|
|
|
|
# Makefile for rescue code
|
|
|
|
#
|
2005-07-28 02:44:30 +08:00
|
|
|
target = $(target_rescue_dir)
|
|
|
|
src = $(src_rescue_dir)
|
|
|
|
|
|
|
|
CC = gcc-cris -mlinux $(LINUXINCLUDE)
|
2005-04-17 06:20:36 +08:00
|
|
|
CFLAGS = -O2
|
|
|
|
LD = gcc-cris -mlinux -nostdlib
|
|
|
|
OBJCOPY = objcopy-cris
|
|
|
|
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target)/rescue.bin: $(target) $(target)/head.o
|
|
|
|
$(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
|
|
|
|
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
|
|
|
|
# Place a copy in top-level build directory
|
|
|
|
cp -p $(target)/rescue.bin $(objtree)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target)/testrescue.bin: $(target) $(target)/testrescue.o
|
|
|
|
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
|
2005-04-17 06:20:36 +08:00
|
|
|
# Pad it to 784 bytes
|
|
|
|
dd if=/dev/zero of=tmp2423 bs=1 count=784
|
|
|
|
cat tr.bin tmp2423 >testrescue_tmp.bin
|
2005-07-28 02:44:30 +08:00
|
|
|
dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
|
2005-04-17 06:20:36 +08:00
|
|
|
rm tr.bin tmp2423 testrescue_tmp.bin
|
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
|
|
|
|
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
|
2005-04-17 06:20:36 +08: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
|
2005-07-28 02:44:30 +08:00
|
|
|
dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
|
2005-04-17 06:20:36 +08:00
|
|
|
rm ktr.bin tmp2423 kimagerescue_tmp.bin
|
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target):
|
|
|
|
mkdir -p $(target)
|
|
|
|
|
|
|
|
$(target)/head.o: $(src)/head.S
|
2005-04-17 06:20:36 +08:00
|
|
|
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
|
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target)/testrescue.o: $(src)/testrescue.S
|
2005-04-17 06:20:36 +08:00
|
|
|
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
|
|
|
|
|
2005-07-28 02:44:30 +08:00
|
|
|
$(target)/kimagerescue.o: $(src)/kimagerescue.S
|
2005-04-17 06:20:36 +08:00
|
|
|
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
|
|
|
|
|
|
|
|
clean:
|
2005-07-28 02:44:30 +08:00
|
|
|
rm -f $(target)/*.o $(target)/*.bin
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
fastdep:
|
|
|
|
|
|
|
|
modules:
|
|
|
|
|
|
|
|
modules-install:
|