[syslinux:firmware] efi: try harder to boot non-relocatable kernels
syslinux-bot for Matt Fleming
matt.fleming at intel.com
Mon Jul 8 09:30:05 PDT 2013
Commit-ID: 047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c
Gitweb: http://www.syslinux.org/commit/047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c
Author: Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 25 Jun 2013 16:59:06 +0100
Committer: Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 8 Jul 2013 15:43:24 +0100
efi: try harder to boot non-relocatable kernels
We don't absolutely need a kernel to be built with CONFIG_RELOCATABLE=y
in order to boot it. We can try and place the kernel image as its
preferred address, and if that fails and the image isn't relocatable,
then we can bail.
Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
efi/main.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/efi/main.c b/efi/main.c
index 0bae399..f68f05e 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -744,14 +744,9 @@ int efi_boot_linux(void *kernel_buf, size_t kernel_size,
hdr = (struct linux_header *)kernel_buf;
bp = (struct boot_params *)hdr;
- /*
- * We require a relocatable kernel because we have no control
- * over free memory in the memory map.
- */
- if (hdr->version < 0x20a || !hdr->relocatable_kernel) {
- printf("bzImage version 0x%x unsupported\n", hdr->version);
- goto bail;
- }
+
+ if (hdr->version < 0x205)
+ hdr->relocatable_kernel = 0;
/* FIXME: check boot sector signature */
if (hdr->boot_flag != BOOT_SIGNATURE) {
@@ -802,6 +797,11 @@ int efi_boot_linux(void *kernel_buf, size_t kernel_size,
* We failed to allocate the preferred address, so
* just allocate some memory and hope for the best.
*/
+ if (!hdr->relocatable_kernel) {
+ printf("Cannot relocate kernel, bailing out\n");
+ goto bail;
+ }
+
status = emalloc(init_size, hdr->kernel_alignment, &addr);
if (status != EFI_SUCCESS) {
printf("Failed to allocate memory for kernel image, bailing out\n");
More information about the Syslinux-commits
mailing list