diff options
author | Jesper Nilsson <jesper@jni.nu> | 2008-06-29 17:15:19 -0400 |
---|---|---|
committer | Jesper Nilsson <jesper@jni.nu> | 2008-06-29 17:15:19 -0400 |
commit | bdb144b67a7660ce5d044ae9a2fd1a8030f12523 (patch) | |
tree | 493177c56790bdf9a0358e5e5936e5b575006cc8 /arch/cris/arch-v10/boot | |
parent | 543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff) |
[CRIS] Build fixes for compressed and rescue images for v10 and v32:
- Use the normal cross gcc instead of using an elf specific cris toolchain.
This removes the dependency of this second toolchain.
- Use the normal cross objcopy instead of overriding it to use elf-toolchain.
This allows compiling using "CROSS_COMPILE=$CRIS_GCC/cris-axis-linux-gnu-"
instead of just "CROSS_COMPILE=$CRIS_GCC/cris-axis-linux-gnu/bin/"
- Remove redundant rules for compiling, the implicit rules are sufficient.
- Convert the arch/cris/arch-v10/boot/compressed/head.S to format
accepted by the cris-axis-linux-gnu-gcc (registers must be prefixed
with '$', remove explicit underscore on exported symbols)
- Remove a number of unused (and duplicated) prototypes from
arch/cris/arch-v10/boot/compressed/misc.c.
- Correct memcpy and memset return values (actually return them!)
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/arch-v10/boot')
-rw-r--r-- | arch/cris/arch-v10/boot/Makefile | 1 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/Makefile | 12 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/decompress.ld | 3 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/head.S | 98 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/compressed/misc.c | 23 | ||||
-rw-r--r-- | arch/cris/arch-v10/boot/rescue/Makefile | 7 |
6 files changed, 65 insertions, 79 deletions
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile index 20c83a53caf3..217203014433 100644 --- a/arch/cris/arch-v10/boot/Makefile +++ b/arch/cris/arch-v10/boot/Makefile | |||
@@ -2,7 +2,6 @@ | |||
2 | # arch/cris/arch-v10/boot/Makefile | 2 | # arch/cris/arch-v10/boot/Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | OBJCOPY = objcopy-cris | ||
6 | OBJCOPYFLAGS = -O binary --remove-section=.bss | 5 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
7 | 6 | ||
8 | subdir- := compressed rescue | 7 | subdir- := compressed rescue |
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile index 4a031cb27eb9..9ec5f87d5157 100644 --- a/arch/cris/arch-v10/boot/compressed/Makefile +++ b/arch/cris/arch-v10/boot/compressed/Makefile | |||
@@ -2,12 +2,10 @@ | |||
2 | # arch/cris/arch-v10/boot/compressed/Makefile | 2 | # arch/cris/arch-v10/boot/compressed/Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | CC = gcc-cris -melf $(LINUXINCLUDE) | 5 | asflags-y += $(LINUXINCLUDE) |
6 | ccflags-y += -O2 | 6 | ccflags-y += -O2 $(LINUXINCLUDE) |
7 | LD = ld-cris | ||
8 | ldflags-y += -T $(obj)/decompress.ld | 7 | ldflags-y += -T $(obj)/decompress.ld |
9 | OBJECTS = $(obj)/head.o $(obj)/misc.o | 8 | OBJECTS = $(obj)/head.o $(obj)/misc.o |
10 | OBJCOPY = objcopy-cris | ||
11 | OBJCOPYFLAGS = -O binary --remove-section=.bss | 9 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
12 | 10 | ||
13 | quiet_cmd_image = BUILD $@ | 11 | quiet_cmd_image = BUILD $@ |
@@ -21,12 +19,6 @@ $(obj)/decompress.o: $(OBJECTS) FORCE | |||
21 | $(obj)/decompress.bin: $(obj)/decompress.o FORCE | 19 | $(obj)/decompress.bin: $(obj)/decompress.o FORCE |
22 | $(call if_changed,objcopy) | 20 | $(call if_changed,objcopy) |
23 | 21 | ||
24 | $(obj)/head.o: $(obj)/head.S .config | ||
25 | @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@ | ||
26 | |||
27 | $(obj)/misc.o: $(obj)/misc.c .config | ||
28 | @$(CC) -D__KERNEL__ -c $< -o $@ | ||
29 | |||
30 | $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE | 22 | $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE |
31 | $(call if_changed,image) | 23 | $(call if_changed,image) |
32 | 24 | ||
diff --git a/arch/cris/arch-v10/boot/compressed/decompress.ld b/arch/cris/arch-v10/boot/compressed/decompress.ld index 0b0a14fe6177..e80f4594d543 100644 --- a/arch/cris/arch-v10/boot/compressed/decompress.ld +++ b/arch/cris/arch-v10/boot/compressed/decompress.ld | |||
@@ -1,4 +1,5 @@ | |||
1 | OUTPUT_FORMAT(elf32-us-cris) | 1 | /* OUTPUT_FORMAT(elf32-us-cris) */ |
2 | OUTPUT_FORMAT(elf32-cris) | ||
2 | 3 | ||
3 | MEMORY | 4 | MEMORY |
4 | { | 5 | { |
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S index 610bdb237553..981fbae84959 100644 --- a/arch/cris/arch-v10/boot/compressed/head.S +++ b/arch/cris/arch-v10/boot/compressed/head.S | |||
@@ -15,77 +15,77 @@ | |||
15 | #define COMMAND_LINE_MAGIC 0x87109563 | 15 | #define COMMAND_LINE_MAGIC 0x87109563 |
16 | 16 | ||
17 | ;; Exported symbols | 17 | ;; Exported symbols |
18 | |||
19 | .globl _input_data | ||
20 | 18 | ||
21 | 19 | .globl input_data | |
20 | |||
21 | |||
22 | .text | 22 | .text |
23 | 23 | ||
24 | nop | 24 | nop |
25 | di | 25 | di |
26 | 26 | ||
27 | ;; We need to initialze DRAM registers before we start using the DRAM | 27 | ;; We need to initialze DRAM registers before we start using the DRAM |
28 | 28 | ||
29 | cmp.d RAM_INIT_MAGIC, r8 ; Already initialized? | 29 | cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized? |
30 | beq dram_init_finished | 30 | beq dram_init_finished |
31 | nop | 31 | nop |
32 | 32 | ||
33 | #include "../../lib/dram_init.S" | 33 | #include "../../lib/dram_init.S" |
34 | 34 | ||
35 | dram_init_finished: | 35 | dram_init_finished: |
36 | 36 | ||
37 | ;; Initiate the PA and PB ports | 37 | ;; Initiate the PA and PB ports |
38 | 38 | ||
39 | move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0 | 39 | move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0 |
40 | move.b r0, [R_PORT_PA_DATA] | 40 | move.b $r0, [R_PORT_PA_DATA] |
41 | 41 | ||
42 | move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0 | 42 | move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0 |
43 | move.b r0, [R_PORT_PA_DIR] | 43 | move.b $r0, [R_PORT_PA_DIR] |
44 | 44 | ||
45 | move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0 | 45 | move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0 |
46 | move.b r0, [R_PORT_PB_DATA] | 46 | move.b $r0, [R_PORT_PB_DATA] |
47 | 47 | ||
48 | move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0 | 48 | move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0 |
49 | move.b r0, [R_PORT_PB_DIR] | 49 | move.b $r0, [R_PORT_PB_DIR] |
50 | 50 | ||
51 | ;; Setup the stack to a suitably high address. | 51 | ;; Setup the stack to a suitably high address. |
52 | ;; We assume 8 MB is the minimum DRAM in an eLinux | 52 | ;; We assume 8 MB is the minimum DRAM in an eLinux |
53 | ;; product and put the sp at the top for now. | 53 | ;; product and put the sp at the top for now. |
54 | 54 | ||
55 | move.d 0x40800000, sp | 55 | move.d 0x40800000, $sp |
56 | 56 | ||
57 | ;; Figure out where the compressed piggyback image is | 57 | ;; Figure out where the compressed piggyback image is |
58 | ;; in the flash (since we wont try to copy it to DRAM | 58 | ;; in the flash (since we wont try to copy it to DRAM |
59 | ;; before unpacking). It is at _edata, but in flash. | 59 | ;; before unpacking). It is at _edata, but in flash. |
60 | ;; Use (_edata - basse) as offset to the current PC. | 60 | ;; Use (_edata - basse) as offset to the current PC. |
61 | 61 | ||
62 | basse: move.d pc, r5 | 62 | basse: move.d $pc, $r5 |
63 | and.d 0x7fffffff, r5 ; strip any non-cache bit | 63 | and.d 0x7fffffff, $r5 ; strip any non-cache bit |
64 | subq 2, r5 ; compensate for the move.d pc instr | 64 | subq 2, $r5 ; compensate for the move.d $pc instr |
65 | move.d r5, r0 ; save for later - flash address of 'basse' | 65 | move.d $r5, $r0 ; save for later - flash address of 'basse' |
66 | add.d _edata, r5 | 66 | add.d _edata, $r5 |
67 | sub.d basse, r5 ; r5 = flash address of '_edata' | 67 | sub.d basse, $r5 ; $r5 = flash address of '_edata' |
68 | 68 | ||
69 | ;; Copy text+data to DRAM | 69 | ;; Copy text+data to DRAM |
70 | 70 | ||
71 | move.d basse, r1 ; destination | 71 | move.d basse, $r1 ; destination |
72 | move.d _edata, r2 ; end destination | 72 | move.d _edata, $r2 ; end destination |
73 | 1: move.w [r0+], r3 | 73 | 1: move.w [$r0+], $r3 |
74 | move.w r3, [r1+] | 74 | move.w $r3, [$r1+] |
75 | cmp.d r2, r1 | 75 | cmp.d $r2, $r1 |
76 | bcs 1b | 76 | bcs 1b |
77 | nop | 77 | nop |
78 | 78 | ||
79 | move.d r5, [_input_data] ; for the decompressor | 79 | move.d $r5, [input_data] ; for the decompressor |
80 | 80 | ||
81 | 81 | ||
82 | ;; Clear the decompressors BSS (between _edata and _end) | 82 | ;; Clear the decompressors BSS (between _edata and _end) |
83 | 83 | ||
84 | moveq 0, r0 | 84 | moveq 0, $r0 |
85 | move.d _edata, r1 | 85 | move.d _edata, $r1 |
86 | move.d _end, r2 | 86 | move.d _end, $r2 |
87 | 1: move.w r0, [r1+] | 87 | 1: move.w $r0, [$r1+] |
88 | cmp.d r2, r1 | 88 | cmp.d $r2, $r1 |
89 | bcs 1b | 89 | bcs 1b |
90 | nop | 90 | nop |
91 | 91 | ||
@@ -94,16 +94,16 @@ basse: move.d pc, r5 | |||
94 | move.d $r10, [$r12] | 94 | move.d $r10, [$r12] |
95 | move.d _cmd_line_addr, $r12 | 95 | move.d _cmd_line_addr, $r12 |
96 | move.d $r11, [$r12] | 96 | move.d $r11, [$r12] |
97 | |||
98 | ;; Do the decompression and save compressed size in _inptr | ||
99 | 97 | ||
100 | jsr _decompress_kernel | 98 | ;; Do the decompression and save compressed size in inptr |
101 | 99 | ||
102 | ;; Put start address of root partition in r9 so the kernel can use it | 100 | jsr decompress_kernel |
101 | |||
102 | ;; Put start address of root partition in $r9 so the kernel can use it | ||
103 | ;; when mounting from flash | 103 | ;; when mounting from flash |
104 | 104 | ||
105 | move.d [_input_data], r9 ; flash address of compressed kernel | 105 | move.d [input_data], $r9 ; flash address of compressed kernel |
106 | add.d [_inptr], r9 ; size of compressed kernel | 106 | add.d [inptr], $r9 ; size of compressed kernel |
107 | 107 | ||
108 | ;; Restore command line magic and address. | 108 | ;; Restore command line magic and address. |
109 | move.d _cmd_line_magic, $r10 | 109 | move.d _cmd_line_magic, $r10 |
@@ -112,12 +112,12 @@ basse: move.d pc, r5 | |||
112 | move.d [$r11], $r11 | 112 | move.d [$r11], $r11 |
113 | 113 | ||
114 | ;; Enter the decompressed kernel | 114 | ;; Enter the decompressed kernel |
115 | move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized | 115 | move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized |
116 | jump 0x40004000 ; kernel is linked to this address | 116 | jump 0x40004000 ; kernel is linked to this address |
117 | 117 | ||
118 | .data | 118 | .data |
119 | 119 | ||
120 | _input_data: | 120 | input_data: |
121 | .dword 0 ; used by the decompressor | 121 | .dword 0 ; used by the decompressor |
122 | _cmd_line_magic: | 122 | _cmd_line_magic: |
123 | .dword 0 | 123 | .dword 0 |
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c index 9a43ab19391e..59961f20fabb 100644 --- a/arch/cris/arch-v10/boot/compressed/misc.c +++ b/arch/cris/arch-v10/boot/compressed/misc.c | |||
@@ -30,8 +30,7 @@ | |||
30 | #define STATIC static | 30 | #define STATIC static |
31 | 31 | ||
32 | void* memset(void* s, int c, size_t n); | 32 | void* memset(void* s, int c, size_t n); |
33 | void* memcpy(void* __dest, __const void* __src, | 33 | void* memcpy(void* __dest, __const void* __src, size_t __n); |
34 | size_t __n); | ||
35 | 34 | ||
36 | #define memzero(s, n) memset ((s), 0, (n)) | 35 | #define memzero(s, n) memset ((s), 0, (n)) |
37 | 36 | ||
@@ -81,11 +80,8 @@ static unsigned outcnt = 0; /* bytes in output buffer */ | |||
81 | # define Tracecv(c,x) | 80 | # define Tracecv(c,x) |
82 | #endif | 81 | #endif |
83 | 82 | ||
84 | static int fill_inbuf(void); | ||
85 | static void flush_window(void); | 83 | static void flush_window(void); |
86 | static void error(char *m); | 84 | static void error(char *m); |
87 | static void gzip_mark(void **); | ||
88 | static void gzip_release(void **); | ||
89 | 85 | ||
90 | extern char *input_data; /* lives in head.S */ | 86 | extern char *input_data; /* lives in head.S */ |
91 | 87 | ||
@@ -95,7 +91,6 @@ static unsigned long output_ptr = 0; | |||
95 | 91 | ||
96 | static void *malloc(int size); | 92 | static void *malloc(int size); |
97 | static void free(void *where); | 93 | static void free(void *where); |
98 | static void error(char *m); | ||
99 | static void gzip_mark(void **); | 94 | static void gzip_mark(void **); |
100 | static void gzip_release(void **); | 95 | static void gzip_release(void **); |
101 | 96 | ||
@@ -103,8 +98,8 @@ static void puts(const char *); | |||
103 | 98 | ||
104 | /* the "heap" is put directly after the BSS ends, at end */ | 99 | /* the "heap" is put directly after the BSS ends, at end */ |
105 | 100 | ||
106 | extern int end; | 101 | extern int _end; |
107 | static long free_mem_ptr = (long)&end; | 102 | static long free_mem_ptr = (long)&_end; |
108 | 103 | ||
109 | #include "../../../../../lib/inflate.c" | 104 | #include "../../../../../lib/inflate.c" |
110 | 105 | ||
@@ -170,6 +165,8 @@ memset(void* s, int c, size_t n) | |||
170 | char *ss = (char*)s; | 165 | char *ss = (char*)s; |
171 | 166 | ||
172 | for (i=0;i<n;i++) ss[i] = c; | 167 | for (i=0;i<n;i++) ss[i] = c; |
168 | |||
169 | return s; | ||
173 | } | 170 | } |
174 | 171 | ||
175 | void* | 172 | void* |
@@ -180,6 +177,8 @@ memcpy(void* __dest, __const void* __src, | |||
180 | char *d = (char *)__dest, *s = (char *)__src; | 177 | char *d = (char *)__dest, *s = (char *)__src; |
181 | 178 | ||
182 | for (i=0;i<__n;i++) d[i] = s[i]; | 179 | for (i=0;i<__n;i++) d[i] = s[i]; |
180 | |||
181 | return __dest; | ||
183 | } | 182 | } |
184 | 183 | ||
185 | /* =========================================================================== | 184 | /* =========================================================================== |
@@ -216,14 +215,12 @@ error(char *x) | |||
216 | while(1); /* Halt */ | 215 | while(1); /* Halt */ |
217 | } | 216 | } |
218 | 217 | ||
219 | void | 218 | void setup_normal_output_buffer(void) |
220 | setup_normal_output_buffer() | ||
221 | { | 219 | { |
222 | output_data = (char *)KERNEL_LOAD_ADR; | 220 | output_data = (char *)KERNEL_LOAD_ADR; |
223 | } | 221 | } |
224 | 222 | ||
225 | void | 223 | void decompress_kernel(void) |
226 | decompress_kernel() | ||
227 | { | 224 | { |
228 | char revision; | 225 | char revision; |
229 | 226 | ||
@@ -257,7 +254,7 @@ decompress_kernel() | |||
257 | 254 | ||
258 | makecrc(); | 255 | makecrc(); |
259 | 256 | ||
260 | __asm__ volatile ("move vr,%0" : "=rm" (revision)); | 257 | __asm__ volatile ("move $vr,%0" : "=rm" (revision)); |
261 | if (revision < 10) | 258 | if (revision < 10) |
262 | { | 259 | { |
263 | puts("You need an ETRAX 100LX to run linux 2.6\n"); | 260 | puts("You need an ETRAX 100LX to run linux 2.6\n"); |
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile index 2e5045b9e19c..bea8b9c2a7cf 100644 --- a/arch/cris/arch-v10/boot/rescue/Makefile +++ b/arch/cris/arch-v10/boot/rescue/Makefile | |||
@@ -2,12 +2,9 @@ | |||
2 | # Makefile for rescue (bootstrap) code | 2 | # Makefile for rescue (bootstrap) code |
3 | # | 3 | # |
4 | 4 | ||
5 | CC = gcc-cris -mlinux $(LINUXINCLUDE) | 5 | ccflags-y += -O2 $(LINUXINCLUDE) |
6 | ccflags-y += -O2 | 6 | asflags-y += $(LINUXINCLUDE) |
7 | asflags-y += -traditional | ||
8 | LD = gcc-cris -mlinux -nostdlib | ||
9 | ldflags-y += -T $(obj)/rescue.ld | 7 | ldflags-y += -T $(obj)/rescue.ld |
10 | OBJCOPY = objcopy-cris | ||
11 | OBJCOPYFLAGS = -O binary --remove-section=.bss | 8 | OBJCOPYFLAGS = -O binary --remove-section=.bss |
12 | obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o | 9 | obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o |
13 | OBJECT := $(obj)/head.o | 10 | OBJECT := $(obj)/head.o |