m32r: make memset() global for CONFIG_KERNEL_BZIP2=y
[deliverable/linux.git] / arch / m32r / boot / compressed / misc.c
CommitLineData
1da177e4
LT
1/*
2 * arch/m32r/boot/compressed/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 *
9 * Adapted for SH by Stuart Menefy, Aug 1999
10 *
11 * 2003-02-12: Support M32R by Takeo Takahashi
1da177e4
LT
12 */
13
1da177e4
LT
14/*
15 * gzip declarations
16 */
1da177e4
LT
17#define STATIC static
18
19#undef memset
20#undef memcpy
21#define memzero(s, n) memset ((s), 0, (n))
22
1da177e4 23static void error(char *m);
1da177e4 24
1da177e4
LT
25#include "m32r_sio.c"
26
1da177e4
LT
27static unsigned long free_mem_ptr;
28static unsigned long free_mem_end_ptr;
29
337214e8 30#ifdef CONFIG_KERNEL_BZIP2
9a75c6e5 31void *memset(void *s, int c, size_t n)
1da177e4 32{
337214e8 33 char *ss = s;
1da177e4 34
337214e8
HT
35 while (n--)
36 *ss++ = c;
1da177e4
LT
37 return s;
38}
337214e8 39#endif
1da177e4 40
337214e8 41#ifdef CONFIG_KERNEL_GZIP
a8abbca6
GU
42void *memcpy(void *dest, const void *src, size_t n)
43{
44 char *d = dest;
45 const char *s = src;
46 while (n--)
47 *d++ = *s++;
48
49 return dest;
50}
51
337214e8
HT
52#define BOOT_HEAP_SIZE 0x10000
53#include "../../../../lib/decompress_inflate.c"
54#endif
1da177e4 55
337214e8
HT
56#ifdef CONFIG_KERNEL_BZIP2
57#define BOOT_HEAP_SIZE 0x400000
58#include "../../../../lib/decompress_bunzip2.c"
59#endif
1da177e4 60
337214e8
HT
61#ifdef CONFIG_KERNEL_LZMA
62#define BOOT_HEAP_SIZE 0x10000
63#include "../../../../lib/decompress_unlzma.c"
64#endif
1da177e4
LT
65
66static void error(char *x)
67{
68 puts("\n\n");
69 puts(x);
70 puts("\n\n -- System halted");
71
72 while(1); /* Halt */
73}
74
1da177e4
LT
75void
76decompress_kernel(int mmu_on, unsigned char *zimage_data,
77 unsigned int zimage_len, unsigned long heap)
78{
337214e8
HT
79 unsigned char *input_data = zimage_data;
80 int input_len = zimage_len;
81 unsigned char *output_data;
82
1da177e4
LT
83 output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000
84 + (mmu_on ? 0x80000000 : 0);
85 free_mem_ptr = heap;
337214e8 86 free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE;
1da177e4 87
337214e8
HT
88 puts("\nDecompressing Linux... ");
89 decompress(input_data, input_len, NULL, NULL, output_data, NULL, error);
90 puts("done.\nBooting the kernel.\n");
1da177e4 91}
This page took 0.718954 seconds and 5 git commands to generate.