[OpenBIOS] [PATCH 0/8] RFC: OFMEM cleanup/memory reduction patch

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Apr 10 18:10:51 CEST 2012

On 10/04/12 15:30, Mark Cave-Ayland wrote:

> So by reducing s_ofmem_data, the main component is now the size of the
> Forth dictionary. Hmmm I've had an idea though - we could compress the
> dictionary, and then decompress/relocate into another set of
> OFMEM-allocated memory in a similar way so that the entire dictionary
> doesn't have to be part of the image.
> For example:
> $ ls -l obj-sparc64/openbios-sparc64.dict
> -rw-r--r-- 1 build build 181560 Apr 10 15:08
> obj-sparc64/openbios-sparc64.dict
> Now we need to allocate 512K in total within the image in order to allow
> for new entries created by bootloaders etc. If we compress the image
> aswell, e.g. using gzip:
> $ ls -l obj-sparc64/openbios-sparc64.dict.gz
> -rw-r--r-- 1 build build 37933 Apr 10 15:08
> obj-sparc64/openbios-sparc64.dict.gz
> Then we can dramatically reduce the dictionary usage within the file
> too. I wonder if we could incorporate a simple decompressor based upon
> something like pdlzip (http://lzip.nongnu.org/pdlzip.html) to perform
> LZMA decompression/relocation on the dictionary early within the startup
> process?

Actually, it seems as if zlib contains a miniature inflator called puff 
which seems license-friendly and designed for embedded applications:

/* puff.h
   Copyright (C) 2002-2010 Mark Adler, all rights reserved
   version 2.2, 25 Apr 2010

   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the author be held liable for any damages
   arising from the use of this software.

   Permission is granted to anyone to use this software for any purpose,
   including commercial applications, and to alter it and redistribute it
   freely, subject to the following restrictions:

   1. The origin of this software must not be misrepresented; you must not
      claim that you wrote the original software. If you use this software
      in a product, an acknowledgment in the product documentation would be
      appreciated but is not required.
   2. Altered source versions must be plainly marked as such, and must 
not be
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source 

   Mark Adler    madler at alumni.caltech.edu

Does anyone see any reason why we couldn't use this code within OpenBIOS 
to decompress the Forth dictionary in OFMEM-allocated memory at runtime? 
I think with a little bit of extra work we could simply use gzip on the 
command line in order to compress the dictionary at build time.



More information about the OpenBIOS mailing list