Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbZIERT1 (ORCPT ); Sat, 5 Sep 2009 13:19:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752768AbZIERTY (ORCPT ); Sat, 5 Sep 2009 13:19:24 -0400 Received: from mail.free-electrons.com ([88.191.76.200]:49261 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752754AbZIERTJ (ORCPT ); Sat, 5 Sep 2009 13:19:09 -0400 From: Albin Tonnerre To: akpm@linux-foundation.org Cc: hpa@zytor.com, mingo@elte.hu, phillip@lougher.demon.co.uk, rmk@arm.linux.org.uk, sam@ravnborg.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, Albin Tonnerre Subject: [PATCH v2 5/5] Add LZO compression support for initramfs and old-style initrd Date: Sat, 5 Sep 2009 19:19:06 +0200 Message-Id: <1252171146-13805-6-git-send-email-albin.tonnerre@free-electrons.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1252171146-13805-5-git-send-email-albin.tonnerre@free-electrons.com> References: <1252171146-13805-1-git-send-email-albin.tonnerre@free-electrons.com> <1252171146-13805-2-git-send-email-albin.tonnerre@free-electrons.com> <1252171146-13805-3-git-send-email-albin.tonnerre@free-electrons.com> <1252171146-13805-4-git-send-email-albin.tonnerre@free-electrons.com> <1252171146-13805-5-git-send-email-albin.tonnerre@free-electrons.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4120 Lines: 131 Signed-off-by: Albin Tonnerre --- lib/Kconfig | 4 ++++ lib/Makefile | 1 + lib/decompress.c | 5 +++++ usr/Kconfig | 26 +++++++++++++++++++++----- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/Kconfig b/lib/Kconfig index bb1326d..8639349 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -117,6 +117,10 @@ config DECOMPRESS_BZIP2 config DECOMPRESS_LZMA tristate +config DECOMPRESS_LZO + select LZO_DECOMPRESS + tristate + # # Generic allocator support is selected if needed # diff --git a/lib/Makefile b/lib/Makefile index 2e78277..cfa4041 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -69,6 +69,7 @@ obj-$(CONFIG_LZO_DECOMPRESS) += lzo/ lib-$(CONFIG_DECOMPRESS_GZIP) += decompress_inflate.o lib-$(CONFIG_DECOMPRESS_BZIP2) += decompress_bunzip2.o lib-$(CONFIG_DECOMPRESS_LZMA) += decompress_unlzma.o +lib-$(CONFIG_DECOMPRESS_LZO) += decompress_unlzo.o obj-$(CONFIG_TEXTSEARCH) += textsearch.o obj-$(CONFIG_TEXTSEARCH_KMP) += ts_kmp.o diff --git a/lib/decompress.c b/lib/decompress.c index d2842f5..a760681 100644 --- a/lib/decompress.c +++ b/lib/decompress.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,9 @@ #ifndef CONFIG_DECOMPRESS_LZMA # define unlzma NULL #endif +#ifndef CONFIG_DECOMPRESS_LZO +# define unlzo NULL +#endif static const struct compress_format { unsigned char magic[2]; @@ -32,6 +36,7 @@ static const struct compress_format { { {037, 0236}, "gzip", gunzip }, { {0x42, 0x5a}, "bzip2", bunzip2 }, { {0x5d, 0x00}, "lzma", unlzma }, + { {0x89, 0x4c}, "lzo", unlzo }, { {0, 0}, NULL, NULL } }; diff --git a/usr/Kconfig b/usr/Kconfig index 1c3039f..bf30c32 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -72,6 +72,15 @@ config RD_LZMA Support loading of a LZMA encoded initial ramdisk or cpio buffer If unsure, say N. +config RD_LZO + bool "Support initial ramdisks compressed using LZO" if EMBEDDED + default !EMBEDDED + depends on BLK_DEV_INITRD + select DECOMPRESS_LZO + help + Support loading of a LZO encoded initial ramdisk or cpio buffer + If unsure, say N. + choice prompt "Built-in initramfs compression mode" if INITRAMFS_SOURCE!="" help @@ -108,16 +117,15 @@ config INITRAMFS_COMPRESSION_GZIP bool "Gzip" depends on RD_GZIP help - The old and tried gzip compression. Its compression ratio is - the poorest among the 3 choices; however its speed (both - compression and decompression) is the fastest. + The old and tried gzip compression. It provides a good balance + between compression ration and decompression speed. config INITRAMFS_COMPRESSION_BZIP2 bool "Bzip2" depends on RD_BZIP2 help Its compression ratio and speed is intermediate. - Decompression speed is slowest among the three. The initramfs + Decompression speed is slowest among the four. The initramfs size is about 10% smaller with bzip2, in comparison to gzip. Bzip2 uses a large amount of memory. For modern kernels you will need at least 8MB RAM or more for booting. @@ -128,7 +136,15 @@ config INITRAMFS_COMPRESSION_LZMA help The most recent compression algorithm. Its ratio is best, decompression speed is between the other - two. Compression is slowest. The initramfs size is about 33% + three. Compression is slowest. The initramfs size is about 33% smaller with LZMA in comparison to gzip. +config INITRAMFS_COMPRESSION_LZO + bool "LZO" + depends on RD_LZO + help + Its compression ratio is the poorest among the four. The kernel + size is about about 10% bigger than gzip; however its speed + (both compression and decompression) is the fastest. + endchoice -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/