diff options
Diffstat (limited to 'arch/cris/arch-v10/boot/rescue/Makefile')
-rw-r--r-- | arch/cris/arch-v10/boot/rescue/Makefile | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile index e9f2ba2ad02c..8be9b3130312 100644 --- a/arch/cris/arch-v10/boot/rescue/Makefile +++ b/arch/cris/arch-v10/boot/rescue/Makefile | |||
@@ -1,52 +1,53 @@ | |||
1 | # | 1 | # |
2 | # Makefile for rescue code | 2 | # Makefile for rescue code |
3 | # | 3 | # |
4 | ifndef TOPDIR | 4 | target = $(target_rescue_dir) |
5 | TOPDIR = ../../../.. | 5 | src = $(src_rescue_dir) |
6 | endif | 6 | |
7 | CC = gcc-cris -mlinux -I $(TOPDIR)/include | 7 | CC = gcc-cris -mlinux $(LINUXINCLUDE) |
8 | CFLAGS = -O2 | 8 | CFLAGS = -O2 |
9 | LD = gcc-cris -mlinux -nostdlib | 9 | LD = gcc-cris -mlinux -nostdlib |
10 | OBJCOPY = objcopy-cris | 10 | OBJCOPY = objcopy-cris |
11 | OBJCOPYFLAGS = -O binary --remove-section=.bss | 11 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
12 | 12 | ||
13 | all: rescue.bin testrescue.bin kimagerescue.bin | 13 | all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin |
14 | |||
15 | rescue: rescue.bin | ||
16 | # do nothing | ||
17 | 14 | ||
18 | rescue.bin: head.o | 15 | $(target)/rescue.bin: $(target) $(target)/head.o |
19 | $(LD) -T rescue.ld -o rescue.o head.o | 16 | $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o |
20 | $(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin | 17 | $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin |
21 | cp rescue.bin $(TOPDIR) | 18 | # Place a copy in top-level build directory |
19 | cp -p $(target)/rescue.bin $(objtree) | ||
22 | 20 | ||
23 | testrescue.bin: testrescue.o | 21 | $(target)/testrescue.bin: $(target) $(target)/testrescue.o |
24 | $(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin | 22 | $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin |
25 | # Pad it to 784 bytes | 23 | # Pad it to 784 bytes |
26 | dd if=/dev/zero of=tmp2423 bs=1 count=784 | 24 | dd if=/dev/zero of=tmp2423 bs=1 count=784 |
27 | cat tr.bin tmp2423 >testrescue_tmp.bin | 25 | cat tr.bin tmp2423 >testrescue_tmp.bin |
28 | dd if=testrescue_tmp.bin of=testrescue.bin bs=1 count=784 | 26 | dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784 |
29 | rm tr.bin tmp2423 testrescue_tmp.bin | 27 | rm tr.bin tmp2423 testrescue_tmp.bin |
30 | 28 | ||
31 | kimagerescue.bin: kimagerescue.o | 29 | $(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o |
32 | $(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin | 30 | $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin |
33 | # Pad it to 784 bytes, that's what the rescue loader expects | 31 | # Pad it to 784 bytes, that's what the rescue loader expects |
34 | dd if=/dev/zero of=tmp2423 bs=1 count=784 | 32 | dd if=/dev/zero of=tmp2423 bs=1 count=784 |
35 | cat ktr.bin tmp2423 >kimagerescue_tmp.bin | 33 | cat ktr.bin tmp2423 >kimagerescue_tmp.bin |
36 | dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784 | 34 | dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784 |
37 | rm ktr.bin tmp2423 kimagerescue_tmp.bin | 35 | rm ktr.bin tmp2423 kimagerescue_tmp.bin |
38 | 36 | ||
39 | head.o: head.S | 37 | $(target): |
38 | mkdir -p $(target) | ||
39 | |||
40 | $(target)/head.o: $(src)/head.S | ||
40 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o | 41 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o |
41 | 42 | ||
42 | testrescue.o: testrescue.S | 43 | $(target)/testrescue.o: $(src)/testrescue.S |
43 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o | 44 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o |
44 | 45 | ||
45 | kimagerescue.o: kimagerescue.S | 46 | $(target)/kimagerescue.o: $(src)/kimagerescue.S |
46 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o | 47 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o |
47 | 48 | ||
48 | clean: | 49 | clean: |
49 | rm -f *.o *.bin | 50 | rm -f $(target)/*.o $(target)/*.bin |
50 | 51 | ||
51 | fastdep: | 52 | fastdep: |
52 | 53 | ||