From patchwork Mon Jun 7 23:51:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 54899 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DCDADB7D47 for ; Tue, 8 Jun 2010 09:59:05 +1000 (EST) Received: from localhost ([127.0.0.1]:45906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLmDT-0007ZH-3a for incoming@patchwork.ozlabs.org; Mon, 07 Jun 2010 19:58:51 -0400 Received: from [140.186.70.92] (port=43922 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLm7E-0004M0-0l for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLm7B-00039s-RE for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:23 -0400 Received: from e8.ny.us.ibm.com ([32.97.182.138]:52725) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLm7B-00039k-Lj for qemu-devel@nongnu.org; Mon, 07 Jun 2010 19:52:21 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e8.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o57Nf92D010445 for ; Mon, 7 Jun 2010 19:41:09 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o57NqJJi1880270 for ; Mon, 7 Jun 2010 19:52:20 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o57NqJ34010292 for ; Mon, 7 Jun 2010 20:52:19 -0300 Received: from localhost.localdomain (sig-9-65-84-205.mts.ibm.com [9.65.84.205]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o57NqDqv009965; Mon, 7 Jun 2010 20:52:19 -0300 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Mon, 7 Jun 2010 18:51:56 -0500 Message-Id: <1275954730-8196-9-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> References: <1275954730-8196-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Glauber Costa , Anthony Liguori Subject: [Qemu-devel] [PATCH 08/22] machine: implement -kernel/-append/-initrd options in term of -machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori diff --git a/vl.c b/vl.c index 001adbe..4553648 100644 --- a/vl.c +++ b/vl.c @@ -2577,10 +2577,8 @@ int main(int argc, char **argv, char **envp) { const char *gdbstub_dev = NULL; int i; - int snapshot, linux_boot; + int snapshot; const char *icount_option = NULL; - const char *initrd_filename; - const char *kernel_filename, *kernel_cmdline; char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */ DisplayState *ds; DisplayChangeListener *dcl; @@ -2646,11 +2644,8 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_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; @@ -2746,7 +2741,7 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_initrd: - initrd_filename = optarg; + qemu_opts_parsef(&qemu_machine_opts, "initrd=%s", optarg); break; case QEMU_OPTION_hda: if (cyls == 0) @@ -2856,10 +2851,10 @@ int main(int argc, char **argv, char **envp) graphic_rotate = 1; break; case QEMU_OPTION_kernel: - kernel_filename = optarg; + qemu_opts_parsef(&qemu_machine_opts, "kernel=%s", optarg); break; case QEMU_OPTION_append: - kernel_cmdline = optarg; + qemu_opts_parsef(&qemu_machine_opts, "cmdline=%s", optarg); break; case QEMU_OPTION_cdrom: drive_add(optarg, CDROM_ALIAS); @@ -3629,17 +3624,6 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "qemu_init_main_loop failed\n"); exit(1); } - linux_boot = (kernel_filename != NULL); - - if (!linux_boot && *kernel_cmdline != '\0') { - fprintf(stderr, "-append only allowed with -kernel option\n"); - exit(1); - } - - if (!linux_boot && initrd_filename != NULL) { - fprintf(stderr, "-initrd only allowed with -kernel option\n"); - exit(1); - } #ifndef _WIN32 /* Win32 doesn't support line-buffering and requires size >= 2 */ @@ -3766,16 +3750,6 @@ int main(int argc, char **argv, char **envp) } qemu_add_globals(); - if (kernel_filename) { - qemu_opt_set(machine_opts, "kernel", kernel_filename); - if (kernel_cmdline) { - qemu_opt_set(machine_opts, "cmdline", kernel_cmdline); - } - if (initrd_filename) { - qemu_opt_set(machine_opts, "initrd", initrd_filename); - } - } - qemu_opt_set(machine_opts, "boot_device", boot_devices); if (cpu_model) {