From patchwork Wed Feb 8 05:41:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 6706 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3D59523EAA for ; Wed, 8 Feb 2012 05:41:50 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id ED001A180AD for ; Wed, 8 Feb 2012 05:41:49 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id z7so480248iab.11 for ; Tue, 07 Feb 2012 21:41:49 -0800 (PST) Received: by 10.42.74.195 with SMTP id x3mr14366405icj.41.1328679709722; Tue, 07 Feb 2012 21:41:49 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.169.210 with SMTP id a18cs5061ibz; Tue, 7 Feb 2012 21:41:49 -0800 (PST) Received: by 10.236.184.8 with SMTP id r8mr35729060yhm.110.1328679706434; Tue, 07 Feb 2012 21:41:46 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id v42si512134yhl.40.2012.02.07.21.41.45 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Feb 2012 21:41:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1Rv0Hk-00084m-W5; Wed, 08 Feb 2012 05:41:40 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Grant Likely , Anthony Liguori , Alexander Graf Subject: [PATCH 3/4] Make kernel, initrd and append be machine_opts Date: Wed, 8 Feb 2012 05:41:39 +0000 Message-Id: <1328679700-31015-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1328679700-31015-1-git-send-email-peter.maydell@linaro.org> References: <1328679700-31015-1-git-send-email-peter.maydell@linaro.org> 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 --- 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') {