blob: 8be9b31303129456ee43c916b63643069b1aff9d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
2# Makefile for rescue code
3#
Mikael Starvik3e41d652005-07-27 11:44:30 -07004target = $(target_rescue_dir)
5src = $(src_rescue_dir)
6
7CC = gcc-cris -mlinux $(LINUXINCLUDE)
Linus Torvalds1da177e2005-04-16 15:20:36 -07008CFLAGS = -O2
9LD = gcc-cris -mlinux -nostdlib
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss
12
Mikael Starvik3e41d652005-07-27 11:44:30 -070013all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Mikael Starvik3e41d652005-07-27 11:44:30 -070015$(target)/rescue.bin: $(target) $(target)/head.o
16 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
17 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
18# Place a copy in top-level build directory
19 cp -p $(target)/rescue.bin $(objtree)
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Mikael Starvik3e41d652005-07-27 11:44:30 -070021$(target)/testrescue.bin: $(target) $(target)/testrescue.o
22 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070023# Pad it to 784 bytes
24 dd if=/dev/zero of=tmp2423 bs=1 count=784
25 cat tr.bin tmp2423 >testrescue_tmp.bin
Mikael Starvik3e41d652005-07-27 11:44:30 -070026 dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 rm tr.bin tmp2423 testrescue_tmp.bin
28
Mikael Starvik3e41d652005-07-27 11:44:30 -070029$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
30 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070031# 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
Mikael Starvik3e41d652005-07-27 11:44:30 -070034 dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 rm ktr.bin tmp2423 kimagerescue_tmp.bin
36
Mikael Starvik3e41d652005-07-27 11:44:30 -070037$(target):
38 mkdir -p $(target)
39
40$(target)/head.o: $(src)/head.S
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
42
Mikael Starvik3e41d652005-07-27 11:44:30 -070043$(target)/testrescue.o: $(src)/testrescue.S
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
45
Mikael Starvik3e41d652005-07-27 11:44:30 -070046$(target)/kimagerescue.o: $(src)/kimagerescue.S
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
48
49clean:
Mikael Starvik3e41d652005-07-27 11:44:30 -070050 rm -f $(target)/*.o $(target)/*.bin
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52fastdep:
53
54modules:
55
56modules-install: