Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | # |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 2 | # Makefile for rescue (bootstrap) code |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | # |
Mikael Starvik | 3e41d65 | 2005-07-27 11:44:30 -0700 | [diff] [blame] | 4 | |
Jesper Nilsson | bdb144b | 2008-06-29 23:15:19 +0200 | [diff] [blame^] | 5 | ccflags-y += -O2 $(LINUXINCLUDE) |
| 6 | asflags-y += $(LINUXINCLUDE) |
Jesper Nilsson | 546cc14 | 2008-01-17 11:22:41 +0100 | [diff] [blame] | 7 | ldflags-y += -T $(obj)/rescue.ld |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 9 | obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o |
| 10 | OBJECT := $(obj)/head.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 12 | targets := rescue.o rescue.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 14 | $(obj)/rescue.o: $(OBJECT) FORCE |
| 15 | $(call if_changed,ld) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 17 | $(obj)/rescue.bin: $(obj)/rescue.o FORCE |
| 18 | $(call if_changed,objcopy) |
| 19 | cp -p $(obj)/rescue.bin $(objtree) |
| 20 | |
| 21 | $(obj)/testrescue.bin: $(obj)/testrescue.o |
| 22 | $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | # Pad it to 784 bytes |
| 24 | dd if=/dev/zero of=tmp2423 bs=1 count=784 |
| 25 | cat tr.bin tmp2423 >testrescue_tmp.bin |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 26 | dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | rm tr.bin tmp2423 testrescue_tmp.bin |
| 28 | |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 29 | $(obj)/kimagerescue.bin: $(obj)/kimagerescue.o |
| 30 | $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | # 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 |
Jesper Nilsson | 63e6b9a | 2007-11-30 16:11:38 +0100 | [diff] [blame] | 34 | dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | rm ktr.bin tmp2423 kimagerescue_tmp.bin |