diff options
Diffstat (limited to 'arch/cris/arch-v10/boot')
-rw-r--r-- | arch/cris/arch-v10/boot/Makefile | 9 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/Makefile | 43 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/head.S | 22 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/rescue/Makefile | 45 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/rescue/head.S | 33 |
5 files changed, 98 insertions, 54 deletions
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile index fe6650368e6a..e5b105851108 100644 --- a/arch/cris/arch-v10/boot/Makefile +++ b/arch/cris/arch-v10/boot/Makefile | |||
@@ -1,12 +1,13 @@ | |||
1 | # | 1 | # |
2 | # arch/cris/boot/Makefile | 2 | # arch/cris/boot/Makefile |
3 | # | 3 | # |
4 | target = $(target_boot_dir) | ||
5 | src = $(src_boot_dir) | ||
4 | 6 | ||
5 | zImage: compressed/vmlinuz | 7 | zImage: compressed/vmlinuz |
6 | 8 | ||
7 | compressed/vmlinuz: $(TOPDIR)/vmlinux | 9 | compressed/vmlinuz: |
8 | @$(MAKE) -C compressed vmlinuz | 10 | @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz |
9 | 11 | ||
10 | clean: | 12 | clean: |
11 | rm -f zImage tools/build compressed/vmlinux.out | 13 | @$(MAKE) -f $(src)/compressed/Makefile clean |
12 | @$(MAKE) -C compressed clean | ||
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile index 5f71c2c819e6..6584a44820f4 100644 --- a/arch/cris/arch-v10/boot/compressed/Makefile +++ b/arch/cris/arch-v10/boot/compressed/Makefile | |||
@@ -1,40 +1,45 @@ | |||
1 | # | 1 | # |
2 | # linux/arch/etrax100/boot/compressed/Makefile | 2 | # create a compressed vmlinuz image from the binary vmlinux.bin file |
3 | # | ||
4 | # create a compressed vmlinux image from the original vmlinux files and romfs | ||
5 | # | 3 | # |
4 | target = $(target_compressed_dir) | ||
5 | src = $(src_compressed_dir) | ||
6 | 6 | ||
7 | CC = gcc-cris -melf -I $(TOPDIR)/include | 7 | CC = gcc-cris -melf $(LINUXINCLUDE) |
8 | CFLAGS = -O2 | 8 | CFLAGS = -O2 |
9 | LD = ld-cris | 9 | LD = ld-cris |
10 | OBJCOPY = objcopy-cris | 10 | OBJCOPY = objcopy-cris |
11 | OBJCOPYFLAGS = -O binary --remove-section=.bss | 11 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
12 | OBJECTS = head.o misc.o | 12 | OBJECTS = $(target)/head.o $(target)/misc.o |
13 | 13 | ||
14 | # files to compress | 14 | # files to compress |
15 | SYSTEM = $(TOPDIR)/vmlinux.bin | 15 | SYSTEM = $(objtree)/vmlinux.bin |
16 | 16 | ||
17 | all: vmlinuz | 17 | all: $(target_compressed_dir)/vmlinuz |
18 | 18 | ||
19 | decompress.bin: $(OBJECTS) | 19 | $(target)/decompress.bin: $(OBJECTS) |
20 | $(LD) -T decompress.ld -o decompress.o $(OBJECTS) | 20 | $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS) |
21 | $(OBJCOPY) $(OBJCOPYFLAGS) decompress.o decompress.bin | 21 | $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin |
22 | # save it for mkprod in the topdir. | ||
23 | cp decompress.bin $(TOPDIR) | ||
24 | 22 | ||
23 | # Create vmlinuz image in top-level build directory | ||
24 | $(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin | ||
25 | @echo " COMPR vmlinux.bin --> vmlinuz" | ||
26 | @cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz | ||
27 | @rm -f piggy.img | ||
25 | 28 | ||
26 | vmlinuz: piggy.img decompress.bin | 29 | $(target)/head.o: $(src)/head.S |
27 | cat decompress.bin piggy.img > vmlinuz | 30 | $(CC) -D__ASSEMBLY__ -traditional -c $< -o $@ |
28 | rm -f piggy.img | ||
29 | 31 | ||
30 | head.o: head.S | 32 | $(target)/misc.o: $(src)/misc.c |
31 | $(CC) -D__ASSEMBLY__ -traditional -c head.S -o head.o | 33 | $(CC) -D__KERNEL__ -c $< -o $@ |
32 | 34 | ||
33 | # gzip the kernel image | 35 | # gzip the kernel image |
34 | 36 | ||
35 | piggy.img: $(SYSTEM) | 37 | piggy.img: $(SYSTEM) |
36 | cat $(SYSTEM) | gzip -f -9 > piggy.img | 38 | @cat $(SYSTEM) | gzip -f -9 > piggy.img |
39 | |||
40 | $(target): | ||
41 | mkdir -p $(target) | ||
37 | 42 | ||
38 | clean: | 43 | clean: |
39 | rm -f piggy.img vmlinuz vmlinuz.o | 44 | rm -f piggy.img $(objtree)/vmlinuz |
40 | 45 | ||
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S index 4cbdd4b1d9d6..e73f44c998d9 100644 --- a/arch/cris/arch-v10/boot/compressed/head.S +++ b/arch/cris/arch-v10/boot/compressed/head.S | |||
@@ -13,7 +13,8 @@ | |||
13 | #include <asm/arch/sv_addr_ag.h> | 13 | #include <asm/arch/sv_addr_ag.h> |
14 | 14 | ||
15 | #define RAM_INIT_MAGIC 0x56902387 | 15 | #define RAM_INIT_MAGIC 0x56902387 |
16 | 16 | #define COMMAND_LINE_MAGIC 0x87109563 | |
17 | |||
17 | ;; Exported symbols | 18 | ;; Exported symbols |
18 | 19 | ||
19 | .globl _input_data | 20 | .globl _input_data |
@@ -88,6 +89,12 @@ basse: move.d pc, r5 | |||
88 | cmp.d r2, r1 | 89 | cmp.d r2, r1 |
89 | bcs 1b | 90 | bcs 1b |
90 | nop | 91 | nop |
92 | |||
93 | ;; Save command line magic and address. | ||
94 | move.d _cmd_line_magic, $r12 | ||
95 | move.d $r10, [$r12] | ||
96 | move.d _cmd_line_addr, $r12 | ||
97 | move.d $r11, [$r12] | ||
91 | 98 | ||
92 | ;; Do the decompression and save compressed size in _inptr | 99 | ;; Do the decompression and save compressed size in _inptr |
93 | 100 | ||
@@ -98,7 +105,13 @@ basse: move.d pc, r5 | |||
98 | 105 | ||
99 | move.d [_input_data], r9 ; flash address of compressed kernel | 106 | move.d [_input_data], r9 ; flash address of compressed kernel |
100 | add.d [_inptr], r9 ; size of compressed kernel | 107 | add.d [_inptr], r9 ; size of compressed kernel |
101 | 108 | ||
109 | ;; Restore command line magic and address. | ||
110 | move.d _cmd_line_magic, $r10 | ||
111 | move.d [$r10], $r10 | ||
112 | move.d _cmd_line_addr, $r11 | ||
113 | move.d [$r11], $r11 | ||
114 | |||
102 | ;; Enter the decompressed kernel | 115 | ;; Enter the decompressed kernel |
103 | move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized | 116 | move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized |
104 | jump 0x40004000 ; kernel is linked to this address | 117 | jump 0x40004000 ; kernel is linked to this address |
@@ -107,5 +120,8 @@ basse: move.d pc, r5 | |||
107 | 120 | ||
108 | _input_data: | 121 | _input_data: |
109 | .dword 0 ; used by the decompressor | 122 | .dword 0 ; used by the decompressor |
110 | 123 | _cmd_line_magic: | |
124 | .dword 0 | ||
125 | _cmd_line_addr: | ||
126 | .dword 0 | ||
111 | #include "../../lib/hw_settings.S" | 127 | #include "../../lib/hw_settings.S" |
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 | ||
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S index 8689ea972c46..addb2194de0f 100644 --- a/arch/cris/arch-v10/boot/rescue/head.S +++ b/arch/cris/arch-v10/boot/rescue/head.S | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: head.S,v 1.6 2003/04/09 08:12:43 pkj Exp $ | 1 | /* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $ |
2 | * | 2 | * |
3 | * Rescue code, made to reside at the beginning of the | 3 | * Rescue code, made to reside at the beginning of the |
4 | * flash-memory. when it starts, it checks a partition | 4 | * flash-memory. when it starts, it checks a partition |
@@ -121,12 +121,13 @@ | |||
121 | ;; 0x80000000 if loaded in flash (as it should be) | 121 | ;; 0x80000000 if loaded in flash (as it should be) |
122 | ;; since etrax actually starts at address 2 when booting from flash, we | 122 | ;; since etrax actually starts at address 2 when booting from flash, we |
123 | ;; put a nop (2 bytes) here first so we dont accidentally skip the di | 123 | ;; put a nop (2 bytes) here first so we dont accidentally skip the di |
124 | 124 | ||
125 | nop | 125 | nop |
126 | di | 126 | di |
127 | 127 | ||
128 | jump in_cache ; enter cached area instead | 128 | jump in_cache ; enter cached area instead |
129 | in_cache: | 129 | in_cache: |
130 | |||
130 | 131 | ||
131 | ;; first put a jump test to give a possibility of upgrading the rescue code | 132 | ;; first put a jump test to give a possibility of upgrading the rescue code |
132 | ;; without erasing/reflashing the sector. we put a longword of -1 here and if | 133 | ;; without erasing/reflashing the sector. we put a longword of -1 here and if |
@@ -325,9 +326,29 @@ flash_ok: | |||
325 | ;; result will be in r0 | 326 | ;; result will be in r0 |
326 | checksum: | 327 | checksum: |
327 | moveq 0, $r0 | 328 | moveq 0, $r0 |
328 | 1: addu.b [$r1+], $r0 | 329 | moveq CONFIG_ETRAX_FLASH1_SIZE, $r6 |
329 | subq 1, $r2 | 330 | |
330 | bne 1b | 331 | ;; If the first physical flash memory is exceeded wrap to the second one. |
332 | btstq 26, $r1 ; Are we addressing first flash? | ||
333 | bpl 1f | ||
334 | nop | ||
335 | clear.d $r6 | ||
336 | |||
337 | 1: test.d $r6 ; 0 = no wrapping | ||
338 | beq 2f | ||
339 | nop | ||
340 | lslq 20, $r6 ; Convert MB to bytes | ||
341 | sub.d $r1, $r6 | ||
342 | |||
343 | 2: addu.b [$r1+], $r0 | ||
344 | subq 1, $r6 ; Flash memory left | ||
345 | beq 3f | ||
346 | subq 1, $r2 ; Length left | ||
347 | bne 2b | ||
331 | nop | 348 | nop |
332 | ret | 349 | ret |
333 | nop | 350 | nop |
351 | |||
352 | 3: move.d MEM_CSE1_START, $r1 ; wrap to second flash | ||
353 | ba 2b | ||
354 | nop | ||