From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KE3YF-0003mg-PQ for mharc-grub-devel@gnu.org; Wed, 02 Jul 2008 10:43:19 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KE3YD-0003m6-RO for grub-devel@gnu.org; Wed, 02 Jul 2008 10:43:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KE3YD-0003lF-63 for grub-devel@gnu.org; Wed, 02 Jul 2008 10:43:17 -0400 Received: from [199.232.76.173] (port=37131 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KE3YC-0003ku-PX for grub-devel@gnu.org; Wed, 02 Jul 2008 10:43:16 -0400 Received: from aybabtu.com ([69.60.117.155]:48840) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KE3YB-0003Ni-U3 for grub-devel@gnu.org; Wed, 02 Jul 2008 10:43:16 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1KE3UM-0008J1-1j for grub-devel@gnu.org; Wed, 02 Jul 2008 16:39:19 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1KE3XP-0005sH-8e for grub-devel@gnu.org; Wed, 02 Jul 2008 16:42:27 +0200 Date: Wed, 2 Jul 2008 16:42:27 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080702144227.GD21064@thorin> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] LZMA support in i386-pc kernel X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jul 2008 14:43:18 -0000 On Wed, Jul 02, 2008 at 09:39:52PM +0800, Bean wrote: > Hi, > > This patch add support for lzma decompression. The assembly code > lzma_decode.S is manually optimized to reduce size. The result decoder > is tiny, only 416 bytes longer than the lzo version. > > I also include lzma encode from the LZMA SDK. grub needs to use the > ANSI-C version of encoder, which is only present in the latest 4.58 > beta. I can't find ready to use shared library in most distro. > Including the encoder/decoder has advantages as well. We don't need to > worry about the host os, and lzma encoder/decoder can be used in other > place, like font compression. Lenny's most likely going to ship with lzma 4.43. Is that good? > Result of > ./grub-mkimage -o core.img biosdisk pc ext2 lvm raid > > lzma version: 27,776 bytes > lzo version: 32,768 bytes Amazing. I'd really like this to make it in time for lenny; although we're really pressed for time now. > diff --git a/include/grub/lib/LzFind.h b/include/grub/lib/LzFind.h > new file mode 100644 > index 0000000..3d74d0c > --- /dev/null > +++ b/include/grub/lib/LzFind.h > @@ -0,0 +1,116 @@ > +/* LzFind.h -- Match finder for LZ algorithms > +2008-04-04 > +Copyright (c) 1999-2008 Igor Pavlov Have you modified the files from LZMA SDK? Please add our license boilerplate to them if you did (e.g. like in kern/i386/pc/lzo1x.S). > +#define FIXED_PROPS > [...] > +#ifdef FIXED_PROPS What's this option for? Some comment would be nice. > +#if 0 > + > +DbgOut: This is just for debugging, right? Maybe "#ifdef DEBUG" or so would be better, to make it clear. > +#ifndef ASM_FILE > + xorl %eax, %eax > +#endif Why? I thought ASM_FILE always ought to be defined for asm files in GRUB. > diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S > index 9542978..964643a 100644 > --- a/kern/i386/pc/startup.S > +++ b/kern/i386/pc/startup.S > @@ -200,6 +200,7 @@ codestart: > incl %eax > call EXT_C(grub_gate_a20) > > +#if defined(ENABLE_LZO) > /* decompress the compressed part and put the result at 1MB */ > movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %esi > movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi > @@ -213,6 +214,23 @@ codestart: > /* copy back the decompressed part */ > movl %eax, %ecx > cld > +#else > + movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi > + movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %esi > + pushl %edi > + pushl %esi > + movl EXT_C(grub_kernel_image_size), %ecx > + addl EXT_C(grub_total_module_size), %ecx > + addl EXT_C(grub_memdisk_image_size), %ecx > + subl $GRUB_KERNEL_MACHINE_RAW_SIZE, %ecx > + pushl %ecx > + leal (%edi, %ecx), %ebx > + call _LzmaDecodeA > + popl %ecx > + popl %edi > + popl %esi > +#endif I suggest having this explicit, like #elif defined(ENABLE_LZMA) [...] #else #error blah #endif > +#if defined(ENABLE_LZO) > #include "lzo1x.S" > +#else > +#include "lzma_decode.S" > +#endif Same here (and in grub-mkimage). Nice work! -- Robert Millan I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.)