Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: Merge machine dependent boot/compressed and boot/rescue

Merge the machine dependent boot directories for v10 and v32.
This avoids some code duplication and eases the way for further
merging later on.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

+185 -428
+7 -7
arch/cris/Makefile
··· 70 70 # cris object files path 71 71 OBJ_ARCH = $(objtree)/arch/cris 72 72 73 - boot := arch/cris/$(SARCH)/boot 73 + boot := arch/cris/boot 74 74 MACHINE := arch/cris/$(SARCH) 75 75 76 76 all: zImage ··· 81 81 archprepare: 82 82 83 83 archclean: 84 - $(Q)if [ -e arch/cris/$(SARCH)/boot ]; then \ 85 - $(MAKE) $(clean)=arch/cris/$(SARCH)/boot; \ 84 + $(Q)if [ -e arch/cris/boot ]; then \ 85 + $(MAKE) $(clean)=arch/cris/boot; \ 86 86 fi 87 87 88 88 CLEAN_FILES += \ 89 - $(MACHINE)/boot/zImage \ 90 - $(MACHINE)/boot/compressed/decompress.bin \ 91 - $(MACHINE)/boot/compressed/piggy.gz \ 92 - $(MACHINE)/boot/rescue/rescue.bin 89 + $(boot)/zImage \ 90 + $(boot)/compressed/decompress.bin \ 91 + $(boot)/compressed/piggy.gz \ 92 + $(boot)/rescue/rescue.bin 93 93 94 94 95 95 # MRPROPER_FILES +=
arch/cris/arch-v10/boot/.gitignore arch/cris/boot/.gitignore
+6 -2
arch/cris/arch-v10/boot/Makefile arch/cris/boot/Makefile
··· 1 1 # 2 - # arch/cris/arch-v10/boot/Makefile 2 + # arch/cris/boot/Makefile 3 3 # 4 4 5 - OBJCOPYFLAGS = -O binary --remove-section=.bss 5 + objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment 6 + objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss 7 + 8 + OBJCOPYFLAGS = -O binary $(objcopyflags-y) 9 + 6 10 7 11 subdir- := compressed rescue 8 12 targets := Image
+15 -4
arch/cris/arch-v10/boot/compressed/Makefile arch/cris/boot/compressed/Makefile
··· 1 1 # 2 - # arch/cris/arch-v10/boot/compressed/Makefile 2 + # arch/cris/boot/compressed/Makefile 3 3 # 4 4 5 5 asflags-y += $(LINUXINCLUDE) 6 6 ccflags-y += -O2 $(LINUXINCLUDE) 7 - ldflags-y += -T $(srctree)/$(src)/decompress.lds 8 - OBJECTS = $(obj)/head.o $(obj)/misc.o 7 + 8 + # asflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/mach \ 9 + # -I$(srctree)/include/asm/arch 10 + # ccflags-$(CONFIG_ETRAX_ARCH_V32) += -O2 -I$(srctree)/include/asm/mach 11 + # -I$(srctree)/include/asm/arch 12 + 13 + arch-$(CONFIG_ETRAX_ARCH_V10) = v10 14 + arch-$(CONFIG_ETRAX_ARCH_V32) = v32 15 + 16 + ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds 17 + 18 + OBJECTS-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o 19 + OBJECTS-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o 20 + OBJECTS= $(OBJECTS-y) $(obj)/misc.o 9 21 OBJCOPYFLAGS = -O binary --remove-section=.bss 10 22 11 23 quiet_cmd_image = BUILD $@ ··· 36 24 37 25 $(obj)/piggy.gz: $(obj)/../Image FORCE 38 26 $(call if_changed,gzip) 39 -
-25
arch/cris/arch-v10/boot/compressed/README
··· 1 - Creation of the self-extracting compressed kernel image (vmlinuz) 2 - ----------------------------------------------------------------- 3 - $Id: README,v 1.1 2001/12/17 13:59:27 bjornw Exp $ 4 - 5 - This can be slightly confusing because it's a process with many steps. 6 - 7 - The kernel object built by the arch/etrax100/Makefile, vmlinux, is split 8 - by that makefile into text and data binary files, vmlinux.text and 9 - vmlinux.data. 10 - 11 - Those files together with a ROM filesystem can be catted together and 12 - burned into a flash or executed directly at the DRAM origin. 13 - 14 - They can also be catted together and compressed with gzip, which is what 15 - happens in this makefile. Together they make up piggy.img. 16 - 17 - The decompressor is built into the file decompress.o. It is turned into 18 - the binary file decompress.bin, which is catted together with piggy.img 19 - into the file vmlinuz. It can be executed in an arbitrary place in flash. 20 - 21 - Be careful - it assumes some things about free locations in DRAM. It 22 - assumes the DRAM starts at 0x40000000 and that it is at least 8 MB, 23 - so it puts its code at 0x40700000, and initial stack at 0x40800000. 24 - 25 - -Bjorn
arch/cris/arch-v10/boot/compressed/decompress.lds arch/cris/boot/compressed/decompress_v10.lds
+2 -2
arch/cris/arch-v10/boot/compressed/head.S arch/cris/boot/compressed/head_v10.S
··· 30 30 beq dram_init_finished 31 31 nop 32 32 33 - #include "../../lib/dram_init.S" 33 + #include "../../arch-v10/lib/dram_init.S" 34 34 35 35 dram_init_finished: 36 36 ··· 123 123 .dword 0 124 124 _cmd_line_addr: 125 125 .dword 0 126 - #include "../../lib/hw_settings.S" 126 + #include "../../arch-v10/lib/hw_settings.S"
-246
arch/cris/arch-v10/boot/compressed/misc.c
··· 1 - /* 2 - * misc.c 3 - * 4 - * This is a collection of several routines from gzip-1.0.3 5 - * adapted for Linux. 6 - * 7 - * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 8 - * puts by Nick Holloway 1993, better puts by Martin Mares 1995 9 - * adaptation for Linux/CRIS Axis Communications AB, 1999 10 - * 11 - */ 12 - 13 - /* where the piggybacked kernel image expects itself to live. 14 - * it is the same address we use when we network load an uncompressed 15 - * image into DRAM, and it is the address the kernel is linked to live 16 - * at by vmlinux.lds.S 17 - */ 18 - 19 - #define KERNEL_LOAD_ADR 0x40004000 20 - 21 - 22 - #include <linux/types.h> 23 - #include <arch/svinto.h> 24 - 25 - /* 26 - * gzip declarations 27 - */ 28 - 29 - #define OF(args) args 30 - #define STATIC static 31 - 32 - void *memset(void *s, int c, size_t n); 33 - void *memcpy(void *__dest, __const void *__src, size_t __n); 34 - 35 - #define memzero(s, n) memset((s), 0, (n)) 36 - 37 - typedef unsigned char uch; 38 - typedef unsigned short ush; 39 - typedef unsigned long ulg; 40 - 41 - #define WSIZE 0x8000 /* Window size must be at least 32k, */ 42 - /* and a power of two */ 43 - 44 - static uch *inbuf; /* input buffer */ 45 - static uch window[WSIZE]; /* Sliding window buffer */ 46 - 47 - unsigned inptr = 0; /* index of next byte to be processed in inbuf 48 - * After decompression it will contain the 49 - * compressed size, and head.S will read it. 50 - */ 51 - 52 - static unsigned outcnt = 0; /* bytes in output buffer */ 53 - 54 - /* gzip flag byte */ 55 - #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ 56 - #define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ 57 - #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ 58 - #define ORIG_NAME 0x08 /* bit 3 set: original file name present */ 59 - #define COMMENT 0x10 /* bit 4 set: file comment present */ 60 - #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 61 - #define RESERVED 0xC0 /* bit 6,7: reserved */ 62 - 63 - #define get_byte() (inbuf[inptr++]) 64 - 65 - /* Diagnostic functions */ 66 - #ifdef DEBUG 67 - # define Assert(cond, msg) do { \ 68 - if (!(cond)) \ 69 - error(msg); \ 70 - } while (0) 71 - # define Trace(x) fprintf x 72 - # define Tracev(x) do { \ 73 - if (verbose) \ 74 - fprintf x; \ 75 - } while (0) 76 - # define Tracevv(x) do { \ 77 - if (verbose > 1) \ 78 - fprintf x; \ 79 - } while (0) 80 - # define Tracec(c, x) do { \ 81 - if (verbose && (c)) \ 82 - fprintf x; \ 83 - } while (0) 84 - # define Tracecv(c, x) do { \ 85 - if (verbose > 1 && (c)) \ 86 - fprintf x; \ 87 - } while (0) 88 - #else 89 - # define Assert(cond, msg) 90 - # define Trace(x) 91 - # define Tracev(x) 92 - # define Tracevv(x) 93 - # define Tracec(c, x) 94 - # define Tracecv(c, x) 95 - #endif 96 - 97 - static void flush_window(void); 98 - static void error(char *m); 99 - 100 - extern char *input_data; /* lives in head.S */ 101 - 102 - static long bytes_out = 0; 103 - static uch *output_data; 104 - static unsigned long output_ptr = 0; 105 - static void puts(const char *); 106 - 107 - /* the "heap" is put directly after the BSS ends, at end */ 108 - 109 - extern int _end; 110 - static long free_mem_ptr = (long)&_end; 111 - static long free_mem_end_ptr; 112 - 113 - #include "../../../../../lib/inflate.c" 114 - 115 - /* decompressor info and error messages to serial console */ 116 - 117 - static void 118 - puts(const char *s) 119 - { 120 - #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 121 - while (*s) { 122 - #ifdef CONFIG_ETRAX_DEBUG_PORT0 123 - while (!(*R_SERIAL0_STATUS & (1 << 5))) ; 124 - *R_SERIAL0_TR_DATA = *s++; 125 - #endif 126 - #ifdef CONFIG_ETRAX_DEBUG_PORT1 127 - while (!(*R_SERIAL1_STATUS & (1 << 5))) ; 128 - *R_SERIAL1_TR_DATA = *s++; 129 - #endif 130 - #ifdef CONFIG_ETRAX_DEBUG_PORT2 131 - while (!(*R_SERIAL2_STATUS & (1 << 5))) ; 132 - *R_SERIAL2_TR_DATA = *s++; 133 - #endif 134 - #ifdef CONFIG_ETRAX_DEBUG_PORT3 135 - while (!(*R_SERIAL3_STATUS & (1 << 5))) ; 136 - *R_SERIAL3_TR_DATA = *s++; 137 - #endif 138 - } 139 - #endif 140 - } 141 - 142 - void *memset(void *s, int c, size_t n) 143 - { 144 - int i; 145 - char *ss = (char *)s; 146 - 147 - for (i = 0; i < n; i++) 148 - ss[i] = c; 149 - 150 - return s; 151 - } 152 - 153 - void *memcpy(void *__dest, __const void *__src, size_t __n) 154 - { 155 - int i; 156 - char *d = (char *)__dest, *s = (char *)__src; 157 - 158 - for (i = 0; i < __n; i++) 159 - d[i] = s[i]; 160 - 161 - return __dest; 162 - } 163 - 164 - /* =========================================================================== 165 - * Write the output window window[0..outcnt-1] and update crc and bytes_out. 166 - * (Used for the decompressed data only.) 167 - */ 168 - 169 - static void flush_window(void) 170 - { 171 - ulg c = crc; /* temporary variable */ 172 - unsigned n; 173 - uch *in, *out, ch; 174 - 175 - in = window; 176 - out = &output_data[output_ptr]; 177 - for (n = 0; n < outcnt; n++) { 178 - ch = *out = *in; 179 - out++; 180 - in++; 181 - c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 182 - } 183 - crc = c; 184 - bytes_out += (ulg)outcnt; 185 - output_ptr += (ulg)outcnt; 186 - outcnt = 0; 187 - } 188 - 189 - static void error(char *x) 190 - { 191 - puts("\n\n"); 192 - puts(x); 193 - puts("\n\n -- System halted\n"); 194 - 195 - while (1); /* Halt */ 196 - } 197 - 198 - void setup_normal_output_buffer(void) 199 - { 200 - output_data = (char *)KERNEL_LOAD_ADR; 201 - } 202 - 203 - void decompress_kernel(void) 204 - { 205 - char revision; 206 - 207 - /* input_data is set in head.S */ 208 - inbuf = input_data; 209 - 210 - #ifdef CONFIG_ETRAX_DEBUG_PORT0 211 - *R_SERIAL0_XOFF = 0; 212 - *R_SERIAL0_BAUD = 0x99; 213 - *R_SERIAL0_TR_CTRL = 0x40; 214 - #endif 215 - #ifdef CONFIG_ETRAX_DEBUG_PORT1 216 - *R_SERIAL1_XOFF = 0; 217 - *R_SERIAL1_BAUD = 0x99; 218 - *R_SERIAL1_TR_CTRL = 0x40; 219 - #endif 220 - #ifdef CONFIG_ETRAX_DEBUG_PORT2 221 - *R_GEN_CONFIG = 0x08; 222 - *R_SERIAL2_XOFF = 0; 223 - *R_SERIAL2_BAUD = 0x99; 224 - *R_SERIAL2_TR_CTRL = 0x40; 225 - #endif 226 - #ifdef CONFIG_ETRAX_DEBUG_PORT3 227 - *R_GEN_CONFIG = 0x100; 228 - *R_SERIAL3_XOFF = 0; 229 - *R_SERIAL3_BAUD = 0x99; 230 - *R_SERIAL3_TR_CTRL = 0x40; 231 - #endif 232 - 233 - setup_normal_output_buffer(); 234 - 235 - makecrc(); 236 - 237 - __asm__ volatile ("move $vr,%0" : "=rm" (revision)); 238 - if (revision < 10) { 239 - puts("You need an ETRAX 100LX to run linux 2.6\n"); 240 - while (1); 241 - } 242 - 243 - puts("Uncompressing Linux...\n"); 244 - gunzip(); 245 - puts("Done. Now booting the kernel.\n"); 246 - }
+17 -5
arch/cris/arch-v10/boot/rescue/Makefile arch/cris/boot/rescue/Makefile
··· 2 2 # Makefile for rescue (bootstrap) code 3 3 # 4 4 5 - ccflags-y += -O2 $(LINUXINCLUDE) 5 + # CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE) 6 + # ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \ 7 + # -I$(srctree)/include/asm/arch 8 + # asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch 9 + # LD = gcc-cris -mlinux -march=v32 -nostdlib 10 + 6 11 asflags-y += $(LINUXINCLUDE) 7 - ldflags-y += -T $(srctree)/$(src)/rescue.lds 12 + ccflags-y += -O2 $(LINUXINCLUDE) 13 + arch-$(CONFIG_ETRAX_ARCH_V10) = v10 14 + arch-$(CONFIG_ETRAX_ARCH_V32) = v32 15 + 16 + ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds 8 17 OBJCOPYFLAGS = -O binary --remove-section=.bss 9 - obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 10 - OBJECT := $(obj)/head.o 18 + obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o 19 + obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o 20 + OBJECTS := $(obj-y) 11 21 12 22 targets := rescue.o rescue.bin 13 23 14 - $(obj)/rescue.o: $(OBJECT) FORCE 24 + $(obj)/rescue.o: $(OBJECTS) FORCE 15 25 $(call if_changed,ld) 16 26 17 27 $(obj)/rescue.bin: $(obj)/rescue.o FORCE ··· 36 26 dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784 37 27 rm tr.bin tmp2423 testrescue_tmp.bin 38 28 29 + 39 30 $(obj)/kimagerescue.bin: $(obj)/kimagerescue.o 40 31 $(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin 41 32 # Pad it to 784 bytes, that's what the rescue loader expects ··· 44 33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin 45 34 dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784 46 35 rm ktr.bin tmp2423 kimagerescue_tmp.bin 36 +
+1 -1
arch/cris/arch-v10/boot/rescue/head.S arch/cris/boot/rescue/head_v10.S
··· 155 155 #endif 156 156 157 157 ;; We need to setup the bus registers before we start using the DRAM 158 - #include "../../lib/dram_init.S" 158 + #include "../../../arch-v10/lib/dram_init.S" 159 159 160 160 ;; we now should go through the checksum-table and check the listed 161 161 ;; partitions for errors.
arch/cris/arch-v10/boot/rescue/kimagerescue.S arch/cris/boot/rescue/kimagerescue.S
arch/cris/arch-v10/boot/rescue/rescue.lds arch/cris/boot/rescue/rescue_v10.lds
arch/cris/arch-v10/boot/rescue/testrescue.S arch/cris/boot/rescue/testrescue.S
arch/cris/arch-v10/boot/tools/build.c arch/cris/boot/tools/build.c
-20
arch/cris/arch-v32/boot/Makefile
··· 1 - # 2 - # arch/cris/arch-v32/boot/Makefile 3 - # 4 - 5 - OBJCOPYFLAGS = -O binary -R .note -R .comment 6 - 7 - subdir- := compressed rescue 8 - targets := Image 9 - 10 - $(obj)/Image: vmlinux FORCE 11 - $(call if_changed,objcopy) 12 - @echo ' Kernel: $@ is ready' 13 - 14 - $(obj)/compressed/vmlinux: $(obj)/Image FORCE 15 - $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 16 - $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin 17 - 18 - $(obj)/zImage: $(obj)/compressed/vmlinux 19 - @cp $< $@ 20 - @echo ' Kernel: $@ is ready'
-26
arch/cris/arch-v32/boot/compressed/Makefile
··· 1 - # 2 - # arch/cris/arch-v32/boot/compressed/Makefile 3 - # 4 - 5 - asflags-y += -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch 6 - ccflags-y += -O2 -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch 7 - ldflags-y += -T$(srctree)/$(src)/decompress.lds 8 - OBJECTS = $(obj)/head.o $(obj)/misc.o 9 - OBJCOPYFLAGS = -O binary --remove-section=.bss 10 - 11 - quiet_cmd_image = BUILD $@ 12 - cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@ 13 - 14 - targets := vmlinux piggy.gz decompress.o decompress.bin 15 - 16 - $(obj)/decompress.o: $(OBJECTS) FORCE 17 - $(call if_changed,ld) 18 - 19 - $(obj)/decompress.bin: $(obj)/decompress.o FORCE 20 - $(call if_changed,objcopy) 21 - 22 - $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE 23 - $(call if_changed,image) 24 - 25 - $(obj)/piggy.gz: $(obj)/../Image FORCE 26 - $(call if_changed,gzip)
arch/cris/arch-v32/boot/compressed/README arch/cris/boot/compressed/README
arch/cris/arch-v32/boot/compressed/decompress.lds arch/cris/boot/compressed/decompress_v32.lds
+5 -5
arch/cris/arch-v32/boot/compressed/head.S arch/cris/boot/compressed/head_v32.S
··· 17 17 .globl input_data 18 18 19 19 .text 20 - _start: 20 + start: 21 21 di 22 22 23 23 ;; Start clocks for used blocks. ··· 29 29 nop 30 30 31 31 #if defined CONFIG_ETRAXFS 32 - #include "../../mach-fs/dram_init.S" 32 + #include "../../arch-v32/mach-fs/dram_init.S" 33 33 #elif defined CONFIG_CRIS_MACH_ARTPEC3 34 - #include "../../mach-a3/dram_init.S" 34 + #include "../../arch-v32/mach-a3/dram_init.S" 35 35 #else 36 36 #error Only ETRAXFS and ARTPEC-3 supported! 37 37 #endif ··· 137 137 .dword 0 138 138 139 139 #if defined CONFIG_ETRAXFS 140 - #include "../../mach-fs/hw_settings.S" 140 + #include "../../arch-v32/mach-fs/hw_settings.S" 141 141 #elif defined CONFIG_CRIS_MACH_ARTPEC3 142 - #include "../../mach-a3/hw_settings.S" 142 + #include "../../arch-v32/mach-a3/hw_settings.S" 143 143 #else 144 144 #error Only ETRAXFS and ARTPEC-3 supported! 145 145 #endif
+132 -59
arch/cris/arch-v32/boot/compressed/misc.c arch/cris/boot/compressed/misc.c
··· 18 18 19 19 #define KERNEL_LOAD_ADR 0x40004000 20 20 21 - 22 21 #include <linux/types.h> 22 + 23 + #ifdef CONFIG_ETRAX_ARCH_V32 23 24 #include <hwregs/reg_rdwr.h> 24 25 #include <hwregs/reg_map.h> 25 26 #include <hwregs/ser_defs.h> 26 27 #include <hwregs/pinmux_defs.h> 27 28 #ifdef CONFIG_CRIS_MACH_ARTPEC3 28 29 #include <hwregs/clkgen_defs.h> 30 + #endif 31 + #else 32 + #include <arch/svinto.h> 29 33 #endif 30 34 31 35 /* ··· 39 35 #define OF(args) args 40 36 #define STATIC static 41 37 42 - void* memset(void* s, int c, size_t n); 43 - void* memcpy(void* __dest, __const void* __src, 44 - size_t __n); 38 + void *memset(void *s, int c, size_t n); 39 + void *memcpy(void *__dest, __const void *__src, size_t __n); 45 40 46 - #define memzero(s, n) memset ((s), 0, (n)) 47 - 41 + #define memzero(s, n) memset((s), 0, (n)) 48 42 49 43 typedef unsigned char uch; 50 44 typedef unsigned short ush; ··· 70 68 #define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ 71 69 #define RESERVED 0xC0 /* bit 6,7: reserved */ 72 70 73 - #define get_byte() inbuf[inptr++] 71 + #define get_byte() (inbuf[inptr++]) 74 72 75 73 /* Diagnostic functions */ 76 74 #ifdef DEBUG 77 - # define Assert(cond,msg) {if(!(cond)) error(msg);} 75 + # define Assert(cond, msg) do { \ 76 + if (!(cond)) \ 77 + error(msg); \ 78 + } while (0) 78 79 # define Trace(x) fprintf x 79 - # define Tracev(x) {if (verbose) fprintf x ;} 80 - # define Tracevv(x) {if (verbose>1) fprintf x ;} 81 - # define Tracec(c,x) {if (verbose && (c)) fprintf x ;} 82 - # define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;} 80 + # define Tracev(x) do { \ 81 + if (verbose) \ 82 + fprintf x; \ 83 + } while (0) 84 + # define Tracevv(x) do { \ 85 + if (verbose > 1) \ 86 + fprintf x; \ 87 + } while (0) 88 + # define Tracec(c, x) do { \ 89 + if (verbose && (c)) \ 90 + fprintf x; \ 91 + } while (0) 92 + # define Tracecv(c, x) do { \ 93 + if (verbose > 1 && (c)) \ 94 + fprintf x; \ 95 + } while (0) 83 96 #else 84 - # define Assert(cond,msg) 97 + # define Assert(cond, msg) 85 98 # define Trace(x) 86 99 # define Tracev(x) 87 100 # define Tracevv(x) 88 - # define Tracec(c,x) 89 - # define Tracecv(c,x) 101 + # define Tracec(c, x) 102 + # define Tracecv(c, x) 90 103 #endif 91 104 92 105 static void flush_window(void); 93 106 static void error(char *m); 107 + static void puts(const char *); 94 108 95 109 extern char *input_data; /* lives in head.S */ 96 110 97 111 static long bytes_out; 98 112 static uch *output_data; 99 113 static unsigned long output_ptr; 100 - 101 - static void error(char *m); 102 - 103 - static void puts(const char *); 104 114 105 115 /* the "heap" is put directly after the BSS ends, at end */ 106 116 ··· 124 110 125 111 /* decompressor info and error messages to serial console */ 126 112 127 - static inline void 128 - serout(const char *s, reg_scope_instances regi_ser) 113 + #ifdef CONFIG_ETRAX_ARCH_V32 114 + static inline void serout(const char *s, reg_scope_instances regi_ser) 129 115 { 130 116 reg_ser_rs_stat_din rs; 131 117 reg_ser_rw_dout dout = {.data = *s}; ··· 137 123 138 124 REG_WR(ser, regi_ser, rw_dout, dout); 139 125 } 126 + #endif 140 127 141 - static void 142 - puts(const char *s) 128 + static void puts(const char *s) 143 129 { 144 130 #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL 145 131 while (*s) { 146 132 #ifdef CONFIG_ETRAX_DEBUG_PORT0 133 + #ifdef CONFIG_ETRAX_ARCH_V32 147 134 serout(s, regi_ser0); 135 + #else 136 + while (!(*R_SERIAL0_STATUS & (1 << 5))) 137 + ; 138 + *R_SERIAL0_TR_DATA = *s++; 139 + #endif 148 140 #endif 149 141 #ifdef CONFIG_ETRAX_DEBUG_PORT1 142 + #ifdef CONFIG_ETRAX_ARCH_V32 150 143 serout(s, regi_ser1); 144 + #else 145 + while (!(*R_SERIAL1_STATUS & (1 << 5))) 146 + ; 147 + *R_SERIAL1_TR_DATA = *s++; 148 + #endif 151 149 #endif 152 150 #ifdef CONFIG_ETRAX_DEBUG_PORT2 151 + #ifdef CONFIG_ETRAX_ARCH_V32 153 152 serout(s, regi_ser2); 153 + #else 154 + while (!(*R_SERIAL2_STATUS & (1 << 5))) 155 + ; 156 + *R_SERIAL2_TR_DATA = *s++; 157 + #endif 154 158 #endif 155 159 #ifdef CONFIG_ETRAX_DEBUG_PORT3 160 + #ifdef CONFIG_ETRAX_ARCH_V32 156 161 serout(s, regi_ser3); 162 + #else 163 + while (!(*R_SERIAL3_STATUS & (1 << 5))) 164 + ; 165 + *R_SERIAL3_TR_DATA = *s++; 166 + #endif 157 167 #endif 158 168 *s++; 159 169 } ··· 185 147 #endif 186 148 } 187 149 188 - void* 189 - memset(void* s, int c, size_t n) 150 + void *memset(void *s, int c, size_t n) 190 151 { 191 152 int i; 192 153 char *ss = (char*)s; ··· 195 158 return s; 196 159 } 197 160 198 - void* 199 - memcpy(void* __dest, __const void* __src, 200 - size_t __n) 161 + void *memcpy(void *__dest, __const void *__src, size_t __n) 201 162 { 202 163 int i; 203 164 char *d = (char *)__dest, *s = (char *)__src; 204 165 205 - for (i=0;i<__n;i++) d[i] = s[i]; 166 + for (i = 0; i < __n; i++) 167 + d[i] = s[i]; 206 168 207 169 return __dest; 208 170 } ··· 211 175 * (Used for the decompressed data only.) 212 176 */ 213 177 214 - static void 215 - flush_window() 178 + static void flush_window(void) 216 179 { 217 - ulg c = crc; /* temporary variable */ 218 - unsigned n; 219 - uch *in, *out, ch; 180 + ulg c = crc; /* temporary variable */ 181 + unsigned n; 182 + uch *in, *out, ch; 220 183 221 - in = window; 222 - out = &output_data[output_ptr]; 223 - for (n = 0; n < outcnt; n++) { 224 - ch = *out++ = *in++; 225 - c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 226 - } 227 - crc = c; 228 - bytes_out += (ulg)outcnt; 229 - output_ptr += (ulg)outcnt; 230 - outcnt = 0; 184 + in = window; 185 + out = &output_data[output_ptr]; 186 + for (n = 0; n < outcnt; n++) { 187 + ch = *out = *in; 188 + out++; 189 + in++; 190 + c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); 191 + } 192 + crc = c; 193 + bytes_out += (ulg)outcnt; 194 + output_ptr += (ulg)outcnt; 195 + outcnt = 0; 231 196 } 232 197 233 - static void 234 - error(char *x) 198 + static void error(char *x) 235 199 { 236 - puts("\r\n\n"); 200 + puts("\n\n"); 237 201 puts(x); 238 - puts("\r\n\n -- System halted\n"); 202 + puts("\n\n -- System halted\n"); 239 203 240 204 while(1); /* Halt */ 241 205 } 242 206 243 - void 244 - setup_normal_output_buffer(void) 207 + void setup_normal_output_buffer(void) 245 208 { 246 209 output_data = (char *)KERNEL_LOAD_ADR; 247 210 } 248 211 249 - static inline void 250 - serial_setup(reg_scope_instances regi_ser) 212 + #ifdef CONFIG_ETRAX_ARCH_V32 213 + static inline void serial_setup(reg_scope_instances regi_ser) 251 214 { 252 215 reg_ser_rw_xoff xoff; 253 216 reg_ser_rw_tr_ctrl tr_ctrl; ··· 287 252 REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl); 288 253 REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud); 289 254 } 255 + #endif 290 256 291 - void 292 - decompress_kernel(void) 257 + void decompress_kernel(void) 293 258 { 294 259 char revision; 260 + char compile_rev; 295 261 262 + #ifdef CONFIG_ETRAX_ARCH_V32 263 + /* Need at least a CRISv32 to run. */ 264 + compile_rev = 32; 296 265 #if defined(CONFIG_ETRAX_DEBUG_PORT1) || \ 297 266 defined(CONFIG_ETRAX_DEBUG_PORT2) || \ 298 267 defined(CONFIG_ETRAX_DEBUG_PORT3) ··· 315 276 /* pinmux setup for ports 1..3 */ 316 277 hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot); 317 278 #endif 279 + 318 280 319 281 #ifdef CONFIG_ETRAX_DEBUG_PORT0 320 282 serial_setup(regi_ser0); ··· 340 300 341 301 /* input_data is set in head.S */ 342 302 inbuf = input_data; 303 + #else /* CRISv10 */ 304 + /* Need at least a crisv10 to run. */ 305 + compile_rev = 10; 306 + 307 + /* input_data is set in head.S */ 308 + inbuf = input_data; 309 + 310 + #ifdef CONFIG_ETRAX_DEBUG_PORT0 311 + *R_SERIAL0_XOFF = 0; 312 + *R_SERIAL0_BAUD = 0x99; 313 + *R_SERIAL0_TR_CTRL = 0x40; 314 + #endif 315 + #ifdef CONFIG_ETRAX_DEBUG_PORT1 316 + *R_SERIAL1_XOFF = 0; 317 + *R_SERIAL1_BAUD = 0x99; 318 + *R_SERIAL1_TR_CTRL = 0x40; 319 + #endif 320 + #ifdef CONFIG_ETRAX_DEBUG_PORT2 321 + *R_GEN_CONFIG = 0x08; 322 + *R_SERIAL2_XOFF = 0; 323 + *R_SERIAL2_BAUD = 0x99; 324 + *R_SERIAL2_TR_CTRL = 0x40; 325 + #endif 326 + #ifdef CONFIG_ETRAX_DEBUG_PORT3 327 + *R_GEN_CONFIG = 0x100; 328 + *R_SERIAL3_XOFF = 0; 329 + *R_SERIAL3_BAUD = 0x99; 330 + *R_SERIAL3_TR_CTRL = 0x40; 331 + #endif 332 + #endif 343 333 344 334 setup_normal_output_buffer(); 345 335 346 336 makecrc(); 347 337 348 338 __asm__ volatile ("move $vr,%0" : "=rm" (revision)); 349 - if (revision < 32) 350 - { 351 - puts("You need an ETRAX FS to run Linux 2.6/crisv32.\r\n"); 339 + if (revision < compile_rev) { 340 + #ifdef CONFIG_ETRAX_ARCH_V32 341 + puts("You need an ETRAX FS to run Linux 2.6/crisv32\n"); 342 + #else 343 + puts("You need an ETRAX 100LX to run linux 2.6\n"); 344 + #endif 352 345 while(1); 353 346 } 354 347 355 - puts("Uncompressing Linux...\r\n"); 348 + puts("Uncompressing Linux...\n"); 356 349 gunzip(); 357 - puts("Done. Now booting the kernel.\r\n"); 350 + puts("Done. Now booting the kernel\n"); 358 351 }
-26
arch/cris/arch-v32/boot/rescue/Makefile
··· 1 - # 2 - # Makefile for rescue (bootstrap) code 3 - # 4 - 5 - CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE) 6 - ccflags-y += -O2 -I $(srctree)/include/asm/arch/mach/ \ 7 - -I $(srctree)/include/asm/arch 8 - asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch 9 - LD = gcc-cris -mlinux -march=v32 -nostdlib 10 - ldflags-y += -T $(srctree)/$(src)/rescue.lds 11 - LDPOSTFLAGS = -lgcc 12 - OBJCOPYFLAGS = -O binary --remove-section=.bss 13 - obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o 14 - OBJECT := $(obj)/head.o 15 - 16 - targets := rescue.o rescue.bin 17 - 18 - quiet_cmd_ldlibgcc = LD $@ 19 - cmd_ldlibgcc = $(LD) $(LDFLAGS) $(filter-out FORCE,$^) $(LDPOSTFLAGS) -o $@ 20 - 21 - $(obj)/rescue.o: $(OBJECTS) FORCE 22 - $(call if_changed,ldlibgcc) 23 - 24 - $(obj)/rescue.bin: $(obj)/rescue.o FORCE 25 - $(call if_changed,objcopy) 26 - cp -p $(obj)/rescue.bin $(objtree)
arch/cris/arch-v32/boot/rescue/head.S arch/cris/boot/rescue/head_v32.S
arch/cris/arch-v32/boot/rescue/rescue.lds arch/cris/boot/rescue/rescue_v32.lds