90a1e87603d204a0979f7d6811d4d08f80c7f682
[openwrt/openwrt.git] / target / linux / mx2 / patches-2.6.34 / 030-lzma.patch
1 This patch allows using a kernel image compressed with LZMA on ARM.
2 Extracting the image is fairly slow, but it might be useful on machines
3 with a very limited amount of storage, as the size benefit is quite
4 significant:
5 Gzip: Data Size: 1586352 Bytes = 1549.17 kB = 1.51 MB
6 LZMA: Data Size: 2135916 Bytes = 2085.86 kB = 2.04 MB
7
8 Signed-off-by: Albin Tonnerre <albin.tonnerre <at> free-electrons.com>
9 Tested-by: Martin Michlmayr <tbm <at> cyrius.com>
10 ---
11 v2: Updated to apply on top of 2.6.34-rc1
12
13 arch/arm/Kconfig | 1 +
14 arch/arm/boot/compressed/Makefile | 1 +
15 arch/arm/boot/compressed/decompress.c | 4 ++++
16 arch/arm/boot/compressed/piggy.lzma.S | 6 ++++++
17 4 files changed, 12 insertions(+), 0 deletions(-)
18 create mode 100644 arch/arm/boot/compressed/piggy.lzma.S
19
20 --- a/arch/arm/Kconfig
21 +++ b/arch/arm/Kconfig
22 @@ -21,6 +21,7 @@ config ARM
23 select HAVE_GENERIC_DMA_COHERENT
24 select HAVE_KERNEL_GZIP
25 select HAVE_KERNEL_LZO
26 + select HAVE_KERNEL_LZMA
27 select HAVE_PERF_EVENTS
28 select PERF_USE_VMALLOC
29 help
30 --- a/arch/arm/boot/compressed/Makefile
31 +++ b/arch/arm/boot/compressed/Makefile
32 @@ -65,6 +65,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/
33
34 suffix_$(CONFIG_KERNEL_GZIP) = gzip
35 suffix_$(CONFIG_KERNEL_LZO) = lzo
36 +suffix_$(CONFIG_KERNEL_LZMA) = lzma
37
38 targets := vmlinux vmlinux.lds \
39 piggy.$(suffix_y) piggy.$(suffix_y).o \
40 --- a/arch/arm/boot/compressed/decompress.c
41 +++ b/arch/arm/boot/compressed/decompress.c
42 @@ -40,6 +40,10 @@ extern void error(char *);
43 #include "../../../../lib/decompress_unlzo.c"
44 #endif
45
46 +#ifdef CONFIG_KERNEL_LZMA
47 +#include "../../../../lib/decompress_unlzma.c"
48 +#endif
49 +
50 void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
51 {
52 decompress(input, len, NULL, NULL, output, NULL, error);
53 --- /dev/null
54 +++ b/arch/arm/boot/compressed/piggy.lzma.S
55 @@ -0,0 +1,6 @@
56 + .section .piggydata,#alloc
57 + .globl input_data
58 +input_data:
59 + .incbin "arch/arm/boot/compressed/piggy.lzma"
60 + .globl input_data_end
61 +input_data_end: