[PATCH] Add support of LZO-compressed kernels for MIPS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch need the Compressed kernel support for MIPS and the support
of LZO-compressed kernel, both of them are not available in the official
kernel yet, but you can get them in the following links respectively:

[PATCH -v2] MIPS: add support for gzip/bzip2/lzma compressed kernel image

http://www.linux-mips.org/archives/linux-mips/2009-10/msg00110.html

[PATCH v2.1 2/5] Add support for LZO-compressed kernels
http://marc.info/?l=linux-kernel&m=125525500919174&w=2

The advantage of this algorithm:

Uncompressed size: 3.24Mo
gzip  1.61Mo 0.72s
lzo   1.75Mo 0.48s

and what about the compression ratio?

$ ls -sh vmlinux  (original)
6.0M vmlinux
$ ls -sh vmlinuz (lzma)
1.2M vmlinuz
$ ls -sh vmlinuz (bzip2)
1.5M vmlinuz
$ ls -sh vmlinuz (gzip)
1.6M vmlinuz
$ ls -sh vmlinuz (lzop)
1.7M vmlinuz

the time statisticed for gzip,bzip2,lzma from booting to printing.

	SIZE	AVG. TIME(in 4 times)
gzip   2011314       2.64
bzip2  1831170       4.0625
lzma   1470938       3.2075

so, if you want to get the best compression ratio, you are recommended to use
LZMA, and if you need the fastest one, LZO is recommanded.

and BTW: if you need to use the gzip,bzip2,lzma,lzo support, the
corresponding tools are need to install in your machine to compress the
original kernel, they are gzip,bzip2,lzma and lzop.

(Thanks very much to Alexander Clouter <alex@xxxxxxxxxxxxx> for giving the
information about LZO to me)

Signed-off-by: Wu Zhangjin <wuzhangjin@xxxxxxxxx>
---
 arch/mips/Kconfig                      |    1 +
 arch/mips/boot/compressed/Makefile     |    2 ++
 arch/mips/boot/compressed/decompress.c |    4 ++++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 96bb02d..6bfab06 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1303,6 +1303,7 @@ config SYS_SUPPORTS_ZBOOT
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_BZIP2
 	select HAVE_KERNEL_LZMA
+	select HAVE_KERNEL_LZO
 
 config SYS_SUPPORTS_ZBOOT_UART16550
 	bool
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 140bd9b..d746c00 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -38,9 +38,11 @@ $(obj)/vmlinux.bin: $(KBUILD_IMAGE)
 suffix_$(CONFIG_KERNEL_GZIP)  = gz
 suffix_$(CONFIG_KERNEL_BZIP2) = bz2
 suffix_$(CONFIG_KERNEL_LZMA)  = lzma
+suffix_$(CONFIG_KERNEL_LZO)  = lzo
 tool_$(CONFIG_KERNEL_GZIP)    = gzip
 tool_$(CONFIG_KERNEL_BZIP2)   = bzip2
 tool_$(CONFIG_KERNEL_LZMA)    = lzma
+tool_$(CONFIG_KERNEL_LZO)    = lzo
 $(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin
 	$(call if_changed,$(tool_y))
 	$(Q)rm -f $<
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 67330c2..6a7cbb9 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -79,6 +79,10 @@ void *memset(void *s, int c, size_t n)
 #include "../../../../lib/decompress_unlzma.c"
 #endif
 
+#ifdef CONFIG_KERNEL_LZO
+#include "../../../../lib/decompress_unlzo.c"
+#endif
+
 void decompress_kernel(unsigned long boot_heap_start)
 {
 	int zimage_size;
-- 
1.6.2.1



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux