From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261994AbVFGVnx (ORCPT ); Tue, 7 Jun 2005 17:43:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261999AbVFGVnx (ORCPT ); Tue, 7 Jun 2005 17:43:53 -0400 Received: from mail4.worldserver.net ([217.13.200.24]:42909 "EHLO mail4.worldserver.net") by vger.kernel.org with ESMTP id S261994AbVFGVl3 (ORCPT ); Tue, 7 Jun 2005 17:41:29 -0400 Date: Tue, 7 Jun 2005 23:41:28 +0200 From: Christian Leber To: linux-kernel@vger.kernel.org Cc: akpm@osdl.org Subject: [PATCH 2/2] lzma support: lzma compressed kernel image Message-ID: <20050607214128.GB2645@core.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Accept-Language: de en X-Location: Europe, Germany, Mannheim X-Operating-System: Debian GNU/Linux (sid) User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org This patch is against 2.6.12-rc6. Makes it possible on i386 to select lzma compression instead of gzip compression, this is especially usefull for embedded systems or when there are special size restrictions, like a kernel on a floppy image. Other architectures aren't affected, obviously. I also want to mention that the misc_lzma.c is much cleaner than the orginal misc.c :-) The memory requirements are only a little big higher than with gzip, namely low_buffer_size or even lower when !high_loaded. Size example: -rw-r--r-- 1 ijuz ijuz 1233099 Jun 7 20:12 bzImage.gz -rw-r--r-- 1 ijuz ijuz 1041267 Jun 7 20:12 bzImage.lzma (download them from here to try them out: http://debian.christian-leber.de/kernel_lzma/) To build a kernel with lzma compression you have to go to: Executable file formats -> Kernel compression format Building the lzma tool cut and paste style: mkdir build-lzma wget http://www.7-zip.org/dl/lzma417.tar.bz2 tar xjf lzma417.tar.bz2 cd SRC/7zip/Compress/LZMA_Alone/ make cp lzma ../../../../../ cd ../../../../../ Signed-off-by: Christian Leber --- linux-2.6.12-rc6.orig/arch/i386/Kconfig 2005-06-06 17:22:29.000000000 +0200 +++ linux-2.6.12-rc6/arch/i386/Kconfig 2005-06-07 21:33:40.000000000 +0200 @@ -1236,6 +1236,34 @@ source "fs/Kconfig.binfmt" +choice + prompt "Kernel compression format" + depends on EXPERIMENTAL + default KERNEL_GZIP + +config KERNEL_GZIP + bool "Compress kernel image using gzip" + help + The linux kernel is a self-extracting executable. + + Choosing Gzip here, makes the kernel image beeing compressed + using Gzip. + + Gzip is the standard compression method for the kernel image. + If you do not know what to say, take gzip. + + +config KERNEL_LZMA + bool "Compress kernel image using lzma (EXPERIMENTAL)" + depends on EXPERIMENTAL + help + The linux kernel is a self-extracting executable. + + Choosing lzma here, makes the kernel beeing compressed using + lzma. + +endchoice + endmenu source "drivers/Kconfig" --- linux-2.6.12-rc6.orig/arch/i386/boot/compressed/misc_lzma.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.12-rc6/arch/i386/boot/compressed/misc_lzma.c 2005-06-07 21:39:17.000000000 +0200 @@ -0,0 +1,296 @@ +/* + * misc.c + * + * This code uses LzmaDecode.c and LzmaDecode.h to decompress the lzma + * compressed Linux kernel + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * puts by Nick Holloway 1993, better puts by Martin Mares 1995 + * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 + * lzma decompression support by Christian Leber, June 2005 + */ + +#include +#include +#include +#include