diff options
author | Albin Tonnerre <albin.tonnerre@free-electrons.com> | 2010-01-08 17:42:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-01-11 12:34:05 -0500 |
commit | cacb246f8db2b9eba89d44a0f0dd4f6ed93bc113 (patch) | |
tree | 8fff3df983d02c362ba90b334b77a7a93315455e | |
parent | 13510997d600a076e064f10587a8f6d20f8fff41 (diff) |
Add LZO compression support for initramfs and old-style initrd
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Tested-by: Wu Zhangjin <wuzhangjin@gmail.com>
Acked-by: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Russell King <rmk@arm.linux.org.uk>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | lib/Kconfig | 4 | ||||
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/decompress.c | 5 | ||||
-rw-r--r-- | usr/Kconfig | 26 |
4 files changed, 31 insertions, 5 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 1cfe51628e1b..97b136ff117e 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2 | |||
117 | config DECOMPRESS_LZMA | 117 | config DECOMPRESS_LZMA |
118 | tristate | 118 | tristate |
119 | 119 | ||
120 | config DECOMPRESS_LZO | ||
121 | select LZO_DECOMPRESS | ||
122 | tristate | ||
123 | |||
120 | # | 124 | # |
121 | # Generic allocator support is selected if needed | 125 | # Generic allocator support is selected if needed |
122 | # | 126 | # |
diff --git a/lib/Makefile b/lib/Makefile index 347ad8db29d3..911b25aed1e7 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ | |||
69 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o | 69 | lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o |
70 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o | 70 | lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o |
71 | lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o | 71 | lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o |
72 | lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o | ||
72 | 73 | ||
73 | obj-$(CONFIG_TEXTSEARCH) += textsearch.o | 74 | obj-$(CONFIG_TEXTSEARCH) += textsearch.o |
74 | obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o | 75 | obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o |
diff --git a/lib/decompress.c b/lib/decompress.c index d2842f571674..a7606815541f 100644 --- a/lib/decompress.c +++ b/lib/decompress.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/decompress/bunzip2.h> | 9 | #include <linux/decompress/bunzip2.h> |
10 | #include <linux/decompress/unlzma.h> | 10 | #include <linux/decompress/unlzma.h> |
11 | #include <linux/decompress/inflate.h> | 11 | #include <linux/decompress/inflate.h> |
12 | #include <linux/decompress/unlzo.h> | ||
12 | 13 | ||
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <linux/string.h> | 15 | #include <linux/string.h> |
@@ -22,6 +23,9 @@ | |||
22 | #ifndef CONFIG_DECOMPRESS_LZMA | 23 | #ifndef CONFIG_DECOMPRESS_LZMA |
23 | # define unlzma NULL | 24 | # define unlzma NULL |
24 | #endif | 25 | #endif |
26 | #ifndef CONFIG_DECOMPRESS_LZO | ||
27 | # define unlzo NULL | ||
28 | #endif | ||
25 | 29 | ||
26 | static const struct compress_format { | 30 | static const struct compress_format { |
27 | unsigned char magic[2]; | 31 | unsigned char magic[2]; |
@@ -32,6 +36,7 @@ static const struct compress_format { | |||
32 | { {037, 0236}, "gzip", gunzip }, | 36 | { {037, 0236}, "gzip", gunzip }, |
33 | { {0x42, 0x5a}, "bzip2", bunzip2 }, | 37 | { {0x42, 0x5a}, "bzip2", bunzip2 }, |
34 | { {0x5d, 0x00}, "lzma", unlzma }, | 38 | { {0x5d, 0x00}, "lzma", unlzma }, |
39 | { {0x89, 0x4c}, "lzo", unlzo }, | ||
35 | { {0, 0}, NULL, NULL } | 40 | { {0, 0}, NULL, NULL } |
36 | }; | 41 | }; |
37 | 42 | ||
diff --git a/usr/Kconfig b/usr/Kconfig index 1c3039f28909..e2721f5a3504 100644 --- a/usr/Kconfig +++ b/usr/Kconfig | |||
@@ -72,6 +72,15 @@ config RD_LZMA | |||
72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer | 72 | Support loading of a LZMA encoded initial ramdisk or cpio buffer |
73 | If unsure, say N. | 73 | If unsure, say N. |
74 | 74 | ||
75 | config RD_LZO | ||
76 | bool "Support initial ramdisks compressed using LZO" if EMBEDDED | ||
77 | default !EMBEDDED | ||
78 | depends on BLK_DEV_INITRD | ||
79 | select DECOMPRESS_LZO | ||
80 | help | ||
81 | Support loading of a LZO encoded initial ramdisk or cpio buffer | ||
82 | If unsure, say N. | ||
83 | |||
75 | choice | 84 | choice |
76 | prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" | 85 | prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" |
77 | help | 86 | help |
@@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP | |||
108 | bool "Gzip" | 117 | bool "Gzip" |
109 | depends on RD_GZIP | 118 | depends on RD_GZIP |
110 | help | 119 | help |
111 | The old and tried gzip compression. Its compression ratio is | 120 | The old and tried gzip compression. It provides a good balance |
112 | the poorest among the 3 choices; however its speed (both | 121 | between compression ratio and decompression speed. |
113 | compression and decompression) is the fastest. | ||
114 | 122 | ||
115 | config INITRAMFS_COMPRESSION_BZIP2 | 123 | config INITRAMFS_COMPRESSION_BZIP2 |
116 | bool "Bzip2" | 124 | bool "Bzip2" |
117 | depends on RD_BZIP2 | 125 | depends on RD_BZIP2 |
118 | help | 126 | help |
119 | Its compression ratio and speed is intermediate. | 127 | Its compression ratio and speed is intermediate. |
120 | Decompression speed is slowest among the three. The initramfs | 128 | Decompression speed is slowest among the four. The initramfs |
121 | size is about 10% smaller with bzip2, in comparison to gzip. | 129 | size is about 10% smaller with bzip2, in comparison to gzip. |
122 | Bzip2 uses a large amount of memory. For modern kernels you | 130 | Bzip2 uses a large amount of memory. For modern kernels you |
123 | will need at least 8MB RAM or more for booting. | 131 | will need at least 8MB RAM or more for booting. |
@@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA | |||
128 | help | 136 | help |
129 | The most recent compression algorithm. | 137 | The most recent compression algorithm. |
130 | Its ratio is best, decompression speed is between the other | 138 | Its ratio is best, decompression speed is between the other |
131 | two. Compression is slowest. The initramfs size is about 33% | 139 | three. Compression is slowest. The initramfs size is about 33% |
132 | smaller with LZMA in comparison to gzip. | 140 | smaller with LZMA in comparison to gzip. |
133 | 141 | ||
142 | config INITRAMFS_COMPRESSION_LZO | ||
143 | bool "LZO" | ||
144 | depends on RD_LZO | ||
145 | help | ||
146 | Its compression ratio is the poorest among the four. The kernel | ||
147 | size is about about 10% bigger than gzip; however its speed | ||
148 | (both compression and decompression) is the fastest. | ||
149 | |||
134 | endchoice | 150 | endchoice |