mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 08:02:07 +00:00
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>
This commit is contained in:
parent
a939b96ccc
commit
66ab3a74c5
@ -70,7 +70,7 @@ SRC_ARCH = $(srctree)/arch/cris
|
||||
# cris object files path
|
||||
OBJ_ARCH = $(objtree)/arch/cris
|
||||
|
||||
boot := arch/cris/$(SARCH)/boot
|
||||
boot := arch/cris/boot
|
||||
MACHINE := arch/cris/$(SARCH)
|
||||
|
||||
all: zImage
|
||||
@ -81,15 +81,15 @@ zImage Image: vmlinux
|
||||
archprepare:
|
||||
|
||||
archclean:
|
||||
$(Q)if [ -e arch/cris/$(SARCH)/boot ]; then \
|
||||
$(MAKE) $(clean)=arch/cris/$(SARCH)/boot; \
|
||||
$(Q)if [ -e arch/cris/boot ]; then \
|
||||
$(MAKE) $(clean)=arch/cris/boot; \
|
||||
fi
|
||||
|
||||
CLEAN_FILES += \
|
||||
$(MACHINE)/boot/zImage \
|
||||
$(MACHINE)/boot/compressed/decompress.bin \
|
||||
$(MACHINE)/boot/compressed/piggy.gz \
|
||||
$(MACHINE)/boot/rescue/rescue.bin
|
||||
$(boot)/zImage \
|
||||
$(boot)/compressed/decompress.bin \
|
||||
$(boot)/compressed/piggy.gz \
|
||||
$(boot)/rescue/rescue.bin
|
||||
|
||||
|
||||
# MRPROPER_FILES +=
|
||||
|
@ -1,25 +0,0 @@
|
||||
Creation of the self-extracting compressed kernel image (vmlinuz)
|
||||
-----------------------------------------------------------------
|
||||
$Id: README,v 1.1 2001/12/17 13:59:27 bjornw Exp $
|
||||
|
||||
This can be slightly confusing because it's a process with many steps.
|
||||
|
||||
The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
|
||||
by that makefile into text and data binary files, vmlinux.text and
|
||||
vmlinux.data.
|
||||
|
||||
Those files together with a ROM filesystem can be catted together and
|
||||
burned into a flash or executed directly at the DRAM origin.
|
||||
|
||||
They can also be catted together and compressed with gzip, which is what
|
||||
happens in this makefile. Together they make up piggy.img.
|
||||
|
||||
The decompressor is built into the file decompress.o. It is turned into
|
||||
the binary file decompress.bin, which is catted together with piggy.img
|
||||
into the file vmlinuz. It can be executed in an arbitrary place in flash.
|
||||
|
||||
Be careful - it assumes some things about free locations in DRAM. It
|
||||
assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
|
||||
so it puts its code at 0x40700000, and initial stack at 0x40800000.
|
||||
|
||||
-Bjorn
|
@ -1,246 +0,0 @@
|
||||
/*
|
||||
* misc.c
|
||||
*
|
||||
* This is a collection of several routines from gzip-1.0.3
|
||||
* adapted for Linux.
|
||||
*
|
||||
* malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
|
||||
* puts by Nick Holloway 1993, better puts by Martin Mares 1995
|
||||
* adaptation for Linux/CRIS Axis Communications AB, 1999
|
||||
*
|
||||
*/
|
||||
|
||||
/* where the piggybacked kernel image expects itself to live.
|
||||
* it is the same address we use when we network load an uncompressed
|
||||
* image into DRAM, and it is the address the kernel is linked to live
|
||||
* at by vmlinux.lds.S
|
||||
*/
|
||||
|
||||
#define KERNEL_LOAD_ADR 0x40004000
|
||||
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <arch/svinto.h>
|
||||
|
||||
/*
|
||||
* gzip declarations
|
||||
*/
|
||||
|
||||
#define OF(args) args
|
||||
#define STATIC static
|
||||
|
||||
void *memset(void *s, int c, size_t n);
|
||||
void *memcpy(void *__dest, __const void *__src, size_t __n);
|
||||
|
||||
#define memzero(s, n) memset((s), 0, (n))
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short ush;
|
||||
typedef unsigned long ulg;
|
||||
|
||||
#define WSIZE 0x8000 /* Window size must be at least 32k, */
|
||||
/* and a power of two */
|
||||
|
||||
static uch *inbuf; /* input buffer */
|
||||
static uch window[WSIZE]; /* Sliding window buffer */
|
||||
|
||||
unsigned inptr = 0; /* index of next byte to be processed in inbuf
|
||||
* After decompression it will contain the
|
||||
* compressed size, and head.S will read it.
|
||||
*/
|
||||
|
||||
static unsigned outcnt = 0; /* bytes in output buffer */
|
||||
|
||||
/* gzip flag byte */
|
||||
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
|
||||
#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
|
||||
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
|
||||
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
|
||||
#define COMMENT 0x10 /* bit 4 set: file comment present */
|
||||
#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
|
||||
#define RESERVED 0xC0 /* bit 6,7: reserved */
|
||||
|
||||
#define get_byte() (inbuf[inptr++])
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef DEBUG
|
||||
# define Assert(cond, msg) do { \
|
||||
if (!(cond)) \
|
||||
error(msg); \
|
||||
} while (0)
|
||||
# define Trace(x) fprintf x
|
||||
# define Tracev(x) do { \
|
||||
if (verbose) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracevv(x) do { \
|
||||
if (verbose > 1) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracec(c, x) do { \
|
||||
if (verbose && (c)) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracecv(c, x) do { \
|
||||
if (verbose > 1 && (c)) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
#else
|
||||
# define Assert(cond, msg)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c, x)
|
||||
# define Tracecv(c, x)
|
||||
#endif
|
||||
|
||||
static void flush_window(void);
|
||||
static void error(char *m);
|
||||
|
||||
extern char *input_data; /* lives in head.S */
|
||||
|
||||
static long bytes_out = 0;
|
||||
static uch *output_data;
|
||||
static unsigned long output_ptr = 0;
|
||||
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;
|
||||
static long free_mem_end_ptr;
|
||||
|
||||
#include "../../../../../lib/inflate.c"
|
||||
|
||||
/* decompressor info and error messages to serial console */
|
||||
|
||||
static void
|
||||
puts(const char *s)
|
||||
{
|
||||
#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
|
||||
while (*s) {
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT0
|
||||
while (!(*R_SERIAL0_STATUS & (1 << 5))) ;
|
||||
*R_SERIAL0_TR_DATA = *s++;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT1
|
||||
while (!(*R_SERIAL1_STATUS & (1 << 5))) ;
|
||||
*R_SERIAL1_TR_DATA = *s++;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT2
|
||||
while (!(*R_SERIAL2_STATUS & (1 << 5))) ;
|
||||
*R_SERIAL2_TR_DATA = *s++;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT3
|
||||
while (!(*R_SERIAL3_STATUS & (1 << 5))) ;
|
||||
*R_SERIAL3_TR_DATA = *s++;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
int i;
|
||||
char *ss = (char *)s;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
ss[i] = c;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void *memcpy(void *__dest, __const void *__src, size_t __n)
|
||||
{
|
||||
int i;
|
||||
char *d = (char *)__dest, *s = (char *)__src;
|
||||
|
||||
for (i = 0; i < __n; i++)
|
||||
d[i] = s[i];
|
||||
|
||||
return __dest;
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
|
||||
static void flush_window(void)
|
||||
{
|
||||
ulg c = crc; /* temporary variable */
|
||||
unsigned n;
|
||||
uch *in, *out, ch;
|
||||
|
||||
in = window;
|
||||
out = &output_data[output_ptr];
|
||||
for (n = 0; n < outcnt; n++) {
|
||||
ch = *out = *in;
|
||||
out++;
|
||||
in++;
|
||||
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
|
||||
}
|
||||
crc = c;
|
||||
bytes_out += (ulg)outcnt;
|
||||
output_ptr += (ulg)outcnt;
|
||||
outcnt = 0;
|
||||
}
|
||||
|
||||
static void error(char *x)
|
||||
{
|
||||
puts("\n\n");
|
||||
puts(x);
|
||||
puts("\n\n -- System halted\n");
|
||||
|
||||
while (1); /* Halt */
|
||||
}
|
||||
|
||||
void setup_normal_output_buffer(void)
|
||||
{
|
||||
output_data = (char *)KERNEL_LOAD_ADR;
|
||||
}
|
||||
|
||||
void decompress_kernel(void)
|
||||
{
|
||||
char revision;
|
||||
|
||||
/* input_data is set in head.S */
|
||||
inbuf = input_data;
|
||||
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT0
|
||||
*R_SERIAL0_XOFF = 0;
|
||||
*R_SERIAL0_BAUD = 0x99;
|
||||
*R_SERIAL0_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT1
|
||||
*R_SERIAL1_XOFF = 0;
|
||||
*R_SERIAL1_BAUD = 0x99;
|
||||
*R_SERIAL1_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT2
|
||||
*R_GEN_CONFIG = 0x08;
|
||||
*R_SERIAL2_XOFF = 0;
|
||||
*R_SERIAL2_BAUD = 0x99;
|
||||
*R_SERIAL2_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT3
|
||||
*R_GEN_CONFIG = 0x100;
|
||||
*R_SERIAL3_XOFF = 0;
|
||||
*R_SERIAL3_BAUD = 0x99;
|
||||
*R_SERIAL3_TR_CTRL = 0x40;
|
||||
#endif
|
||||
|
||||
setup_normal_output_buffer();
|
||||
|
||||
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");
|
||||
gunzip();
|
||||
puts("Done. Now booting the kernel.\n");
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
#
|
||||
# arch/cris/arch-v32/boot/Makefile
|
||||
#
|
||||
|
||||
OBJCOPYFLAGS = -O binary -R .note -R .comment
|
||||
|
||||
subdir- := compressed rescue
|
||||
targets := Image
|
||||
|
||||
$(obj)/Image: vmlinux FORCE
|
||||
$(call if_changed,objcopy)
|
||||
@echo ' Kernel: $@ is ready'
|
||||
|
||||
$(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 $< $@
|
||||
@echo ' Kernel: $@ is ready'
|
@ -1,26 +0,0 @@
|
||||
#
|
||||
# arch/cris/arch-v32/boot/compressed/Makefile
|
||||
#
|
||||
|
||||
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
|
||||
ldflags-y += -T$(srctree)/$(src)/decompress.lds
|
||||
OBJECTS = $(obj)/head.o $(obj)/misc.o
|
||||
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
||||
|
||||
quiet_cmd_image = BUILD $@
|
||||
cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
|
||||
|
||||
targets := vmlinux piggy.gz decompress.o decompress.bin
|
||||
|
||||
$(obj)/decompress.o: $(OBJECTS) FORCE
|
||||
$(call if_changed,ld)
|
||||
|
||||
$(obj)/decompress.bin: $(obj)/decompress.o FORCE
|
||||
$(call if_changed,objcopy)
|
||||
|
||||
$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
|
||||
$(call if_changed,image)
|
||||
|
||||
$(obj)/piggy.gz: $(obj)/../Image FORCE
|
||||
$(call if_changed,gzip)
|
@ -1,26 +0,0 @@
|
||||
#
|
||||
# Makefile for rescue (bootstrap) code
|
||||
#
|
||||
|
||||
CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
|
||||
ccflags-y += -O2 -I $(srctree)/include/asm/arch/mach/ \
|
||||
-I $(srctree)/include/asm/arch
|
||||
asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
|
||||
LD = gcc-cris -mlinux -march=v32 -nostdlib
|
||||
ldflags-y += -T $(srctree)/$(src)/rescue.lds
|
||||
LDPOSTFLAGS = -lgcc
|
||||
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
||||
obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
|
||||
OBJECT := $(obj)/head.o
|
||||
|
||||
targets := rescue.o rescue.bin
|
||||
|
||||
quiet_cmd_ldlibgcc = LD $@
|
||||
cmd_ldlibgcc = $(LD) $(LDFLAGS) $(filter-out FORCE,$^) $(LDPOSTFLAGS) -o $@
|
||||
|
||||
$(obj)/rescue.o: $(OBJECTS) FORCE
|
||||
$(call if_changed,ldlibgcc)
|
||||
|
||||
$(obj)/rescue.bin: $(obj)/rescue.o FORCE
|
||||
$(call if_changed,objcopy)
|
||||
cp -p $(obj)/rescue.bin $(objtree)
|
@ -1,8 +1,12 @@
|
||||
#
|
||||
# arch/cris/arch-v10/boot/Makefile
|
||||
# arch/cris/boot/Makefile
|
||||
#
|
||||
|
||||
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
||||
objcopyflags-$(CONFIG_ETRAX_ARCH_V10) += -R .note -R .comment
|
||||
objcopyflags-$(CONFIG_ETRAX_ARCH_V32) += --remove-section=.bss
|
||||
|
||||
OBJCOPYFLAGS = -O binary $(objcopyflags-y)
|
||||
|
||||
|
||||
subdir- := compressed rescue
|
||||
targets := Image
|
@ -1,11 +1,23 @@
|
||||
#
|
||||
# arch/cris/arch-v10/boot/compressed/Makefile
|
||||
# arch/cris/boot/compressed/Makefile
|
||||
#
|
||||
|
||||
asflags-y += $(LINUXINCLUDE)
|
||||
ccflags-y += -O2 $(LINUXINCLUDE)
|
||||
ldflags-y += -T $(srctree)/$(src)/decompress.lds
|
||||
OBJECTS = $(obj)/head.o $(obj)/misc.o
|
||||
|
||||
# asflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/mach \
|
||||
# -I$(srctree)/include/asm/arch
|
||||
# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -O2 -I$(srctree)/include/asm/mach
|
||||
# -I$(srctree)/include/asm/arch
|
||||
|
||||
arch-$(CONFIG_ETRAX_ARCH_V10) = v10
|
||||
arch-$(CONFIG_ETRAX_ARCH_V32) = v32
|
||||
|
||||
ldflags-y += -T $(srctree)/$(src)/decompress_$(arch-y).lds
|
||||
|
||||
OBJECTS-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
|
||||
OBJECTS-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
|
||||
OBJECTS= $(OBJECTS-y) $(obj)/misc.o
|
||||
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
||||
|
||||
quiet_cmd_image = BUILD $@
|
||||
@ -24,4 +36,3 @@ $(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
|
||||
|
||||
$(obj)/piggy.gz: $(obj)/../Image FORCE
|
||||
$(call if_changed,gzip)
|
||||
|
@ -30,7 +30,7 @@
|
||||
beq dram_init_finished
|
||||
nop
|
||||
|
||||
#include "../../lib/dram_init.S"
|
||||
#include "../../arch-v10/lib/dram_init.S"
|
||||
|
||||
dram_init_finished:
|
||||
|
||||
@ -123,4 +123,4 @@ _cmd_line_magic:
|
||||
.dword 0
|
||||
_cmd_line_addr:
|
||||
.dword 0
|
||||
#include "../../lib/hw_settings.S"
|
||||
#include "../../arch-v10/lib/hw_settings.S"
|
@ -17,7 +17,7 @@
|
||||
.globl input_data
|
||||
|
||||
.text
|
||||
_start:
|
||||
start:
|
||||
di
|
||||
|
||||
;; Start clocks for used blocks.
|
||||
@ -29,9 +29,9 @@ _start:
|
||||
nop
|
||||
|
||||
#if defined CONFIG_ETRAXFS
|
||||
#include "../../mach-fs/dram_init.S"
|
||||
#include "../../arch-v32/mach-fs/dram_init.S"
|
||||
#elif defined CONFIG_CRIS_MACH_ARTPEC3
|
||||
#include "../../mach-a3/dram_init.S"
|
||||
#include "../../arch-v32/mach-a3/dram_init.S"
|
||||
#else
|
||||
#error Only ETRAXFS and ARTPEC-3 supported!
|
||||
#endif
|
||||
@ -137,9 +137,9 @@ _boot_source:
|
||||
.dword 0
|
||||
|
||||
#if defined CONFIG_ETRAXFS
|
||||
#include "../../mach-fs/hw_settings.S"
|
||||
#include "../../arch-v32/mach-fs/hw_settings.S"
|
||||
#elif defined CONFIG_CRIS_MACH_ARTPEC3
|
||||
#include "../../mach-a3/hw_settings.S"
|
||||
#include "../../arch-v32/mach-a3/hw_settings.S"
|
||||
#else
|
||||
#error Only ETRAXFS and ARTPEC-3 supported!
|
||||
#endif
|
@ -18,8 +18,9 @@
|
||||
|
||||
#define KERNEL_LOAD_ADR 0x40004000
|
||||
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
#include <hwregs/reg_rdwr.h>
|
||||
#include <hwregs/reg_map.h>
|
||||
#include <hwregs/ser_defs.h>
|
||||
@ -27,6 +28,9 @@
|
||||
#ifdef CONFIG_CRIS_MACH_ARTPEC3
|
||||
#include <hwregs/clkgen_defs.h>
|
||||
#endif
|
||||
#else
|
||||
#include <arch/svinto.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gzip declarations
|
||||
@ -35,12 +39,10 @@
|
||||
#define OF(args) args
|
||||
#define STATIC static
|
||||
|
||||
void* memset(void* s, int c, size_t n);
|
||||
void* memcpy(void* __dest, __const void* __src,
|
||||
size_t __n);
|
||||
|
||||
#define memzero(s, n) memset ((s), 0, (n))
|
||||
void *memset(void *s, int c, size_t n);
|
||||
void *memcpy(void *__dest, __const void *__src, size_t __n);
|
||||
|
||||
#define memzero(s, n) memset((s), 0, (n))
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef unsigned short ush;
|
||||
@ -68,27 +70,43 @@ static unsigned outcnt = 0; /* bytes in output buffer */
|
||||
#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
|
||||
#define RESERVED 0xC0 /* bit 6,7: reserved */
|
||||
|
||||
#define get_byte() inbuf[inptr++]
|
||||
#define get_byte() (inbuf[inptr++])
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef DEBUG
|
||||
# define Assert(cond,msg) {if(!(cond)) error(msg);}
|
||||
# define Assert(cond, msg) do { \
|
||||
if (!(cond)) \
|
||||
error(msg); \
|
||||
} while (0)
|
||||
# define Trace(x) fprintf x
|
||||
# define Tracev(x) {if (verbose) fprintf x ;}
|
||||
# define Tracevv(x) {if (verbose>1) fprintf x ;}
|
||||
# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
|
||||
# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
|
||||
# define Tracev(x) do { \
|
||||
if (verbose) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracevv(x) do { \
|
||||
if (verbose > 1) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracec(c, x) do { \
|
||||
if (verbose && (c)) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
# define Tracecv(c, x) do { \
|
||||
if (verbose > 1 && (c)) \
|
||||
fprintf x; \
|
||||
} while (0)
|
||||
#else
|
||||
# define Assert(cond,msg)
|
||||
# define Assert(cond, msg)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
# define Tracecv(c,x)
|
||||
# define Tracec(c, x)
|
||||
# define Tracecv(c, x)
|
||||
#endif
|
||||
|
||||
static void flush_window(void);
|
||||
static void error(char *m);
|
||||
static void puts(const char *);
|
||||
|
||||
extern char *input_data; /* lives in head.S */
|
||||
|
||||
@ -96,10 +114,6 @@ static long bytes_out;
|
||||
static uch *output_data;
|
||||
static unsigned long output_ptr;
|
||||
|
||||
static void error(char *m);
|
||||
|
||||
static void puts(const char *);
|
||||
|
||||
/* the "heap" is put directly after the BSS ends, at end */
|
||||
|
||||
extern int _end;
|
||||
@ -110,8 +124,8 @@ static long free_mem_end_ptr;
|
||||
|
||||
/* decompressor info and error messages to serial console */
|
||||
|
||||
static inline void
|
||||
serout(const char *s, reg_scope_instances regi_ser)
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
static inline void serout(const char *s, reg_scope_instances regi_ser)
|
||||
{
|
||||
reg_ser_rs_stat_din rs;
|
||||
reg_ser_rw_dout dout = {.data = *s};
|
||||
@ -123,23 +137,47 @@ serout(const char *s, reg_scope_instances regi_ser)
|
||||
|
||||
REG_WR(ser, regi_ser, rw_dout, dout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
puts(const char *s)
|
||||
static void puts(const char *s)
|
||||
{
|
||||
#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
|
||||
while (*s) {
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT0
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
serout(s, regi_ser0);
|
||||
#else
|
||||
while (!(*R_SERIAL0_STATUS & (1 << 5)))
|
||||
;
|
||||
*R_SERIAL0_TR_DATA = *s++;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT1
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
serout(s, regi_ser1);
|
||||
#else
|
||||
while (!(*R_SERIAL1_STATUS & (1 << 5)))
|
||||
;
|
||||
*R_SERIAL1_TR_DATA = *s++;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT2
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
serout(s, regi_ser2);
|
||||
#else
|
||||
while (!(*R_SERIAL2_STATUS & (1 << 5)))
|
||||
;
|
||||
*R_SERIAL2_TR_DATA = *s++;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT3
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
serout(s, regi_ser3);
|
||||
#else
|
||||
while (!(*R_SERIAL3_STATUS & (1 << 5)))
|
||||
;
|
||||
*R_SERIAL3_TR_DATA = *s++;
|
||||
#endif
|
||||
#endif
|
||||
*s++;
|
||||
}
|
||||
@ -147,8 +185,7 @@ puts(const char *s)
|
||||
#endif
|
||||
}
|
||||
|
||||
void*
|
||||
memset(void* s, int c, size_t n)
|
||||
void *memset(void *s, int c, size_t n)
|
||||
{
|
||||
int i;
|
||||
char *ss = (char*)s;
|
||||
@ -158,14 +195,13 @@ memset(void* s, int c, size_t n)
|
||||
return s;
|
||||
}
|
||||
|
||||
void*
|
||||
memcpy(void* __dest, __const void* __src,
|
||||
size_t __n)
|
||||
void *memcpy(void *__dest, __const void *__src, size_t __n)
|
||||
{
|
||||
int i;
|
||||
char *d = (char *)__dest, *s = (char *)__src;
|
||||
|
||||
for (i=0;i<__n;i++) d[i] = s[i];
|
||||
for (i = 0; i < __n; i++)
|
||||
d[i] = s[i];
|
||||
|
||||
return __dest;
|
||||
}
|
||||
@ -175,43 +211,42 @@ memcpy(void* __dest, __const void* __src,
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
|
||||
static void
|
||||
flush_window()
|
||||
static void flush_window(void)
|
||||
{
|
||||
ulg c = crc; /* temporary variable */
|
||||
unsigned n;
|
||||
uch *in, *out, ch;
|
||||
ulg c = crc; /* temporary variable */
|
||||
unsigned n;
|
||||
uch *in, *out, ch;
|
||||
|
||||
in = window;
|
||||
out = &output_data[output_ptr];
|
||||
for (n = 0; n < outcnt; n++) {
|
||||
ch = *out++ = *in++;
|
||||
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
|
||||
}
|
||||
crc = c;
|
||||
bytes_out += (ulg)outcnt;
|
||||
output_ptr += (ulg)outcnt;
|
||||
outcnt = 0;
|
||||
in = window;
|
||||
out = &output_data[output_ptr];
|
||||
for (n = 0; n < outcnt; n++) {
|
||||
ch = *out = *in;
|
||||
out++;
|
||||
in++;
|
||||
c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
|
||||
}
|
||||
crc = c;
|
||||
bytes_out += (ulg)outcnt;
|
||||
output_ptr += (ulg)outcnt;
|
||||
outcnt = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
error(char *x)
|
||||
static void error(char *x)
|
||||
{
|
||||
puts("\r\n\n");
|
||||
puts("\n\n");
|
||||
puts(x);
|
||||
puts("\r\n\n -- System halted\n");
|
||||
puts("\n\n -- System halted\n");
|
||||
|
||||
while(1); /* Halt */
|
||||
}
|
||||
|
||||
void
|
||||
setup_normal_output_buffer(void)
|
||||
void setup_normal_output_buffer(void)
|
||||
{
|
||||
output_data = (char *)KERNEL_LOAD_ADR;
|
||||
}
|
||||
|
||||
static inline void
|
||||
serial_setup(reg_scope_instances regi_ser)
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
static inline void serial_setup(reg_scope_instances regi_ser)
|
||||
{
|
||||
reg_ser_rw_xoff xoff;
|
||||
reg_ser_rw_tr_ctrl tr_ctrl;
|
||||
@ -252,12 +287,16 @@ serial_setup(reg_scope_instances regi_ser)
|
||||
REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
|
||||
REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
decompress_kernel(void)
|
||||
void decompress_kernel(void)
|
||||
{
|
||||
char revision;
|
||||
char compile_rev;
|
||||
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
/* Need at least a CRISv32 to run. */
|
||||
compile_rev = 32;
|
||||
#if defined(CONFIG_ETRAX_DEBUG_PORT1) || \
|
||||
defined(CONFIG_ETRAX_DEBUG_PORT2) || \
|
||||
defined(CONFIG_ETRAX_DEBUG_PORT3)
|
||||
@ -277,6 +316,7 @@ decompress_kernel(void)
|
||||
hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT0
|
||||
serial_setup(regi_ser0);
|
||||
#endif
|
||||
@ -300,19 +340,52 @@ decompress_kernel(void)
|
||||
|
||||
/* input_data is set in head.S */
|
||||
inbuf = input_data;
|
||||
#else /* CRISv10 */
|
||||
/* Need at least a crisv10 to run. */
|
||||
compile_rev = 10;
|
||||
|
||||
/* input_data is set in head.S */
|
||||
inbuf = input_data;
|
||||
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT0
|
||||
*R_SERIAL0_XOFF = 0;
|
||||
*R_SERIAL0_BAUD = 0x99;
|
||||
*R_SERIAL0_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT1
|
||||
*R_SERIAL1_XOFF = 0;
|
||||
*R_SERIAL1_BAUD = 0x99;
|
||||
*R_SERIAL1_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT2
|
||||
*R_GEN_CONFIG = 0x08;
|
||||
*R_SERIAL2_XOFF = 0;
|
||||
*R_SERIAL2_BAUD = 0x99;
|
||||
*R_SERIAL2_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#ifdef CONFIG_ETRAX_DEBUG_PORT3
|
||||
*R_GEN_CONFIG = 0x100;
|
||||
*R_SERIAL3_XOFF = 0;
|
||||
*R_SERIAL3_BAUD = 0x99;
|
||||
*R_SERIAL3_TR_CTRL = 0x40;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
setup_normal_output_buffer();
|
||||
|
||||
makecrc();
|
||||
|
||||
__asm__ volatile ("move $vr,%0" : "=rm" (revision));
|
||||
if (revision < 32)
|
||||
{
|
||||
puts("You need an ETRAX FS to run Linux 2.6/crisv32.\r\n");
|
||||
if (revision < compile_rev) {
|
||||
#ifdef CONFIG_ETRAX_ARCH_V32
|
||||
puts("You need an ETRAX FS to run Linux 2.6/crisv32\n");
|
||||
#else
|
||||
puts("You need an ETRAX 100LX to run linux 2.6\n");
|
||||
#endif
|
||||
while(1);
|
||||
}
|
||||
|
||||
puts("Uncompressing Linux...\r\n");
|
||||
puts("Uncompressing Linux...\n");
|
||||
gunzip();
|
||||
puts("Done. Now booting the kernel.\r\n");
|
||||
puts("Done. Now booting the kernel\n");
|
||||
}
|
@ -2,16 +2,26 @@
|
||||
# Makefile for rescue (bootstrap) code
|
||||
#
|
||||
|
||||
ccflags-y += -O2 $(LINUXINCLUDE)
|
||||
# CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
|
||||
# ccflags-$(CONFIG_ETRAX_ARCH_V32) += -I$(srctree)/include/asm/arch/mach/ \
|
||||
# -I$(srctree)/include/asm/arch
|
||||
# asflags-y += -I $(srctree)/include/asm/arch/mach/ -I $(srctree)/include/asm/arch
|
||||
# LD = gcc-cris -mlinux -march=v32 -nostdlib
|
||||
|
||||
asflags-y += $(LINUXINCLUDE)
|
||||
ldflags-y += -T $(srctree)/$(src)/rescue.lds
|
||||
ccflags-y += -O2 $(LINUXINCLUDE)
|
||||
arch-$(CONFIG_ETRAX_ARCH_V10) = v10
|
||||
arch-$(CONFIG_ETRAX_ARCH_V32) = v32
|
||||
|
||||
ldflags-y += -T $(srctree)/$(src)/rescue_$(arch-y).lds
|
||||
OBJCOPYFLAGS = -O binary --remove-section=.bss
|
||||
obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
|
||||
OBJECT := $(obj)/head.o
|
||||
obj-$(CONFIG_ETRAX_ARCH_V32) = $(obj)/head_v32.o
|
||||
obj-$(CONFIG_ETRAX_ARCH_V10) = $(obj)/head_v10.o
|
||||
OBJECTS := $(obj-y)
|
||||
|
||||
targets := rescue.o rescue.bin
|
||||
|
||||
$(obj)/rescue.o: $(OBJECT) FORCE
|
||||
$(obj)/rescue.o: $(OBJECTS) FORCE
|
||||
$(call if_changed,ld)
|
||||
|
||||
$(obj)/rescue.bin: $(obj)/rescue.o FORCE
|
||||
@ -26,6 +36,7 @@ $(obj)/testrescue.bin: $(obj)/testrescue.o
|
||||
dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
|
||||
rm tr.bin tmp2423 testrescue_tmp.bin
|
||||
|
||||
|
||||
$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
|
||||
$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
|
||||
# Pad it to 784 bytes, that's what the rescue loader expects
|
||||
@ -33,3 +44,4 @@ $(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
|
||||
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
|
||||
dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
|
||||
rm ktr.bin tmp2423 kimagerescue_tmp.bin
|
||||
|
@ -155,7 +155,7 @@ no_newjump:
|
||||
#endif
|
||||
|
||||
;; We need to setup the bus registers before we start using the DRAM
|
||||
#include "../../lib/dram_init.S"
|
||||
#include "../../../arch-v10/lib/dram_init.S"
|
||||
|
||||
;; we now should go through the checksum-table and check the listed
|
||||
;; partitions for errors.
|
Loading…
Reference in New Issue
Block a user