replace our arm LZMA loader with the one that goes upstream
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.31 / 053-lzo_compression_for_initramfs.patch
1 diff --git a/lib/Kconfig b/lib/Kconfig
2 index bb1326d..8639349 100644
3 --- a/lib/Kconfig
4 +++ b/lib/Kconfig
5 @@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2
6 config DECOMPRESS_LZMA
7 tristate
8
9 +config DECOMPRESS_LZO
10 + select LZO_DECOMPRESS
11 + tristate
12 +
13 #
14 # Generic allocator support is selected if needed
15 #
16 diff --git a/lib/Makefile b/lib/Makefile
17 index 2e78277..cfa4041 100644
18 --- a/lib/Makefile
19 +++ b/lib/Makefile
20 @@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/
21 lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o
22 lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o
23 lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o
24 +lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o
25
26 obj-$(CONFIG_TEXTSEARCH) += textsearch.o
27 obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o
28 diff --git a/lib/decompress.c b/lib/decompress.c
29 index d2842f5..a760681 100644
30 --- a/lib/decompress.c
31 +++ b/lib/decompress.c
32 @@ -9,6 +9,7 @@
33 #include <linux/decompress/bunzip2.h>
34 #include <linux/decompress/unlzma.h>
35 #include <linux/decompress/inflate.h>
36 +#include <linux/decompress/unlzo.h>
37
38 #include <linux/types.h>
39 #include <linux/string.h>
40 @@ -22,6 +23,9 @@
41 #ifndef CONFIG_DECOMPRESS_LZMA
42 # define unlzma NULL
43 #endif
44 +#ifndef CONFIG_DECOMPRESS_LZO
45 +# define unlzo NULL
46 +#endif
47
48 static const struct compress_format {
49 unsigned char magic[2];
50 @@ -32,6 +36,7 @@ static const struct compress_format {
51 { {037, 0236}, "gzip", gunzip },
52 { {0x42, 0x5a}, "bzip2", bunzip2 },
53 { {0x5d, 0x00}, "lzma", unlzma },
54 + { {0x89, 0x4c}, "lzo", unlzo },
55 { {0, 0}, NULL, NULL }
56 };
57
58 diff --git a/usr/Kconfig b/usr/Kconfig
59 index 1c3039f..e2721f5 100644
60 --- a/usr/Kconfig
61 +++ b/usr/Kconfig
62 @@ -72,6 +72,15 @@ config RD_LZMA
63 Support loading of a LZMA encoded initial ramdisk or cpio buffer
64 If unsure, say N.
65
66 +config RD_LZO
67 + bool "Support initial ramdisks compressed using LZO" if EMBEDDED
68 + default !EMBEDDED
69 + depends on BLK_DEV_INITRD
70 + select DECOMPRESS_LZO
71 + help
72 + Support loading of a LZO encoded initial ramdisk or cpio buffer
73 + If unsure, say N.
74 +
75 choice
76 prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!=""
77 help
78 @@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP
79 bool "Gzip"
80 depends on RD_GZIP
81 help
82 - The old and tried gzip compression. Its compression ratio is
83 - the poorest among the 3 choices; however its speed (both
84 - compression and decompression) is the fastest.
85 + The old and tried gzip compression. It provides a good balance
86 + between compression ratio and decompression speed.
87
88 config INITRAMFS_COMPRESSION_BZIP2
89 bool "Bzip2"
90 depends on RD_BZIP2
91 help
92 Its compression ratio and speed is intermediate.
93 - Decompression speed is slowest among the three. The initramfs
94 + Decompression speed is slowest among the four. The initramfs
95 size is about 10% smaller with bzip2, in comparison to gzip.
96 Bzip2 uses a large amount of memory. For modern kernels you
97 will need at least 8MB RAM or more for booting.
98 @@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA
99 help
100 The most recent compression algorithm.
101 Its ratio is best, decompression speed is between the other
102 - two. Compression is slowest. The initramfs size is about 33%
103 + three. Compression is slowest. The initramfs size is about 33%
104 smaller with LZMA in comparison to gzip.
105
106 +config INITRAMFS_COMPRESSION_LZO
107 + bool "LZO"
108 + depends on RD_LZO
109 + help
110 + Its compression ratio is the poorest among the four. The kernel
111 + size is about about 10% bigger than gzip; however its speed
112 + (both compression and decompression) is the fastest.
113 +
114 endchoice