1 // SPDX-License-Identifier: GPL-2.0
3 * arch/m32r/boot/compressed/misc.c
5 * This is a collection of several routines from gzip-1.0.3
8 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * Adapted for SH by Stuart Menefy, Aug 1999
12 * 2003-02-12: Support M32R by Takeo Takahashi
22 #define memzero(s, n) memset ((s), 0, (n))
24 static void error(char *m
);
28 static unsigned long free_mem_ptr
;
29 static unsigned long free_mem_end_ptr
;
31 #ifdef CONFIG_KERNEL_BZIP2
32 void *memset(void *s
, int c
, size_t n
)
42 #ifdef CONFIG_KERNEL_GZIP
43 void *memcpy(void *dest
, const void *src
, size_t n
)
53 #define BOOT_HEAP_SIZE 0x10000
54 #include "../../../../lib/decompress_inflate.c"
57 #ifdef CONFIG_KERNEL_BZIP2
58 #define BOOT_HEAP_SIZE 0x400000
59 #include "../../../../lib/decompress_bunzip2.c"
62 #ifdef CONFIG_KERNEL_LZMA
63 #define BOOT_HEAP_SIZE 0x10000
64 #include "../../../../lib/decompress_unlzma.c"
67 static void error(char *x
)
71 puts("\n\n -- System halted");
77 decompress_kernel(int mmu_on
, unsigned char *zimage_data
,
78 unsigned int zimage_len
, unsigned long heap
)
80 unsigned char *input_data
= zimage_data
;
81 int input_len
= zimage_len
;
82 unsigned char *output_data
;
84 output_data
= (unsigned char *)CONFIG_MEMORY_START
+ 0x2000
85 + (mmu_on
? 0x80000000 : 0);
87 free_mem_end_ptr
= free_mem_ptr
+ BOOT_HEAP_SIZE
;
89 puts("\nDecompressing Linux... ");
90 __decompress(input_data
, input_len
, NULL
, NULL
, output_data
, 0,
92 puts("done.\nBooting the kernel.\n");