fastlz: Libraries included for kernel compression from fastlz project.

Added source code of fastlz from fastlz.org.

The original library is written in C, but it was also C++ compatible,
hence in this patch I added as a C++ source code and without
preprocessor and extern "C" code.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
lz: Simple command line compress tool

Fastlz library provides two default tools for compression and uncompression:
6pack and 6unpack. We are not using those tools since they work with chuncks
and checksums, because they assume we have a restriction on buffer size
(because the most common usage for compression tools is reading from disk
and writting it back the compressed image).

Since we're working with all the image in memory and our output buffer
is the memory itself, we can uncompress all the data at once, making it
a much simpler and faster solution.

But, to do that, we must compress the image in the same way, that's why
this simple command line was written.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
lzloader: Load compressed Kernel image from memory

The lzloader itself is very simple, it read all data that was
compressed using the lz command line tool and uncompress it on
the address the kernel should be running, i.e.: 0x200000.

The MAX_BUFFER is the address range from 0x200000 to 0x0x1800000.

_binary_loader_stripped_elf_lz_start is an extern symbol to the
compressed kernel image. This is created during the build process
using objcopy command line tool.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
check-image-size: check if enough space exists for kernel decompression

This script is called from build.mk to check if enough space exists for kernel
decompression. If not, break the build.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
lzloader: Build all fastlz related stuff and call the lzloader from boot16.S

On build.mk two image targets are created: lzloader.elf and lzloader-stripped.elf.

The lzloader-stripped.elf is not the imaged included on loader.img. For this process
we need to call the fastlz/lz tool and link it with fastlz/fastlz.o, so those dependencies
are added.

We're calling our lzloader from boot16.S, hence we need to compile all fastlz related
stuff as -m32, so we have 32 bits binary code. This design was used in order to
do as minimal changes to the OSv core as possible and since on boot.S we have
all page tables, GDT and so on, all this are also compressed and remain on the
same address as before lzloader was introduced.

With this design it's easier to revert this patch (if needed) and also
we could add a make target to build OSv without compression (with such scenario exists)
with minimal effort.

The address 0x1800000 is choosen so we still have enough memory to uncompress the kernel
and at the same times make OSv boot with less then 32Mb of memory. If some day this
is not enough to decompress the kernel, build will fail.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
boot.*: Make matches coding standards.

In the process of making the lzloader, I noticed that boot.S and boot16.S
uses tabs.

Changes done using regexp.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>