finally fixes etrax toolchain problems, thanks nbd
[openwrt/openwrt.git] / target / linux / etrax / patches / 100-compile_fixes.patch
1 Index: linux-2.6.25.4/arch/cris/arch-v10/boot/Makefile
2 ===================================================================
3 --- linux-2.6.25.4.orig/arch/cris/arch-v10/boot/Makefile 2008-06-06 20:20:55.000000000 +0100
4 +++ linux-2.6.25.4/arch/cris/arch-v10/boot/Makefile 2008-06-06 20:21:20.000000000 +0100
5 @@ -2,7 +2,6 @@
6 # arch/cris/arch-v10/boot/Makefile
7 #
8
9 -OBJCOPY = objcopy-cris
10 OBJCOPYFLAGS = -O binary --remove-section=.bss
11
12 subdir- := compressed rescue
13 @@ -14,7 +13,6 @@
14
15 $(obj)/compressed/vmlinux: $(obj)/Image FORCE
16 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
17 - $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
18
19 $(obj)/zImage: $(obj)/compressed/vmlinux
20 @cp $< $@
21 Index: linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/Makefile
22 ===================================================================
23 --- linux-2.6.25.4.orig/arch/cris/arch-v10/boot/compressed/Makefile 2008-06-06 20:20:55.000000000 +0100
24 +++ linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/Makefile 2008-06-06 20:56:01.000000000 +0100
25 @@ -2,12 +2,10 @@
26 # arch/cris/arch-v10/boot/compressed/Makefile
27 #
28
29 -CC = gcc-cris -melf $(LINUXINCLUDE)
30 ccflags-y += -O2
31 -LD = ld-cris
32 +LD = $(CROSS_COMPILE)ld -m criself
33 ldflags-y += -T $(obj)/decompress.ld
34 OBJECTS = $(obj)/head.o $(obj)/misc.o
35 -OBJCOPY = objcopy-cris
36 OBJCOPYFLAGS = -O binary --remove-section=.bss
37
38 quiet_cmd_image = BUILD $@
39 @@ -22,10 +20,10 @@
40 $(call if_changed,objcopy)
41
42 $(obj)/head.o: $(obj)/head.S .config
43 - @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
44 + @$(CC) -D__ASSEMBLY__ -traditional -Wa,--em=criself -c $< -o $@
45
46 $(obj)/misc.o: $(obj)/misc.c .config
47 - @$(CC) -D__KERNEL__ -c $< -o $@
48 + @$(CC) -D__KERNEL__ -Wa,--em=criself -c $< -o $@
49
50 $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
51 $(call if_changed,image)
52 Index: linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/misc.c
53 ===================================================================
54 --- linux-2.6.25.4.orig/arch/cris/arch-v10/boot/compressed/misc.c 2008-06-06 20:20:55.000000000 +0100
55 +++ linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/misc.c 2008-06-06 21:02:10.000000000 +0100
56 @@ -5,7 +5,7 @@
57 * adapted for Linux.
58 *
59 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
60 - * puts by Nick Holloway 1993, better puts by Martin Mares 1995
61 + * putstr by Nick Holloway 1993, better putstr by Martin Mares 1995
62 * adaptation for Linux/CRIS Axis Communications AB, 1999
63 *
64 */
65 @@ -99,12 +99,12 @@
66 static void gzip_mark(void **);
67 static void gzip_release(void **);
68
69 -static void puts(const char *);
70 +static void putstr(const char *);
71
72 /* the "heap" is put directly after the BSS ends, at end */
73
74 -extern int end;
75 -static long free_mem_ptr = (long)&end;
76 +extern int _end;
77 +static long free_mem_ptr = (long)&_end;
78
79 #include "../../../../../lib/inflate.c"
80
81 @@ -139,7 +139,7 @@
82 /* decompressor info and error messages to serial console */
83
84 static void
85 -puts(const char *s)
86 +putstr(const char *s)
87 {
88 #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
89 while(*s) {
90 @@ -209,9 +209,9 @@
91 static void
92 error(char *x)
93 {
94 - puts("\n\n");
95 - puts(x);
96 - puts("\n\n -- System halted\n");
97 + putstr("\n\n");
98 + putstr(x);
99 + putstr("\n\n -- System halted\n");
100
101 while(1); /* Halt */
102 }
103 @@ -257,14 +257,7 @@
104
105 makecrc();
106
107 - __asm__ volatile ("move vr,%0" : "=rm" (revision));
108 - if (revision < 10)
109 - {
110 - puts("You need an ETRAX 100LX to run linux 2.6\n");
111 - while(1);
112 - }
113 -
114 - puts("Uncompressing Linux...\n");
115 + putstr("Uncompressing Linux...\n");
116 gunzip();
117 - puts("Done. Now booting the kernel.\n");
118 + putstr("Done. Now booting the kernel.\n");
119 }
120 Index: linux-2.6.25.4/arch/cris/arch-v10/mm/init.c
121 ===================================================================
122 --- linux-2.6.25.4.orig/arch/cris/arch-v10/mm/init.c 2008-06-06 20:20:55.000000000 +0100
123 +++ linux-2.6.25.4/arch/cris/arch-v10/mm/init.c 2008-06-06 20:21:20.000000000 +0100
124 @@ -184,6 +184,9 @@
125
126 free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
127 }
128 +void free_initrd_mem(unsigned long start, unsigned long end)
129 +{
130 +}
131
132 /* Initialize remaps of some I/O-ports. It is important that this
133 * is called before any driver is initialized.
134 Index: linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/head.S
135 ===================================================================
136 --- linux-2.6.25.4.orig/arch/cris/arch-v10/boot/compressed/head.S 2008-06-06 20:20:55.000000000 +0100
137 +++ linux-2.6.25.4/arch/cris/arch-v10/boot/compressed/head.S 2008-06-06 21:03:05.000000000 +0100
138 @@ -10,13 +10,14 @@
139
140 #define ASSEMBLER_MACROS_ONLY
141 #include <asm/arch/sv_addr_ag.h>
142 +#include <linux/autoconf.h>
143
144 #define RAM_INIT_MAGIC 0x56902387
145 #define COMMAND_LINE_MAGIC 0x87109563
146
147 ;; Exported symbols
148
149 - .globl _input_data
150 + .globl input_data
151
152
153 .text
154 @@ -26,7 +27,7 @@
155
156 ;; We need to initialze DRAM registers before we start using the DRAM
157
158 - cmp.d RAM_INIT_MAGIC, r8 ; Already initialized?
159 + cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
160 beq dram_init_finished
161 nop
162
163 @@ -36,91 +37,91 @@
164
165 ;; Initiate the PA and PB ports
166
167 - move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, r0
168 - move.b r0, [R_PORT_PA_DATA]
169 + move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
170 + move.b $r0, [R_PORT_PA_DATA]
171
172 - move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, r0
173 - move.b r0, [R_PORT_PA_DIR]
174 + move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
175 + move.b $r0, [R_PORT_PA_DIR]
176
177 - move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, r0
178 - move.b r0, [R_PORT_PB_DATA]
179 + move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
180 + move.b $r0, [R_PORT_PB_DATA]
181
182 - move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, r0
183 - move.b r0, [R_PORT_PB_DIR]
184 + move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
185 + move.b $r0, [R_PORT_PB_DIR]
186
187 ;; Setup the stack to a suitably high address.
188 ;; We assume 8 MB is the minimum DRAM in an eLinux
189 ;; product and put the sp at the top for now.
190
191 - move.d 0x40800000, sp
192 + move.d 0x40800000, $sp
193
194 ;; Figure out where the compressed piggyback image is
195 ;; in the flash (since we wont try to copy it to DRAM
196 ;; before unpacking). It is at _edata, but in flash.
197 ;; Use (_edata - basse) as offset to the current PC.
198
199 -basse: move.d pc, r5
200 - and.d 0x7fffffff, r5 ; strip any non-cache bit
201 - subq 2, r5 ; compensate for the move.d pc instr
202 - move.d r5, r0 ; save for later - flash address of 'basse'
203 - add.d _edata, r5
204 - sub.d basse, r5 ; r5 = flash address of '_edata'
205 +basse: move.d $pc, $r5
206 + and.d 0x7fffffff, $r5 ; strip any non-cache bit
207 + subq 2, $r5 ; compensate for the move.d pc instr
208 + move.d $r5, $r0 ; save for later - flash address of 'basse'
209 + add.d _edata, $r5
210 + sub.d basse, $r5 ; r5 = flash address of '_edata'
211
212 ;; Copy text+data to DRAM
213
214 - move.d basse, r1 ; destination
215 - move.d _edata, r2 ; end destination
216 -1: move.w [r0+], r3
217 - move.w r3, [r1+]
218 - cmp.d r2, r1
219 + move.d basse, $r1 ; destination
220 + move.d _edata, $r2 ; end destination
221 +1: move.w [$r0+], $r3
222 + move.w $r3, [$r1+]
223 + cmp.d $r2, $r1
224 bcs 1b
225 nop
226
227 - move.d r5, [_input_data] ; for the decompressor
228 + move.d $r5, [input_data] ; for the decompressor
229
230
231 ;; Clear the decompressors BSS (between _edata and _end)
232
233 - moveq 0, r0
234 - move.d _edata, r1
235 - move.d _end, r2
236 -1: move.w r0, [r1+]
237 - cmp.d r2, r1
238 + moveq 0, $r0
239 + move.d _edata, $r1
240 + move.d _end, $r2
241 +1: move.w $r0, [$r1+]
242 + cmp.d $r2, $r1
243 bcs 1b
244 nop
245
246 ;; Save command line magic and address.
247 - move.d _cmd_line_magic, $r12
248 + move.d cmd_line_magic, $r12
249 move.d $r10, [$r12]
250 - move.d _cmd_line_addr, $r12
251 + move.d cmd_line_addr, $r12
252 move.d $r11, [$r12]
253
254 ;; Do the decompression and save compressed size in _inptr
255
256 - jsr _decompress_kernel
257 + jsr decompress_kernel
258
259 ;; Put start address of root partition in r9 so the kernel can use it
260 ;; when mounting from flash
261
262 - move.d [_input_data], r9 ; flash address of compressed kernel
263 - add.d [_inptr], r9 ; size of compressed kernel
264 + move.d [input_data], $r9 ; flash address of compressed kernel
265 + add.d [inptr], $r9 ; size of compressed kernel
266
267 ;; Restore command line magic and address.
268 - move.d _cmd_line_magic, $r10
269 + move.d cmd_line_magic, $r10
270 move.d [$r10], $r10
271 - move.d _cmd_line_addr, $r11
272 + move.d cmd_line_addr, $r11
273 move.d [$r11], $r11
274
275 ;; Enter the decompressed kernel
276 - move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
277 + move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
278 jump 0x40004000 ; kernel is linked to this address
279
280 .data
281
282 -_input_data:
283 +input_data:
284 .dword 0 ; used by the decompressor
285 -_cmd_line_magic:
286 +cmd_line_magic:
287 .dword 0
288 -_cmd_line_addr:
289 +cmd_line_addr:
290 .dword 0
291 #include "../../lib/hw_settings.S"