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