*
* Adapted for SH by Stuart Menefy, Aug 1999
*
+ * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
+ *
* 2003-02-12: Support M32R by Takeo Takahashi
* This is based on arch/sh/boot/compressed/misc.c.
*/
static uch *inbuf; /* input buffer */
static uch window[WSIZE]; /* Sliding window buffer */
-static unsigned insize = 0; /* valid bytes in inbuf */
-static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
-static unsigned outcnt = 0; /* bytes in output buffer */
+static unsigned insize; /* valid bytes in inbuf */
+static unsigned inptr; /* index of next byte to be processed in inbuf */
+static unsigned outcnt; /* bytes in output buffer */
/* gzip flag byte */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
static void gzip_mark(void **);
static void gzip_release(void **);
-static unsigned char *input_data;
-static int input_len;
+extern char input_data[];
+extern int input_len;
-static long bytes_out = 0;
+static long bytes_out;
static uch *output_data;
-static unsigned long output_ptr = 0;
+static unsigned long output_ptr;
-#include "m32r_sio.c"
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 **);
+
+extern int puts(const char *);
+extern int _text; /* Defined in vmlinux.lds.S */
+extern int _end;
static unsigned long free_mem_ptr;
static unsigned long free_mem_end_ptr;
{
void *p;
- if (size <0) error("Malloc error");
- if (free_mem_ptr == 0) error("Memory error");
+ if (size <0) error("Malloc error\n");
+ if (free_mem_ptr == 0) error("Memory error\n");
free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
free_mem_ptr += size;
if (free_mem_ptr >= free_mem_end_ptr)
- error("Out of memory");
+ error("\nOut of memory\n");
return p;
}
static int fill_inbuf(void)
{
if (insize != 0) {
- error("ran out of input data");
+ error("ran out of input data\n");
}
inbuf = input_data;
while(1); /* Halt */
}
+#define STACK_SIZE (4096)
+long user_stack [STACK_SIZE];
+long* stack_start = &user_stack[STACK_SIZE];
+
/* return decompressed size */
-void
-decompress_kernel(int mmu_on, unsigned char *zimage_data,
- unsigned int zimage_len, unsigned long heap)
+long decompress_kernel(void)
{
- output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000
- + (mmu_on ? 0x80000000 : 0);
- free_mem_ptr = heap;
+ insize = 0;
+ inptr = 0;
+ bytes_out = 0;
+ outcnt = 0;
+ output_data = 0;
+ output_ptr = CONFIG_MEMORY_START + 0x2000;
+ free_mem_ptr = (unsigned long)&_end;
free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
- input_data = zimage_data;
- input_len = zimage_len;
makecrc();
puts("Uncompressing Linux... ");
gunzip();
puts("Ok, booting the kernel.\n");
+ return bytes_out;
}