mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-09-06 05:31:50 +00:00
kvm: Add --params option
In particular this will keep boot agruments for kernel. The commit technically prepares ground for real argument pass. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
This commit is contained in:
committed by
Will Deacon
parent
5645c7a926
commit
6d1f350d0f
+1
-1
@@ -25,7 +25,7 @@ struct kvm {
|
||||
|
||||
struct kvm *kvm__init(void);
|
||||
void kvm__enable_singlestep(struct kvm *self);
|
||||
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename);
|
||||
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename, const char *kernel_cmdline);
|
||||
void kvm__reset_vcpu(struct kvm *self);
|
||||
void kvm__run(struct kvm *self);
|
||||
void kvm__emulate_io(struct kvm *self, uint16_t port, void *data, int direction, int size, uint32_t count);
|
||||
|
||||
@@ -194,7 +194,7 @@ static const char *BZIMAGE_MAGIC = "HdrS";
|
||||
|
||||
#define BZ_DEFAULT_SETUP_SECTS 4
|
||||
|
||||
static bool load_bzimage(struct kvm *self, int fd)
|
||||
static bool load_bzimage(struct kvm *self, int fd, const char *kernel_cmdline)
|
||||
{
|
||||
unsigned long setup_sects;
|
||||
struct boot_params boot;
|
||||
@@ -244,7 +244,8 @@ static bool load_bzimage(struct kvm *self, int fd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename)
|
||||
bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename,
|
||||
const char *kernel_cmdline)
|
||||
{
|
||||
bool ret;
|
||||
int fd;
|
||||
@@ -253,7 +254,7 @@ bool kvm__load_kernel(struct kvm *kvm, const char *kernel_filename)
|
||||
if (fd < 0)
|
||||
die("unable to open kernel");
|
||||
|
||||
ret = load_bzimage(kvm, fd);
|
||||
ret = load_bzimage(kvm, fd, kernel_cmdline);
|
||||
if (ret)
|
||||
goto found_kernel;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ static void usage(char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *kernel_filename = NULL;
|
||||
const char *kernel_cmdline = NULL;
|
||||
struct kvm *kvm;
|
||||
int i;
|
||||
|
||||
@@ -24,6 +25,9 @@ int main(int argc, char *argv[])
|
||||
if (!strncmp("--kernel=", argv[i], 9)) {
|
||||
kernel_filename = &argv[i][9];
|
||||
continue;
|
||||
} else if (!strncmp("--params=", argv[i], 9)) {
|
||||
kernel_cmdline = &argv[i][9];
|
||||
continue;
|
||||
} else {
|
||||
/* any unspecified arg is kernel image */
|
||||
if (argv[i][0] != '-')
|
||||
@@ -39,7 +43,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
kvm = kvm__init();
|
||||
|
||||
if (!kvm__load_kernel(kvm, kernel_filename))
|
||||
if (!kvm__load_kernel(kvm, kernel_filename, kernel_cmdline))
|
||||
die("unable to load kernel %s", kernel_filename);
|
||||
|
||||
kvm__reset_vcpu(kvm);
|
||||
|
||||
Reference in New Issue
Block a user