2 * arch/m32r/boot/compressed/misc.c
4 * This is a collection of several routines from gzip-1.0.3
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
9 * Adapted for SH by Stuart Menefy, Aug 1999
11 * 2003-02-12: Support M32R by Takeo Takahashi
21 #define memzero(s, n) memset ((s), 0, (n))
23 static void error(char *m);
27 static unsigned long free_mem_ptr;
28 static unsigned long free_mem_end_ptr;
30 #ifdef CONFIG_KERNEL_BZIP2
31 void *memset(void *s, int c, size_t n)
41 #ifdef CONFIG_KERNEL_GZIP
42 void *memcpy(void *dest, const void *src, size_t n)
52 #define BOOT_HEAP_SIZE 0x10000
53 #include "../../../../lib/decompress_inflate.c"
56 #ifdef CONFIG_KERNEL_BZIP2
57 #define BOOT_HEAP_SIZE 0x400000
58 #include "../../../../lib/decompress_bunzip2.c"
61 #ifdef CONFIG_KERNEL_LZMA
62 #define BOOT_HEAP_SIZE 0x10000
63 #include "../../../../lib/decompress_unlzma.c"
66 static void error(char *x)
70 puts("\n\n -- System halted");
76 decompress_kernel(int mmu_on, unsigned char *zimage_data,
77 unsigned int zimage_len, unsigned long heap)
79 unsigned char *input_data = zimage_data;
80 int input_len = zimage_len;
81 unsigned char *output_data;
83 output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000
84 + (mmu_on ? 0x80000000 : 0);
86 free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE;
88 puts("\nDecompressing Linux... ");
89 __decompress(input_data, input_len, NULL, NULL, output_data, 0,
91 puts("done.\nBooting the kernel.\n");