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