[Top] [All Lists]

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

Subject: [PATCH] Add support of LZO-compressed kernels for MIPS
From: Wu Zhangjin <>
Date: Tue, 13 Oct 2009 19:50:56 +0800
Cc: Ralf Baechle <>, Alexander Clouter <>,, Wu Zhangjin <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=+0CkdTm6JHO7IppbY4shXf5pbgKqEdvH0ZIyFMWSPH4=; b=icMw1V4+SbHX3kCQTal5Yg4/SKHpXx4BmMWJ2ryDKRDWOjyHLVDNPVlVbHqAvJElpj 4XNB0ZZ4guNwdUwu90Ypg5D9SRri3R5lBGqZklx8OCIc1ohOACAsfYTlNGtlNeZW5N2O dztLiEyiDyr2Jr6JykV5B7TraEtV/E5r+qsGs=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=XPIYvyeiEhEgCbyvHLjtYVmeOheao4eUmwDQyW27keJ2S7tHLvlewrzvSk8YGVaFzS Tcaosm7gGvbaKw0SUflJ9YdS6iGZ/epWoGSqn/Zf3opin1RVPHF2i+EyTOLHg1K4Rt0+ PELjW9edcMAOrDE/HgrRIn80aD3gpa9JAa2Es=
Original-recipient: rfc822;
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

[PATCH v2.1 2/5] Add support for LZO-compressed kernels

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 <> for giving the
information about LZO to me)

Signed-off-by: Wu Zhangjin <>
 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
diff --git a/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 
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"
+#include "../../../../lib/decompress_unlzo.c"
 void decompress_kernel(unsigned long boot_heap_start)
        int zimage_size;

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] Add support of LZO-compressed kernels for MIPS, Wu Zhangjin <=