bzimage: Account for extra room when decompressing kernel
Up until now we've been allocating the space for the kernel *after*
we've done all our other allocations, and it made the error paths
particularly cumbersome where we needed to free those
allocations. This is essentially a hack because of the extra space
required when the kernel decompresses itself. By placing all our other
allocations below the kernel they are not trashed during
decompression.
Linux kernels after v2.6.31 (with setup header version 2.10) include
'pref_address' and 'init_size' fields in their setup header. These
fields indicate where the kernel would prefer to be loaded in memory
and the size of the memory allocation required for the kernel,
including space for decompression. By using these fields we no longer
have to allocate space for the kernel after everything else. For
earlier kernel versions we can just make a conservative estimate of
the amount of space required.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2 files changed