From e2db8793ae470e31acaa9715333228692738942c Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Fri, 20 Jul 2012 17:27:22 +0200 Subject: cleo/linux/{arm/boot,lib}: use XZ decompression in build/config, refs #3204 The new XZ method is now available to compress/uncompress the kernel. --- cleopatre/linux-2.6.25.10-spc300/arch/arm/Kconfig | 1 + .../arch/arm/boot/compressed/.gitignore | 1 + .../arch/arm/boot/compressed/Makefile | 1 + .../arch/arm/boot/compressed/decompress.c | 6 ++++++ .../arch/arm/boot/compressed/piggy.xzkern.S | 6 ++++++ cleopatre/linux-2.6.25.10-spc300/init/Kconfig | 20 +++++++++++++++++++- 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/piggy.xzkern.S diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/Kconfig b/cleopatre/linux-2.6.25.10-spc300/arch/arm/Kconfig index 354acaf7e1..44c389e6b2 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/Kconfig +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/Kconfig @@ -14,6 +14,7 @@ config ARM select HAVE_KPROBES if (!XIP_KERNEL) select HAVE_KRETPROBES if (HAVE_KPROBES) select HAVE_KERNEL_GZIP + select HAVE_KERNEL_XZ help The ARM series is a line of low-power-consumption RISC chip designs licensed by ARM Ltd and targeted at embedded applications and diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/.gitignore b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/.gitignore index ac8b28682c..be2d946515 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/.gitignore +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/.gitignore @@ -1,4 +1,5 @@ piggy.gzip +piggy.xzkern font.c lib1funcs.S ashldi3.S diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/Makefile b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/Makefile index a9a9692ab5..b7a121ffd6 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/Makefile +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/Makefile @@ -72,6 +72,7 @@ endif SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ suffix_$(CONFIG_KERNEL_GZIP) = gzip +suffix_$(CONFIG_KERNEL_XZ) = xzkern targets := vmlinux vmlinux.lds \ piggy.$(suffix_y) piggy.$(suffix_y).o \ diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/decompress.c b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/decompress.c index bb3006d07b..b5d8e3ed8b 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/decompress.c +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/decompress.c @@ -36,6 +36,12 @@ extern void error(char *); #include "../../../../lib/decompress_inflate.c" #endif +#ifdef CONFIG_KERNEL_XZ +#define memmove memmove +#define memcpy memcpy +#include "../../../../lib/decompress_unxz.c" +#endif + int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) { return decompress(input, len, NULL, NULL, output, NULL, error); diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/piggy.xzkern.S b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/piggy.xzkern.S new file mode 100644 index 0000000000..5703f300d0 --- /dev/null +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/boot/compressed/piggy.xzkern.S @@ -0,0 +1,6 @@ + .section .piggydata,#alloc + .globl input_data +input_data: + .incbin "arch/arm/boot/compressed/piggy.xzkern" + .globl input_data_end +input_data_end: diff --git a/cleopatre/linux-2.6.25.10-spc300/init/Kconfig b/cleopatre/linux-2.6.25.10-spc300/init/Kconfig index c86ac5ce1a..2f76babde8 100644 --- a/cleopatre/linux-2.6.25.10-spc300/init/Kconfig +++ b/cleopatre/linux-2.6.25.10-spc300/init/Kconfig @@ -104,10 +104,13 @@ config LOCALVERSION_AUTO config HAVE_KERNEL_GZIP bool +config HAVE_KERNEL_XZ + bool + choice prompt "Kernel compression mode" default KERNEL_GZIP - depends on HAVE_KERNEL_GZIP + depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_XZ help The linux kernel is a kind of self-extracting executable. Several compression algorithms are available, which differ @@ -133,6 +136,21 @@ config KERNEL_GZIP The old and tried gzip compression. It provides a good balance between compression ratio and decompression speed. +config KERNEL_XZ + bool "XZ" + depends on HAVE_KERNEL_XZ + help + XZ uses the LZMA2 algorithm and instruction set specific + BCJ filters which can improve compression ratio of executable + code. The size of the kernel is about 30% smaller with XZ in + comparison to gzip. On architectures for which there is a BCJ + filter (i386, x86_64, ARM, IA-64, PowerPC, and SPARC), XZ + will create a few percent smaller kernel than plain LZMA. + + The speed is about the same as with LZMA: The decompression + speed of XZ is better than that of bzip2 but worse than gzip + and LZO. Compression is slow. + endchoice config SWAP -- cgit v1.2.3