1 ARM: implement "uncompressed zImage"
3 Based on RFC patch by Uwe Kleine-König
4 http://www.spinics.net/lists/arm-kernel/msg230153.html
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 --- a/arch/arm/boot/compressed/Makefile
9 +++ b/arch/arm/boot/compressed/Makefile
10 @@ -71,6 +71,7 @@ compress-$(CONFIG_KERNEL_LZO) = lzo
11 compress-$(CONFIG_KERNEL_LZMA) = lzma
12 compress-$(CONFIG_KERNEL_XZ) = xzkern
13 compress-$(CONFIG_KERNEL_LZ4) = lz4
14 +compress-$(CONFIG_KERNEL_CAT) = cat
16 # Borrowed libfdt files for the ATAG compatibility mode
18 --- a/arch/arm/boot/compressed/decompress.c
19 +++ b/arch/arm/boot/compressed/decompress.c
20 @@ -55,6 +55,10 @@ extern char * strstr(const char * s1, co
21 #include "../../../../lib/decompress_unlz4.c"
24 +#ifdef CONFIG_KERNEL_CAT
25 +#include "../../../../lib/decompress_uncat.c"
28 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
30 return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
32 +++ b/arch/arm/boot/compressed/piggy.cat.S
34 + .section .piggydata,#alloc
37 + .incbin "arch/arm/boot/compressed/piggy.cat"
38 + .globl input_data_end
42 @@ -127,6 +127,9 @@ config HAVE_KERNEL_LZO
43 config HAVE_KERNEL_LZ4
46 +config HAVE_KERNEL_CAT
50 prompt "Kernel compression mode"
52 @@ -193,9 +196,10 @@ config KERNEL_LZO
54 depends on HAVE_KERNEL_LZO
56 - Its compression ratio is the poorest among the choices. The kernel
57 - size is about 10% bigger than gzip; however its speed
58 - (both compression and decompression) is the fastest.
59 + Its compression ratio is the poorest among the choices (apart from
60 + uncompressed below). The kernel size is about 10% bigger than gzip;
61 + however its speed (both compression and decompression) is the
66 @@ -209,6 +213,12 @@ config KERNEL_LZ4
67 is about 8% bigger than LZO. But the decompression speed is
72 + depends on HAVE_KERNEL_CAT
74 + Don't use compression at all.
78 config DEFAULT_HOSTNAME
80 +++ b/lib/decompress_uncat.c
82 +#include <linux/types.h>
83 +#include <linux/compiler.h>
87 +STATIC int __decompress(unsigned char *buf, long in_len,
88 + long (*fill)(void*, unsigned long),
89 + long (*flush)(void*, unsigned long),
90 + unsigned char *output, long out_len,
92 + void (*error)(char *x))
94 + memmove(output, buf, in_len);
99 --- a/scripts/Makefile.lib
100 +++ b/scripts/Makefile.lib
101 @@ -357,6 +357,13 @@ cmd_lz4 = (cat $(filter-out FORCE,$^) |
102 lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
106 +# ---------------------------------------------------------------------------
107 +quiet_cmd_cat = CAT $@
108 +cmd_cat = (cat $(filter-out FORCE,$^) \
109 + && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
113 # ---------------------------------------------------------------------------
115 --- a/arch/arm/Kconfig
116 +++ b/arch/arm/Kconfig
117 @@ -65,6 +65,7 @@ config ARM
118 select HAVE_KERNEL_LZMA
119 select HAVE_KERNEL_LZO
120 select HAVE_KERNEL_XZ
121 + select HAVE_KERNEL_CAT
122 select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
123 select HAVE_KRETPROBES if (HAVE_KPROBES)