]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[CRIS] Build fixes for compressed and rescue images for v10 and v32:
authorJesper Nilsson <jesper@jni.nu>
Sun, 29 Jun 2008 21:15:19 +0000 (23:15 +0200)
committerJesper Nilsson <jesper@jni.nu>
Sun, 29 Jun 2008 21:15:19 +0000 (23:15 +0200)
- 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>
arch/cris/arch-v10/boot/Makefile
arch/cris/arch-v10/boot/compressed/Makefile
arch/cris/arch-v10/boot/compressed/decompress.ld
arch/cris/arch-v10/boot/compressed/head.S
arch/cris/arch-v10/boot/compressed/misc.c
arch/cris/arch-v10/boot/rescue/Makefile
arch/cris/arch-v32/boot/Makefile
arch/cris/arch-v32/boot/compressed/Makefile
arch/cris/arch-v32/boot/rescue/Makefile

index 20c83a53caf35d494066ba1c01ff9771a86d0c74..21720301443399aa08f4ab951e0799b37420b4e6 100644 (file)
@@ -2,7 +2,6 @@
 # arch/cris/arch-v10/boot/Makefile
 #
 
-OBJCOPY = objcopy-cris
 OBJCOPYFLAGS = -O binary --remove-section=.bss
 
 subdir- := compressed rescue
index 4a031cb27eb905f3ec264fb230486fee0c71d662..9ec5f87d5157175ce75eb4bfb5d03ffc7b23b15e 100644 (file)
@@ -2,12 +2,10 @@
 # arch/cris/arch-v10/boot/compressed/Makefile
 #
 
-CC = gcc-cris -melf $(LINUXINCLUDE)
-ccflags-y += -O2
-LD = ld-cris
+asflags-y += $(LINUXINCLUDE)
+ccflags-y += -O2 $(LINUXINCLUDE)
 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   $@
@@ -21,12 +19,6 @@ $(obj)/decompress.o: $(OBJECTS) FORCE
 $(obj)/decompress.bin: $(obj)/decompress.o FORCE
        $(call if_changed,objcopy)
 
-$(obj)/head.o: $(obj)/head.S .config
-       @$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
-
-$(obj)/misc.o: $(obj)/misc.c .config
-       @$(CC) -D__KERNEL__ -c $< -o $@
-
 $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
        $(call if_changed,image)
 
index 0b0a14fe61777c4352788ab2ae6b4db6e6f59ccb..e80f4594d54300cf22480725fd80856eddd2f04b 100644 (file)
@@ -1,4 +1,5 @@
-OUTPUT_FORMAT(elf32-us-cris)
+/* OUTPUT_FORMAT(elf32-us-cris) */
+OUTPUT_FORMAT(elf32-cris)
 
 MEMORY 
        {
index 610bdb2375530265e3f8b9770f3e2265d9d52d32..981fbae84959af9653d9e065eb9ba8313e7bf3bc 100644 (file)
 #define COMMAND_LINE_MAGIC 0x87109563
 
        ;; Exported symbols
-       
-       .globl  _input_data
 
-       
+       .globl  input_data
+
+
        .text
 
        nop
        di
 
 ;; 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
-       
+
 #include "../../lib/dram_init.S"
-       
-dram_init_finished:    
-               
+
+dram_init_finished:
+
        ;; 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
 
@@ -94,16 +94,16 @@ basse:      move.d  pc, r5
        move.d  $r10, [$r12]
        move.d  _cmd_line_addr, $r12
        move.d  $r11, [$r12]
-       
-       ;; Do the decompression and save compressed size in _inptr
 
-       jsr     _decompress_kernel
-       
-       ;; Put start address of root partition in r9 so the kernel can use it
+       ;; Do the decompression and save compressed size in inptr
+
+       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
@@ -112,12 +112,12 @@ basse:    move.d  pc, r5
        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:
        .dword 0
index 9a43ab19391e6a1680068d3f7dabd5b9a9703459..59961f20fabb2bddf4c390dd44f9fccaa492f58e 100644 (file)
@@ -30,8 +30,7 @@
 #define STATIC static
 
 void* memset(void* s, int c, size_t n);
-void* memcpy(void* __dest, __const void* __src,
-            size_t __n);
+void* memcpy(void* __dest, __const void* __src, size_t __n);
 
 #define memzero(s, n)     memset ((s), 0, (n))
 
@@ -81,11 +80,8 @@ static unsigned outcnt = 0;  /* bytes in output buffer */
 #  define Tracecv(c,x)
 #endif
 
-static int  fill_inbuf(void);
 static void flush_window(void);
 static void error(char *m);
-static void gzip_mark(void **);
-static void gzip_release(void **);
 
 extern char *input_data;  /* lives in head.S */
 
@@ -95,7 +91,6 @@ static unsigned long output_ptr = 0;
  
 static void *malloc(int size);
 static void free(void *where);
-static void error(char *m);
 static void gzip_mark(void **);
 static void gzip_release(void **);
  
@@ -103,8 +98,8 @@ static void puts(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"
 
@@ -170,6 +165,8 @@ memset(void* s, int c, size_t n)
        char *ss = (char*)s;
 
        for (i=0;i<n;i++) ss[i] = c;
+
+   return s;
 }
 
 void*
@@ -180,6 +177,8 @@ memcpy(void* __dest, __const void* __src,
        char *d = (char *)__dest, *s = (char *)__src;
 
        for (i=0;i<__n;i++) d[i] = s[i];
+
+   return __dest;
 }
 
 /* ===========================================================================
@@ -216,14 +215,12 @@ error(char *x)
        while(1);       /* Halt */
 }
 
-void
-setup_normal_output_buffer()
+void setup_normal_output_buffer(void)
 {
        output_data = (char *)KERNEL_LOAD_ADR;
 }
 
-void
-decompress_kernel()
+void decompress_kernel(void)
 {
        char revision;
        
@@ -257,7 +254,7 @@ decompress_kernel()
 
        makecrc();
 
-       __asm__ volatile ("move vr,%0" : "=rm" (revision));
+       __asm__ volatile ("move $vr,%0" : "=rm" (revision));
        if (revision < 10)
        {
                puts("You need an ETRAX 100LX to run linux 2.6\n");
index 2e5045b9e19c01ece12a4f97f88c9012c6b431fe..bea8b9c2a7cf6f9bc2667c53eafcf152dec6fa3f 100644 (file)
@@ -2,12 +2,9 @@
 # Makefile for rescue (bootstrap) code
 #
 
-CC = gcc-cris -mlinux $(LINUXINCLUDE)
-ccflags-y += -O2
-asflags-y += -traditional
-LD = gcc-cris -mlinux -nostdlib
+ccflags-y += -O2 $(LINUXINCLUDE)
+asflags-y += $(LINUXINCLUDE)
 ldflags-y += -T $(obj)/rescue.ld
-OBJCOPY = objcopy-cris
 OBJCOPYFLAGS = -O binary --remove-section=.bss
 obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
 OBJECT := $(obj)/head.o
index 3f91349c5f121acf2e03c24d3f2d18a706157ed1..99896ad60b30eff234c56919d861f4c215b10e01 100644 (file)
@@ -2,7 +2,6 @@
 # arch/cris/arch-v32/boot/Makefile
 #
 
-OBJCOPY = objcopy-cris
 OBJCOPYFLAGS = -O binary -R .note -R .comment
 
 subdir- := compressed rescue
index 2c8c2c3039c518c2c90b06902eab23dec30c779f..9138938eec382223846acb53286b723899d797ee 100644 (file)
@@ -2,14 +2,10 @@
 # arch/cris/arch-v32/boot/compressed/Makefile
 #
 
-CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
 asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
 ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch
-LD = gcc-cris -mlinux -march=v32 -nostdlib
 ldflags-y += -T $(obj)/decompress.ld
-obj-y = head.o misc.o
 OBJECTS = $(obj)/head.o $(obj)/misc.o
-OBJCOPY = objcopy-cris
 OBJCOPYFLAGS = -O binary --remove-section=.bss
 
 quiet_cmd_image = BUILD   $@
index c0987795dcb7b3d3b8bfee03fe50c78f7f4d41eb..b548bde185d7b03af77caf62d68d550f075f0a40 100644 (file)
@@ -9,7 +9,6 @@ asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
 LD = gcc-cris -mlinux -march=v32 -nostdlib
 ldflags-y += -T $(obj)/rescue.ld
 LDPOSTFLAGS = -lgcc
-OBJCOPY = objcopy-cris
 OBJCOPYFLAGS = -O binary --remove-section=.bss
 obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
 OBJECT := $(obj)/head.o