mirror of
https://github.com/vivier/EMILE.git
synced 2024-07-31 23:29:05 +00:00
pass compress image address by argument to uncompress() and remove unneeded size
This commit is contained in:
parent
2a2df578f3
commit
e441c4b560
@ -40,11 +40,11 @@ extern unsigned long _ramdisk_offset;
|
|||||||
extern unsigned long _ramdisk_size;
|
extern unsigned long _ramdisk_size;
|
||||||
extern char _command_line;
|
extern char _command_line;
|
||||||
|
|
||||||
unsigned long kernel_image_start;
|
|
||||||
unsigned long ramdisk_start;
|
unsigned long ramdisk_start;
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
unsigned long kernel_image_start;
|
||||||
#ifdef TARGET_M68K
|
#ifdef TARGET_M68K
|
||||||
char * kernel;
|
char * kernel;
|
||||||
unsigned long physImage;
|
unsigned long physImage;
|
||||||
@ -65,8 +65,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
init_memory_map();
|
init_memory_map();
|
||||||
|
|
||||||
bootinfo_init();
|
|
||||||
|
|
||||||
/* load kernel */
|
/* load kernel */
|
||||||
|
|
||||||
printf("vmlinux %s\n", &_command_line);
|
printf("vmlinux %s\n", &_command_line);
|
||||||
@ -109,6 +107,7 @@ int main(int argc, char** argv)
|
|||||||
* and BI_ALLOC_SIZE for bootinfo
|
* and BI_ALLOC_SIZE for bootinfo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
printf("Allocating %ld bytes for kernel\n", _kernel_size);
|
||||||
kernel = (char*)malloc(_kernel_size + 4 + BI_ALLOC_SIZE);
|
kernel = (char*)malloc(_kernel_size + 4 + BI_ALLOC_SIZE);
|
||||||
if (kernel == 0)
|
if (kernel == 0)
|
||||||
{
|
{
|
||||||
@ -119,14 +118,12 @@ int main(int argc, char** argv)
|
|||||||
/* align kernel address to a 4 byte word */
|
/* align kernel address to a 4 byte word */
|
||||||
|
|
||||||
kernel = (unsigned char*)(((unsigned long)kernel + 3) & 0xFFFFFFFC);
|
kernel = (unsigned char*)(((unsigned long)kernel + 3) & 0xFFFFFFFC);
|
||||||
uncompress(kernel);
|
uncompress(kernel, (char*)kernel_image_start);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
error("Kernel is missing !!!!\n");
|
error("Kernel is missing !!!!\n");
|
||||||
return 1; /* to make gcc happy */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free kernel image */
|
/* free kernel image */
|
||||||
@ -161,6 +158,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
/* set bootinfo at end of kernel image */
|
/* set bootinfo at end of kernel image */
|
||||||
|
|
||||||
|
bootinfo_init();
|
||||||
set_kernel_bootinfo(kernel + _kernel_size);
|
set_kernel_bootinfo(kernel + _kernel_size);
|
||||||
|
|
||||||
/* disable interrupt */
|
/* disable interrupt */
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include "uncompress.h"
|
#include "uncompress.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
unsigned long kernel_image_start;
|
|
||||||
unsigned long kernel_image_size;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gzip declarations
|
* gzip declarations
|
||||||
*/
|
*/
|
||||||
@ -33,11 +29,10 @@ static long bytes_out = 0;
|
|||||||
static uch *inbuf; /* input buffer */
|
static uch *inbuf; /* input buffer */
|
||||||
static uch window[WSIZE]; /* Sliding window buffer */
|
static uch window[WSIZE]; /* Sliding window buffer */
|
||||||
|
|
||||||
static unsigned insize; /* valid bytes in inbuf */
|
|
||||||
static unsigned inptr; /* index of next byte to be processed in inbuf */
|
static unsigned inptr; /* index of next byte to be processed in inbuf */
|
||||||
static unsigned outcnt = 0; /* bytes in output buffer */
|
static unsigned outcnt = 0; /* bytes in output buffer */
|
||||||
|
|
||||||
#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
|
#define get_byte() (inbuf[inptr++])
|
||||||
|
|
||||||
static uch *output_data;
|
static uch *output_data;
|
||||||
static unsigned long output_ptr = 0;
|
static unsigned long output_ptr = 0;
|
||||||
@ -51,14 +46,6 @@ static unsigned long output_ptr = 0;
|
|||||||
|
|
||||||
#define memzero(s, n) memset ((s), 0, (n))
|
#define memzero(s, n) memset ((s), 0, (n))
|
||||||
|
|
||||||
static int fill_inbuf(void)
|
|
||||||
{
|
|
||||||
inbuf = (uch*)kernel_image_start;
|
|
||||||
insize = kernel_image_size;
|
|
||||||
inptr = 1;
|
|
||||||
return inbuf[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gzip_mark(void **ptr)
|
static void gzip_mark(void **ptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -92,9 +79,11 @@ static void flush_window(void)
|
|||||||
console_put('.');
|
console_put('.');
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long uncompress(char* buf)
|
unsigned long uncompress(char* buf, char* image)
|
||||||
{
|
{
|
||||||
output_data = buf;
|
output_data = buf;
|
||||||
|
inbuf = (uch*)image;
|
||||||
|
inptr = 0;
|
||||||
|
|
||||||
makecrc();
|
makecrc();
|
||||||
printf("Uncompressing kernel to %p", buf);
|
printf("Uncompressing kernel to %p", buf);
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern unsigned long uncompress(char* buf);
|
extern unsigned long uncompress(char* buf, char* image);
|
||||||
|
Loading…
Reference in New Issue
Block a user