9ccabf6a799f0a6e044c2ec0d97f308eb26766e9
[librecmc/librecmc.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 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
21 index 3b18128..3ebc7c3 100644
22 --- a/arch/arm/Kconfig
23 +++ b/arch/arm/Kconfig
24 @@ -21,6 +21,7 @@ config ARM
25         select HAVE_GENERIC_DMA_COHERENT
26         select HAVE_KERNEL_GZIP
27         select HAVE_KERNEL_LZO
28 +       select HAVE_KERNEL_LZMA
29         select HAVE_PERF_EVENTS
30         select PERF_USE_VMALLOC
31         help
32 diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
33 index 97c89e7..53faa90 100644
34 --- a/arch/arm/boot/compressed/Makefile
35 +++ b/arch/arm/boot/compressed/Makefile
36 @@ -65,6 +65,7 @@ SEDFLAGS      = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
37
38  suffix_$(CONFIG_KERNEL_GZIP) = gzip
39  suffix_$(CONFIG_KERNEL_LZO)  = lzo
40 +suffix_$(CONFIG_KERNEL_LZMA) = lzma
41
42  targets       := vmlinux vmlinux.lds \
43                  piggy.$(suffix_y) piggy.$(suffix_y).o \
44 diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
45 index 0da382f..d554df6 100644
46 --- a/arch/arm/boot/compressed/decompress.c
47 +++ b/arch/arm/boot/compressed/decompress.c
48 @@ -39,6 +39,10 @@ extern void error(char *);
49  #include "../../../../lib/decompress_unlzo.c"
50  #endif
51
52 +#ifdef CONFIG_KERNEL_LZMA
53 +#include "../../../../lib/decompress_unlzma.c"
54 +#endif
55 +
56  void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
57  {
58         decompress(input, len, NULL, NULL, output, NULL, error);
59 diff --git a/arch/arm/boot/compressed/piggy.lzma.S b/arch/arm/boot/compressed/piggy.lzma.S
60 new file mode 100644
61 index 0000000..d7e69cf
62 --- /dev/null
63 +++ b/arch/arm/boot/compressed/piggy.lzma.S
64 @@ -0,0 +1,6 @@
65 +       .section .piggydata,#alloc
66 +       .globl  input_data
67 +input_data:
68 +       .incbin "arch/arm/boot/compressed/piggy.lzma"
69 +       .globl  input_data_end
70 +input_data_end:
71 -- 
72 1.7.0
73