mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-08-28 01:36:41 +00:00
Load kernel image to the VM
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
b6e5a081c5
commit
caf44df2f8
@@ -1,5 +1,3 @@
|
||||
#include "kvm/cpu.h"
|
||||
|
||||
#include <linux/kvm.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -114,6 +112,10 @@ static void kvm__run(struct kvm *self)
|
||||
die("KVM_RUN");
|
||||
}
|
||||
|
||||
static void kvm__load_kernel(struct kvm *kvm, const char *kernel_filename)
|
||||
{
|
||||
}
|
||||
|
||||
static const char *exit_reasons[] = {
|
||||
[KVM_EXIT_UNKNOWN] = "unknown",
|
||||
[KVM_EXIT_EXCEPTION] = "exception",
|
||||
@@ -135,17 +137,26 @@ static const char *exit_reasons[] = {
|
||||
[KVM_EXIT_INTERNAL_ERROR] = "internal error",
|
||||
};
|
||||
|
||||
static void usage(char *argv[])
|
||||
{
|
||||
fprintf(stderr, " usage: %s <kernel-image>\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct cpu *cpu;
|
||||
const char *kernel_filename;
|
||||
struct kvm *kvm;
|
||||
int ret;
|
||||
|
||||
if (argc < 2)
|
||||
usage(argv);
|
||||
|
||||
kernel_filename = argv[1];
|
||||
|
||||
kvm = kvm__init();
|
||||
|
||||
cpu = cpu__new();
|
||||
|
||||
cpu__reset(cpu);
|
||||
kvm__load_kernel(kvm, kernel_filename);
|
||||
|
||||
kvm__run(kvm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user