Message ID | 1328679700-31015-4-git-send-email-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | a0abe474d587499a1553372c1692811f81fd3eda |
Headers | show |
On 02/07/2012 11:41 PM, Peter Maydell wrote: > Make kernel, initrd, append be machine opts (ie -machine kernel=foo) > with the old plain command line arguments as legacy/convenience > equivalents. > > Signed-off-by: Peter Maydell<peter.maydell@linaro.org> I applied this patch since Andrzej applied the first two. The four patch conflicts a bit more than I feel comfortable fixing myself. I would suggest that you just fold the 4th patch into your next pull request. Regards, Anthony Liguori > --- > qemu-config.c | 12 ++++++++++++ > vl.c | 24 ++++++++++++++++-------- > 2 files changed, 28 insertions(+), 8 deletions(-) > > diff --git a/qemu-config.c b/qemu-config.c > index c938470..07480a4 100644 > --- a/qemu-config.c > +++ b/qemu-config.c > @@ -536,6 +536,18 @@ static QemuOptsList qemu_machine_opts = { > .name = "kernel_irqchip", > .type = QEMU_OPT_BOOL, > .help = "use KVM in-kernel irqchip", > + }, { > + .name = "kernel", > + .type = QEMU_OPT_STRING, > + .help = "Linux kernel image file", > + }, { > + .name = "initrd", > + .type = QEMU_OPT_STRING, > + .help = "Linux initial ramdisk file", > + }, { > + .name = "append", > + .type = QEMU_OPT_STRING, > + .help = "Linux kernel command line", > }, > { /* End of list */ } > }, > diff --git a/vl.c b/vl.c > index fe24ef8..b8bb955 100644 > --- a/vl.c > +++ b/vl.c > @@ -2238,11 +2238,8 @@ int main(int argc, char **argv, char **envp) > module_call_init(MODULE_INIT_MACHINE); > machine = find_default_machine(); > cpu_model = NULL; > - initrd_filename = NULL; > ram_size = 0; > snapshot = 0; > - kernel_filename = NULL; > - kernel_cmdline = ""; > cyls = heads = secs = 0; > translation = BIOS_ATA_TRANSLATION_AUTO; > > @@ -2318,9 +2315,6 @@ int main(int argc, char **argv, char **envp) > cpu_model = optarg; > } > break; > - case QEMU_OPTION_initrd: > - initrd_filename = optarg; > - break; > case QEMU_OPTION_hda: > { > char buf[256]; > @@ -2451,10 +2445,13 @@ int main(int argc, char **argv, char **envp) > } > break; > case QEMU_OPTION_kernel: > - kernel_filename = optarg; > + qemu_opts_set(qemu_find_opts("machine"), 0, "kernel", optarg); > + break; > + case QEMU_OPTION_initrd: > + qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg); > break; > case QEMU_OPTION_append: > - kernel_cmdline = optarg; > + qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg); > break; > case QEMU_OPTION_cdrom: > drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS); > @@ -3241,6 +3238,17 @@ int main(int argc, char **argv, char **envp) > fprintf(stderr, "qemu_init_main_loop failed\n"); > exit(1); > } > + > + kernel_filename = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), > + 0), "kernel"); > + initrd_filename = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), > + 0), "initrd"); > + kernel_cmdline = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), > + 0), "append"); > + if (!kernel_cmdline) { > + kernel_cmdline = ""; > + } > + > linux_boot = (kernel_filename != NULL); > > if (!linux_boot&& *kernel_cmdline != '\0') {
diff --git a/qemu-config.c b/qemu-config.c index c938470..07480a4 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -536,6 +536,18 @@ static QemuOptsList qemu_machine_opts = { .name = "kernel_irqchip", .type = QEMU_OPT_BOOL, .help = "use KVM in-kernel irqchip", + }, { + .name = "kernel", + .type = QEMU_OPT_STRING, + .help = "Linux kernel image file", + }, { + .name = "initrd", + .type = QEMU_OPT_STRING, + .help = "Linux initial ramdisk file", + }, { + .name = "append", + .type = QEMU_OPT_STRING, + .help = "Linux kernel command line", }, { /* End of list */ } }, diff --git a/vl.c b/vl.c index fe24ef8..b8bb955 100644 --- a/vl.c +++ b/vl.c @@ -2238,11 +2238,8 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_MACHINE); machine = find_default_machine(); cpu_model = NULL; - initrd_filename = NULL; ram_size = 0; snapshot = 0; - kernel_filename = NULL; - kernel_cmdline = ""; cyls = heads = secs = 0; translation = BIOS_ATA_TRANSLATION_AUTO; @@ -2318,9 +2315,6 @@ int main(int argc, char **argv, char **envp) cpu_model = optarg; } break; - case QEMU_OPTION_initrd: - initrd_filename = optarg; - break; case QEMU_OPTION_hda: { char buf[256]; @@ -2451,10 +2445,13 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_kernel: - kernel_filename = optarg; + qemu_opts_set(qemu_find_opts("machine"), 0, "kernel", optarg); + break; + case QEMU_OPTION_initrd: + qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg); break; case QEMU_OPTION_append: - kernel_cmdline = optarg; + qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg); break; case QEMU_OPTION_cdrom: drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS); @@ -3241,6 +3238,17 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "qemu_init_main_loop failed\n"); exit(1); } + + kernel_filename = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), + 0), "kernel"); + initrd_filename = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), + 0), "initrd"); + kernel_cmdline = qemu_opt_get(qemu_opts_find(qemu_find_opts("machine"), + 0), "append"); + if (!kernel_cmdline) { + kernel_cmdline = ""; + } + linux_boot = (kernel_filename != NULL); if (!linux_boot && *kernel_cmdline != '\0') {
Make kernel, initrd, append be machine opts (ie -machine kernel=foo) with the old plain command line arguments as legacy/convenience equivalents. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- qemu-config.c | 12 ++++++++++++ vl.c | 24 ++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-)