[LinuxBIOS] selection of compression algorithm
c-d.hailfinger.devel.2006 at gmx.net
Tue May 23 04:43:30 CEST 2006
Ronald G Minnich wrote:
> Carl-Daniel Hailfinger wrote:
>> yhlu wrote:
>>> then how about the lines for 7z uncompress code?
>> Working on it. 7z decompressor is really small (8 kb compiled on
>> i386) and written in ISO C (1884 lines of code), but compressor is
>> big and written in C++.
>> Does it still make sense to try to use 7z?
> yes, this is the perfect tradeoff. Highly complex, compute-intensive
> compressor and simple, small decompressor. Exactly what we want.
I managed to trim this down further.
4 kb compiled code on i386, 497 lines of C code.
>> How much RAM is the decompressor allowed to use?
> for the romcc section, you have about 6 32-bit words (or so). for the
> gcc section, you have all of memory more or less.
OK, then we can call lzma decompressor only from the gcc section.
It needs to allocate some scratch space (between 5228 and 6295148 bytes,
default value is 15980 bytes) besides src and dst. The size of the
scratch space can be determined at compile time, so we can create
compressed images which only need 5228 bytes scratch space.
What is the best way to handle this? Dynamic allocation or fixed buffer?
Size comparison for OLPC target and small kernel:
The .lzma.smallscratchspace needs 5228 bytes scratch space,
the .lzma.default needs 15980 bytes scratch space.
lzma decompression can be called the same way as nrv2b decompression:
static unsigned long unlzma(unsigned char * src, unsigned char * dst);
Patch is attached. Please note that this patch doesn't change anything,
it only adds infrastructure. If you want a patch that builds most
targets (especially OLPC) with lzma, just ask. I have it sitting on
my hard drive.
To use lzma compression, download the LZMA SDK.
curl -O http://switch.dl.sourceforge.net/sourceforge/sevenzip/lzma442.tar.bz2
tar xfj ../lzma442.tar.bz2
make -f makefile.gcc
cp -a lzma /usr/local/bin/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the coreboot