Root/target/linux/generic/patches-2.6.31/053-lzo_compression_for_initramfs.patch

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

Archive Download this file



interactive