2 * linux/arch/unicore32/boot/compressed/misc.c
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <asm/unaligned.h>
14 #include <mach/uncompress.h>
19 unsigned char *output_data
;
20 unsigned long output_ptr
;
22 unsigned int free_mem_ptr
;
23 unsigned int free_mem_end_ptr
;
26 #define STATIC_RW_DATA /* non-static please */
29 * arch-dependent implementations
31 #ifndef ARCH_HAVE_DECOMP_ERROR
32 #define arch_decomp_error(x)
35 #ifndef ARCH_HAVE_DECOMP_SETUP
36 #define arch_decomp_setup()
39 #ifndef ARCH_HAVE_DECOMP_PUTS
40 #define arch_decomp_puts(p)
43 void *memcpy(void *dest
, const void *src
, size_t n
)
46 unsigned char *d
= (unsigned char *)dest
, *s
= (unsigned char *)src
;
48 for (i
= n
>> 3; i
> 0; i
--) {
79 arch_decomp_puts("\n\n");
81 arch_decomp_puts("\n\n -- System halted");
89 /* Heap size should be adjusted for different decompress method */
90 #ifdef CONFIG_KERNEL_GZIP
91 #include "../../../../lib/decompress_inflate.c"
94 #ifdef CONFIG_KERNEL_BZIP2
95 #include "../../../../lib/decompress_bunzip2.c"
98 #ifdef CONFIG_KERNEL_LZO
99 #include "../../../../lib/decompress_unlzo.c"
102 #ifdef CONFIG_KERNEL_LZMA
103 #include "../../../../lib/decompress_unlzma.c"
106 unsigned long decompress_kernel(unsigned long output_start
,
107 unsigned long free_mem_ptr_p
,
108 unsigned long free_mem_ptr_end_p
)
112 output_data
= (unsigned char *)output_start
;
113 free_mem_ptr
= free_mem_ptr_p
;
114 free_mem_end_ptr
= free_mem_ptr_end_p
;
118 tmp
= (unsigned char *) (((unsigned long)input_data_end
) - 4);
119 output_ptr
= get_unaligned_le32(tmp
);
121 arch_decomp_puts("Uncompressing Linux...");
122 __decompress(input_data
, input_data_end
- input_data
, NULL
, NULL
,
123 output_data
, 0, NULL
, error
);
124 arch_decomp_puts(" done, booting the kernel.\n");