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