mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-10-03 23:38:35 +00:00
kvm tools: Allow to load ELF binary
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
committed by
Will Deacon
parent
1d52535d9c
commit
f9dee795b9
@@ -109,6 +109,7 @@ void *guest_flat_to_host(struct kvm *kvm, u64 offset);
|
||||
u64 host_to_guest_flat(struct kvm *kvm, void *ptr);
|
||||
|
||||
int load_flat_binary(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *kernel_cmdline);
|
||||
int load_elf_binary(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *kernel_cmdline);
|
||||
bool load_bzimage(struct kvm *kvm, int fd_kernel, int fd_initrd, const char *kernel_cmdline);
|
||||
|
||||
/*
|
||||
|
||||
@@ -349,6 +349,12 @@ static bool initrd_check(int fd)
|
||||
!memcmp(id, CPIO_MAGIC, 4);
|
||||
}
|
||||
|
||||
int __attribute__((__weak__)) load_elf_binary(struct kvm *kvm, int fd_kernel,
|
||||
int fd_initrd, const char *kernel_cmdline)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename,
|
||||
const char *initrd_filename, const char *kernel_cmdline)
|
||||
{
|
||||
@@ -375,6 +381,11 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename,
|
||||
|
||||
pr_warning("%s is not a bzImage. Trying to load it as a flat binary...", kernel_filename);
|
||||
|
||||
ret = load_elf_binary(kvm, fd_kernel, fd_initrd, kernel_cmdline);
|
||||
|
||||
if (ret)
|
||||
goto found_kernel;
|
||||
|
||||
ret = load_flat_binary(kvm, fd_kernel, fd_initrd, kernel_cmdline);
|
||||
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user