diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-06-14 12:00:32 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-06-15 14:36:47 +0200 |
commit | e6d3899ddc5289eb238d0ca3d16ece13a67f36d9 (patch) | |
tree | 2bfdd552fcff90209ac379e767c8b11b66dcc0f5 | |
parent | af1791964d86c2e9388ffedeb55712483ce85ea6 (diff) | |
download | upstream-e6d3899ddc5289eb238d0ca3d16ece13a67f36d9.tar.gz upstream-e6d3899ddc5289eb238d0ca3d16ece13a67f36d9.tar.bz2 upstream-e6d3899ddc5289eb238d0ca3d16ece13a67f36d9.zip |
kernel: add support for uncompressed zImage on ARM
This can be used to prevent double compression for platforms where the
boot loader already expects compressed images.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 files changed, 137 insertions, 2 deletions
diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4 index cbc005e003..1199cb5feb 100644 --- a/target/linux/generic/config-4.4 +++ b/target/linux/generic/config-4.4 @@ -1242,6 +1242,7 @@ CONFIG_GENERIC_NET_UTILS=y # CONFIG_HAVE_AOUT is not set # CONFIG_HAVE_ARM_ARCH_TIMER is not set CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_CAT=y CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZ4=y CONFIG_HAVE_KERNEL_LZMA=y @@ -1801,6 +1802,7 @@ CONFIG_JOLIET=y # CONFIG_KALLSYMS_UNCOMPRESSED is not set # CONFIG_KARMA_PARTITION is not set # CONFIG_KERNEL_BZIP2 is not set +# CONFIG_KERNEL_CAT is not set # CONFIG_KERNEL_GZIP is not set # CONFIG_KERNEL_LZ4 is not set # CONFIG_KERNEL_LZMA is not set diff --git a/target/linux/generic/patches-4.4/222-arm_zimage_none.patch b/target/linux/generic/patches-4.4/222-arm_zimage_none.patch new file mode 100644 index 0000000000..47fa6c928d --- /dev/null +++ b/target/linux/generic/patches-4.4/222-arm_zimage_none.patch @@ -0,0 +1,133 @@ +ARM: implement "uncompressed zImage" + +Based on RFC patch by Uwe Kleine-König +http://www.spinics.net/lists/arm-kernel/msg230153.html + +Signed-off-by: Felix Fietkau <nbd@nbd.name> +--- +--- a/arch/arm/boot/compressed/Makefile ++++ b/arch/arm/boot/compressed/Makefile +@@ -71,6 +71,7 @@ suffix_$(CONFIG_KERNEL_LZO) = lzo + suffix_$(CONFIG_KERNEL_LZMA) = lzma + suffix_$(CONFIG_KERNEL_XZ) = xzkern + suffix_$(CONFIG_KERNEL_LZ4) = lz4 ++suffix_$(CONFIG_KERNEL_CAT) = cat + + # Borrowed libfdt files for the ATAG compatibility mode + +@@ -95,7 +96,7 @@ targets := vmlinux vmlinux.lds \ + bswapsdi2.S font.o font.c head.o misc.o $(OBJS) + + # Make sure files are removed during clean +-extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \ ++extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 piggy.cat \ + lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \ + hyp-stub.S + +--- a/arch/arm/boot/compressed/decompress.c ++++ b/arch/arm/boot/compressed/decompress.c +@@ -55,6 +55,10 @@ extern char * strstr(const char * s1, co + #include "../../../../lib/decompress_unlz4.c" + #endif + ++#ifdef CONFIG_KERNEL_CAT ++#include "../../../../lib/decompress_uncat.c" ++#endif ++ + int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) + { + return __decompress(input, len, NULL, NULL, output, 0, NULL, error); +--- /dev/null ++++ b/arch/arm/boot/compressed/piggy.cat.S +@@ -0,0 +1,6 @@ ++ .section .piggydata,#alloc ++ .globl input_data ++input_data: ++ .incbin "arch/arm/boot/compressed/piggy.cat" ++ .globl input_data_end ++input_data_end: +--- a/init/Kconfig ++++ b/init/Kconfig +@@ -115,6 +115,9 @@ config HAVE_KERNEL_LZO + config HAVE_KERNEL_LZ4 + bool + ++config HAVE_KERNEL_CAT ++ bool ++ + choice + prompt "Kernel compression mode" + default KERNEL_GZIP +@@ -181,9 +184,10 @@ config KERNEL_LZO + bool "LZO" + depends on HAVE_KERNEL_LZO + help +- Its compression ratio is the poorest among the choices. The kernel +- size is about 10% bigger than gzip; however its speed +- (both compression and decompression) is the fastest. ++ Its compression ratio is the poorest among the choices (apart from ++ uncompressed below). The kernel size is about 10% bigger than gzip; ++ however its speed (both compression and decompression) is the ++ fastest. + + config KERNEL_LZ4 + bool "LZ4" +@@ -197,6 +201,12 @@ config KERNEL_LZ4 + is about 8% bigger than LZO. But the decompression speed is + faster than LZO. + ++config KERNEL_CAT ++ bool "uncompressed" ++ depends on HAVE_KERNEL_CAT ++ help ++ Don't use compression at all. ++ + endchoice + + config DEFAULT_HOSTNAME +--- /dev/null ++++ b/lib/decompress_uncat.c +@@ -0,0 +1,17 @@ ++#include <linux/types.h> ++#include <linux/compiler.h> ++ ++#ifdef STATIC ++ ++STATIC int __decompress(unsigned char *buf, long in_len, ++ long (*fill)(void*, unsigned long), ++ long (*flush)(void*, unsigned long), ++ unsigned char *output, long out_len, ++ long *posp, ++ void (*error)(char *x)) ++{ ++ memmove(output, buf, in_len); ++ return 0; ++} ++ ++#endif +--- a/scripts/Makefile.lib ++++ b/scripts/Makefile.lib +@@ -337,6 +337,13 @@ cmd_lz4 = (cat $(filter-out FORCE,$^) | + lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ + (rm -f $@ ; false) + ++# uncompressed ++# --------------------------------------------------------------------------- ++quiet_cmd_cat = CAT $@ ++cmd_cat = (cat $(filter-out FORCE,$^) \ ++ && $(call size_append, $(filter-out FORCE,$^))) > $@ || \ ++ (rm -f $@ ; false) ++ + # U-Boot mkimage + # --------------------------------------------------------------------------- + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -59,6 +59,7 @@ config ARM + select HAVE_KERNEL_LZMA + select HAVE_KERNEL_LZO + select HAVE_KERNEL_XZ ++ select HAVE_KERNEL_CAT + select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M + select HAVE_KRETPROBES if (HAVE_KPROBES) + select HAVE_MEMBLOCK diff --git a/target/linux/generic/patches-4.4/930-crashlog.patch b/target/linux/generic/patches-4.4/930-crashlog.patch index 27a7f6ab35..936366e259 100644 --- a/target/linux/generic/patches-4.4/930-crashlog.patch +++ b/target/linux/generic/patches-4.4/930-crashlog.patch @@ -20,7 +20,7 @@ +#endif --- a/init/Kconfig +++ b/init/Kconfig -@@ -1286,6 +1286,10 @@ config RELAY +@@ -1296,6 +1296,10 @@ config RELAY If unsure, say N. diff --git a/target/linux/generic/patches-4.4/995-mangle_bootargs.patch b/target/linux/generic/patches-4.4/995-mangle_bootargs.patch index eb525618aa..2483e1bb98 100644 --- a/target/linux/generic/patches-4.4/995-mangle_bootargs.patch +++ b/target/linux/generic/patches-4.4/995-mangle_bootargs.patch @@ -40,7 +40,7 @@ setup_per_cpu_areas(); --- a/init/Kconfig +++ b/init/Kconfig -@@ -1638,6 +1638,15 @@ config EMBEDDED +@@ -1648,6 +1648,15 @@ config EMBEDDED an embedded system so certain expert options are available for configuration. |