summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2021-09-13 20:51:42 -0700
committerSimon Horman <horms@verge.net.au>2021-09-14 13:23:36 +0200
commitdbc151eaddc0ef2dbe1c56939dc36a78aad16abd (patch)
tree818ec36e3687147ac9224560407c7f4430a1b2ae
parente38819573d3b05fc3a32401988527f29f708de68 (diff)
downloadkexec-tools-dbc151eaddc0ef2dbe1c56939dc36a78aad16abd.tar.gz
multiboot2: Accept x86-64 images
Signed-off-by: Zhaofeng Li <hello@zhaofeng.li> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/kexec-mb2-x86.c6
-rw-r--r--kexec/arch/x86_64/kexec-x86_64.c4
2 files changed, 6 insertions, 4 deletions
diff --git a/kexec/arch/i386/kexec-mb2-x86.c b/kexec/arch/i386/kexec-mb2-x86.c
index f3e6b38f..36fef209 100644
--- a/kexec/arch/i386/kexec-mb2-x86.c
+++ b/kexec/arch/i386/kexec-mb2-x86.c
@@ -76,8 +76,10 @@ int multiboot2_x86_probe(const char *buf, off_t buf_len)
/* Is it a good idea to try booting this file? */
{
int i, len;
- /* First of all, check that this is an ELF file */
- if ((i=elf_x86_probe(buf, buf_len)) < 0)
+
+ /* First of all, check that this is an ELF file for either x86 or x86-64 */
+ i = elf_x86_any_probe(buf, buf_len, CORE_TYPE_UNDEF);
+ if (i < 0)
return i;
/* Now look for a multiboot header. */
diff --git a/kexec/arch/x86_64/kexec-x86_64.c b/kexec/arch/x86_64/kexec-x86_64.c
index 394cfca6..ffd84f04 100644
--- a/kexec/arch/x86_64/kexec-x86_64.c
+++ b/kexec/arch/x86_64/kexec-x86_64.c
@@ -33,11 +33,11 @@
#include <arch/options.h>
struct file_type file_type[] = {
+ { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
+ multiboot2_x86_usage },
{ "elf-x86_64", elf_x86_64_probe, elf_x86_64_load, elf_x86_64_usage },
{ "multiboot-x86", multiboot_x86_probe, multiboot_x86_load,
multiboot_x86_usage },
- { "multiboot2-x86", multiboot2_x86_probe, multiboot2_x86_load,
- multiboot2_x86_usage },
{ "elf-x86", elf_x86_probe, elf_x86_load, elf_x86_usage },
{ "bzImage64", bzImage64_probe, bzImage64_load, bzImage64_usage },
{ "bzImage", bzImage_probe, bzImage_load, bzImage_usage },