linuxboot: fix loading old kernels
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Dec 2014 01:17:03 +0000 (02:17 +0100)
committerSooyoung Ha <yoosah.ha@samsung.com>
Sun, 21 Aug 2016 07:00:40 +0000 (16:00 +0900)
commit30aa5555d324827c31cfb40c68fc70245e7f9754
tree247ff6fe3f5b68c0d675ebf627a8c75890d4f7c0
parentea4d5a3f1a3907151c7abb6302b2dbdc3f4cc15d
linuxboot: fix loading old kernels

Old kernels that used high memory only allowed the initrd to be in the
first 896MB of memory.  If you load the initrd above, they complain
that "initrd extends beyond end of memory".

In order to fix this, while not breaking machines with small amounts
of memory fixed by cdebec5 (linuxboot: compute initrd loading address,
2014-10-06), we need to distinguish two cases.  If pc.c placed the
initrd at end of memory, use the new algorithm based on the e801
memory map.  If instead pc.c placed the initrd at the maximum address
specified by the bzImage, leave it there.

The only interesting part is that the low-memory info block is now
loaded very early, in real mode, and thus the 32-bit address has
to be converted into a real mode segment.  The initrd address is
also patched in the info block before entering real mode, it is
simpler that way.

This fixes booting the RHEL4.8 32-bit installation image with 1GB
of RAM.

Cc: qemu-stable@nongnu.org
Cc: mst@redhat.com
Cc: jsnow@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 269e2358492b674c50160553d037702e916b9f1b)

Change-Id: I0f461f04c0a7f97dc23dc7436f98a90ac3812a20
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
pc-bios/linuxboot.bin
pc-bios/optionrom/linuxboot.S