From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FaXXd-0008T0-6o for qemu-devel@nongnu.org; Mon, 01 May 2006 08:30:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FaXXc-0008SM-1x for qemu-devel@nongnu.org; Mon, 01 May 2006 08:30:16 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FaXXb-0008S9-JA for qemu-devel@nongnu.org; Mon, 01 May 2006 08:30:15 -0400 Received: from [84.96.92.56] (helo=smTp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FaXbP-00075e-QY for qemu-devel@nongnu.org; Mon, 01 May 2006 08:34:12 -0400 Received: from [84.102.211.147] by sp604003mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0IYL0061Z6Q2TDL0@sp604003mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Mon, 01 May 2006 14:30:03 +0200 (CEST) Date: Mon, 01 May 2006 14:29:19 +0200 From: Fabrice Bellard Subject: Re: [Qemu-devel] [PATCH] Allow -kernel without -hda In-reply-to: Message-id: <4455FF1F.9040303@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I agree that the feature is useful, but your patch is incomplete: without bs_table[0], the boot sector cannot be created and the Linux kernel cannot be launched. Maybe you have a specific Ethernet BIOS to enable that ? Someone submitted a new block driver which simulated "/dev/zero" and it may be another solution. Regards, Fabrice. Ed Swierk wrote: > The qemu -kernel option currently requires specifying a hard disk > image with -hda. Ostensibly at least one hard disk is needed for > qemu's boot loader to populate the partition table in its array of > boot sectors. > > Passing -hda /dev/zero tricks qemu into booting, which demonstrates > that the requirement is unnecessary. Booting with no disk image is > needed to support diskless configurations where a remote NFS directory > is used as the root filesystem. In this scenario, the user invokes > qemu with -kernel and -initrd options, with a specially configured > initrd that NFS-mounts a filesystem on / before passing control to the > real init. > > The attached patch permits using the -kernel option with no disk > images, and skips copying the partition table in this case. > > --Ed > > > ------------------------------------------------------------------------ > > diff -BurN qemu-snapshot-2006-03-27_23.orig/hw/pc.c qemu-snapshot-2006-03-27_23/hw/pc.c > --- qemu-snapshot-2006-03-27_23.orig/hw/pc.c 2006-04-05 13:05:17.000000000 +0000 > +++ qemu-snapshot-2006-03-27_23/hw/pc.c 2006-04-05 13:12:40.000000000 +0000 > @@ -707,10 +707,6 @@ > uint8_t bootsect[512]; > uint8_t old_bootsect[512]; > > - if (bs_table[0] == NULL) { > - fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n"); > - exit(1); > - } > snprintf(buf, sizeof(buf), "%s/%s", bios_dir, LINUX_BOOT_FILENAME); > ret = load_image(buf, bootsect); > if (ret != sizeof(bootsect)) { > @@ -719,12 +715,14 @@ > exit(1); > } > > - if (bdrv_read(bs_table[0], 0, old_bootsect, 1) >= 0) { > - /* copy the MSDOS partition table */ > - memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40); > - } > + if (bs_table[0]) { > + if (bdrv_read(bs_table[0], 0, old_bootsect, 1) >= 0) { > + /* copy the MSDOS partition table */ > + memcpy(bootsect + 0x1be, old_bootsect + 0x1be, 0x40); > + } > > - bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect)); > + bdrv_set_boot_sector(bs_table[0], bootsect, sizeof(bootsect)); > + } > > /* now we can load the kernel */ > ret = load_kernel(kernel_filename, > > > ------------------------------------------------------------------------ > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel