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 @@ suffix_$(CONFIG_KERNEL_LZO) = lzo
11 suffix_$(CONFIG_KERNEL_LZMA) = lzma
12 suffix_$(CONFIG_KERNEL_XZ) = xzkern
13 suffix_$(CONFIG_KERNEL_LZ4) = lz4
14 +suffix_$(CONFIG_KERNEL_CAT) = cat
16 # Borrowed libfdt files for the ATAG compatibility mode
18 @@ -95,7 +96,7 @@ targets := vmlinux vmlinux.lds \
19 bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
21 # Make sure files are removed during clean
22 -extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
23 +extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 piggy.cat \
24 lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \
27 --- a/arch/arm/boot/compressed/decompress.c
28 +++ b/arch/arm/boot/compressed/decompress.c
29 @@ -55,6 +55,10 @@ extern char * strstr(const char * s1, co
30 #include "../../../../lib/decompress_unlz4.c"
33 +#ifdef CONFIG_KERNEL_CAT
34 +#include "../../../../lib/decompress_uncat.c"
37 int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
39 return __decompress(input, len, NULL, NULL, output, 0, NULL, error);
41 +++ b/arch/arm/boot/compressed/piggy.cat.S
43 + .section .piggydata,#alloc
46 + .incbin "arch/arm/boot/compressed/piggy.cat"
47 + .globl input_data_end
51 @@ -115,6 +115,9 @@ config HAVE_KERNEL_LZO
52 config HAVE_KERNEL_LZ4
55 +config HAVE_KERNEL_CAT
59 prompt "Kernel compression mode"
61 @@ -181,9 +184,10 @@ config KERNEL_LZO
63 depends on HAVE_KERNEL_LZO
65 - Its compression ratio is the poorest among the choices. The kernel
66 - size is about 10% bigger than gzip; however its speed
67 - (both compression and decompression) is the fastest.
68 + Its compression ratio is the poorest among the choices (apart from
69 + uncompressed below). The kernel size is about 10% bigger than gzip;
70 + however its speed (both compression and decompression) is the
75 @@ -197,6 +201,12 @@ config KERNEL_LZ4
76 is about 8% bigger than LZO. But the decompression speed is
81 + depends on HAVE_KERNEL_CAT
83 + Don't use compression at all.
87 config DEFAULT_HOSTNAME
89 +++ b/lib/decompress_uncat.c
91 +#include <linux/types.h>
92 +#include <linux/compiler.h>
96 +STATIC int __decompress(unsigned char *buf, long in_len,
97 + long (*fill)(void*, unsigned long),
98 + long (*flush)(void*, unsigned long),
99 + unsigned char *output, long out_len,
101 + void (*error)(char *x))
103 + memmove(output, buf, in_len);
108 --- a/scripts/Makefile.lib
109 +++ b/scripts/Makefile.lib
110 @@ -337,6 +337,13 @@ cmd_lz4 = (cat $(filter-out FORCE,$^) |
111 lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
115 +# ---------------------------------------------------------------------------
116 +quiet_cmd_cat = CAT $@
117 +cmd_cat = (cat $(filter-out FORCE,$^) \
118 + && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
122 # ---------------------------------------------------------------------------
124 --- a/arch/arm/Kconfig
125 +++ b/arch/arm/Kconfig
126 @@ -59,6 +59,7 @@ config ARM
127 select HAVE_KERNEL_LZMA
128 select HAVE_KERNEL_LZO
129 select HAVE_KERNEL_XZ
130 + select HAVE_KERNEL_CAT
131 select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
132 select HAVE_KRETPROBES if (HAVE_KPROBES)