aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-06-25 16:59:06 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-07-08 15:43:24 +0100
commit047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c (patch)
tree682bb72db903d3ed3d9d75fe931d65a3b3be9e7d
parentc07dbea2b90c97839edde5a32e80d3d9d47f8dc4 (diff)
downloadsyslinux-047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c.tar.gz
syslinux-047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c.tar.xz
syslinux-047fcac405fb2bb29d1f7b08eb1f99b8d3e3141c.zip
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@intel.com>
-rw-r--r--efi/main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/efi/main.c b/efi/main.c
index 0bae399b..f68f05e1 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");