From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 28 04:38:05 2013 Return-Path: Delivered-To: freebsd-virtualization@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 725D09F6; Wed, 28 Aug 2013 04:38:05 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-la0-x229.google.com (mail-la0-x229.google.com [IPv6:2a00:1450:4010:c03::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A062F28A9; Wed, 28 Aug 2013 04:38:04 +0000 (UTC) Received: by mail-la0-f41.google.com with SMTP id ec20so4424805lab.28 for ; Tue, 27 Aug 2013 21:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=mxJpD7GVhLNfGJa7R4DAaT+08AwJ4cBq4MysX2PdKZg=; b=vUPjBMwkpChYu/cHodQzenwwhN6suCH7M6BZyP9LDNmFJSrrNlwmvIJX2Nv6fBnq7U frmrn1ZEnNvKBT2arrm10RnnVNCXzyq96jCTsL0aVdgeLpKLFYz5vF0nFYVbF1EHghM5 xtNX7xbz2syqhRvUQR9jtWUAJir/mJefSL9G1aF+/LlsIobv4qFWNg8RKq6/Kc/hRHYT VaRp6s5J3Z1zv8gs29/1OgSRD00plYNSDBXBtPoNKoj3DMXTp6z/lia15q4gQhJu+s6M o0uhDGb0fD2/LZIlD514TjBti504lVglBAp1aKp8LgGW8OcoZrubqht2uRomoyqIJT03 O/HA== MIME-Version: 1.0 X-Received: by 10.152.19.1 with SMTP id a1mr21345837lae.8.1377664682546; Tue, 27 Aug 2013 21:38:02 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.168.136 with HTTP; Tue, 27 Aug 2013 21:38:02 -0700 (PDT) Received: by 10.112.168.136 with HTTP; Tue, 27 Aug 2013 21:38:02 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 Aug 2013 21:38:02 -0700 X-Google-Sender-Auth: i_IrO2qzDSddM4AOCYh7r5R12wI Message-ID: Subject: Re: Simulating CD-ROM device with BHyve and ISO disk image? From: Craig Rodrigues To: Andreas Nilsson Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Aug 2013 04:38:05 -0000 If I do either of these at the mountroot prompt then things work: cd9660:iso9660/CDROM cd9660:/dev/vtbd1 I was kind of hoping to leverage off the existing logic in vfs_mountroot.c which tries to mount in this order: cd9660:/dev/cd0 cd9660:/dev/acd0 I don't want to hard-code any more device names in my code. If I put the following entries in /boot/loader.conf of my ISO image: boot_cdrom="YES" vfs.root.mountfrom="cd9660:iso9660/CDROM" then the logic in vfs_mountroot.c will try to mount the root file system from the devices in this order: cd9660:/dev/cd0 cd9660:/dev/acd0 cd9660:iso9660/CDROM That seems to work. I'd rather have a flag to BHyve to force an ISO image to be associated with a CDROM device l Iike /dev/cd0. This would be similar to what can be done with QEMU, VirtualBox, VMWare, etc. -- Craig On Aug 27, 2013 9:08 PM, "Andreas Nilsson" wrote: > What happens if you specify > > cd9660:iso9660/CDROM when first boot attempt has failed? > > You could also try cd9660:/dev/vtbd1 > > > Best regards > Andreas > > > On Wed, Aug 28, 2013 at 1:12 AM, Craig Rodrigues wrote: > >> Hi, >> >> I have an ISO image that I am trying to boot in BHyve. >> >> I tried this: >> >> truncate -s 2G /tmp/disk.img >> sh /usr/share/examples/bhyve/vmrun.sh -I test.iso -d /tmp/disk.img >> freenas1 >> >> The initial kernel boots, but then fails to mount the root device: >> >> >> ============================================================================ >> mountroot> ? >> >> List of GEOM managed disk devices: >> iso9660/CDROM vtbd1 vtbd0 >> >> FreeBSD is a registered trademark of The FreeBSD Foundation. >> FreeBSD 9.1-STABLE #0 r+42f8bbd: Sun Aug 18 00:03:25 PDT 2013 >> root@build.ixsystems.com: >> /tank/home/rodrigc/freenas/freenas/os-base/amd64/tank/home/rodrigc/freenas/freenas/FreeBSD/src/sys/FREENAS.amd64 >> amd64 >> gcc version 4.2.1 20070831 patched [FreeBSD] >> CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (2494.19-MHz K8-class CPU) >> Origin = "GenuineIntel" Id = 0x206a7 Family = 0x6 Model = 0x2a >> Stepping = 7 >> >> >> Features=0x8f8bab7f >> >> >> Features2=0x83ba6257 >> AMD Features=0x20100800 >> AMD Features2=0x1 >> TSC: P-state invariant >> real memory = 536870912 (512 MB) >> avail memory = 492359680 (469 MB) >> Event timer "LAPIC" quality 400 >> ACPI APIC Table: >> FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs >> FreeBSD/SMP: 2 package(s) x 1 core(s) >> cpu0 (BSP): APIC ID: 0 >> cpu1 (AP): APIC ID: 1 >> WARNING: VIMAGE (virtualized network stack) is a highly experimental >> feature. >> ACPI Warning: FADT (revision 5) is longer than ACPI 2.0 version, >> truncating >> length 268 to 244 (20110527/tbfadt-320) >> ioapic0: Changing APIC ID to 2 >> ioapic0 irqs 0-16 on motherboard >> kbd0 at kbdmux0 >> aesni0: on motherboard >> cryptosoft0: on motherboard >> acpi0: on motherboard >> atrtc0: port 0x70-0x71,0x72-0x77 irq 8 on acpi0 >> Event timer "RTC" frequency 32768 Hz quality 0 >> Timecounter "ACPI-safe" frequency 3579545 Hz quality 850 >> acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0 >> pcib0: port 0xcf8-0xcff on acpi0 >> pci0: on pcib0 >> pcib0: no PRT entry for 0.31.INTA >> virtio_pci0: port 0x2000-0x201f mem >> 0xc0000000-0xc0001fff at device 1.0 on pci0 >> vtnet0: on virtio_pci0 >> virtio_pci0: host features: 0x1018020 >> >> virtio_pci0: negotiated features: 0x1018020 >> >> vtnet0: Ethernet address: 00:a0:98:30:99:23 >> virtio_pci1: port 0x2040-0x207f mem >> 0xc0002000-0xc0003fff at device 2.0 on pci0 >> vtblk0: on virtio_pci1 >> virtio_pci1: host features: 0x10000004 >> virtio_pci1: negotiated features: 0x10000004 >> vtblk0: 2048MB (4194304 512 byte sectors) >> virtio_pci2: port 0x2080-0x20bf mem >> 0xc0004000-0xc0005fff at device 3.0 on pci0 >> vtblk1: on virtio_pci2 >> virtio_pci2: host features: 0x10000004 >> virtio_pci2: negotiated features: 0x10000004 >> vtblk1: 254MB (521624 512 byte sectors) >> uart2: <16550 or compatible> port 0x3f8-0x3ff irq 4 at device 31.0 on pci0 >> uart2: console (9600,n,8,1) >> Timecounters tick every 1.000 msec >> ipfw2 (+ipv6) initialized, divert enabled, nat enabled, default to accept, >> logging disabled >> DUMMYNET 0xfffffe0002106940 with IPv6 initialized (100409) >> load_dn_sched dn_sched WF2Q+ loaded >> load_dn_sched dn_sched FIFO loaded >> load_dn_sched dn_sched PRIO loaded >> load_dn_sched dn_sched QFQ loaded >> load_dn_sched dn_sched RR loaded >> SMP: AP CPU #1 Launched! >> Timecounter "TSC-low" frequency 1247092718 Hz quality 1000 >> Trying to mount root from cd9660:/dev/cd0 [ro]... >> mountroot: waiting for device /dev/cd0 ... >> Mounting from cd9660:/dev/cd0 failed with error 19. >> Trying to mount root from cd9660:/dev/acd0 [ro]... >> mountroot: waiting for device /dev/acd0 ... >> Mounting from cd9660:/dev/acd0 failed with error 19. >> >> Loader variables: >> >> Manual root filesystem specification: >> : [options] >> Mount using filesystem >> and with the specified (optional) option list. >> >> eg. ufs:/dev/da0s1a >> zfs:tank >> cd9660:/dev/acd0 ro >> (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /) >> >> ? List valid disk boot devices >> . Yield 1 second (for background tasks) >> Abort manual input >> >> mountroot> ? >> >> List of GEOM managed disk devices: >> iso9660/CDROM vtbd1 vtbd0 >> >> >> ============================================================================ >> >> Currently the logic for how the root mount device is chosen >> is hardcoded in the vfs_mountroot_conf0 function: >> >> http://bxr.su/FreeBSD/sys/kern/vfs_mountroot.c#823 >> >> >> This logic basically says, try in this order: >> >> cd9660:/dev/cd0 >> cd9660:/dev/acd0 >> device specified in vfs.root.mountfrom >> >> It looks like with BHyve, if I invoke the vmrun.sh script as I have >> done, the ISO file is not on cd0 or acd0, but is on vtbd1. >> >> Is there a way I can mount the ISO file on a simulated cd0 device? >> This would make the logic in my installer still work. >> This ISO image successfully boots on real hardware, >> and in qemu with the "-cdrom" flag. >> >> Thanks. >> >> -- >> Craig >> _______________________________________________ >> freebsd-virtualization@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization >> To unsubscribe, send any mail to " >> freebsd-virtualization-unsubscribe@freebsd.org" >> > >