Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Aug 2013 21:38:02 -0700
From:      Craig Rodrigues <rodrigc@crodrigues.org>
To:        Andreas Nilsson <andrnils@gmail.com>
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: Simulating CD-ROM device with BHyve and ISO disk image?
Message-ID:  <CAG=rPVfQm_46hRC_fKksCatz%2Bp44uD0DhcyKZLAF006YdeArzg@mail.gmail.com>
In-Reply-To: <CAPS9%2BSsr8X=TGOefcWQB-bjqFRHibNTbV_orGsaA-EB4DYRiwg@mail.gmail.com>
References:  <CAG=rPVdz7sbjQis5hqpFA7ycPEJpEA=sF%2BHMz%2BrzzM4zjQs6Bw@mail.gmail.com> <CAPS9%2BSsr8X=TGOefcWQB-bjqFRHibNTbV_orGsaA-EB4DYRiwg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <andrnils@gmail.com> 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 <rodrigc@freebsd.org>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<FPU,VME,DE,PSE,TSC,MSR,PAE,CX8,APIC,SEP,PGE,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,SS,PBE>
>>
>>
>> Features2=0x83ba6257<SSE3,PCLMULQDQ,DTES64,DS_CPL,SMX,SSSE3,CX16,xTPR,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,HV>
>>   AMD Features=0x20100800<SYSCALL,NX,LM>
>>   AMD Features2=0x1<LAHF>
>>   TSC: P-state invariant
>> real memory  = 536870912 (512 MB)
>> avail memory = 492359680 (469 MB)
>> Event timer "LAPIC" quality 400
>> ACPI APIC Table: <BHYVE  BVMADT  >
>> 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 <Version 1.1> irqs 0-16 on motherboard
>> kbd0 at kbdmux0
>> aesni0: <AES-CBC,AES-XTS> on motherboard
>> cryptosoft0: <software crypto> on motherboard
>> acpi0: <BHYVE BVXSDT> on motherboard
>> atrtc0: <AT realtime clock> 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: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
>> pci0: <ACPI PCI bus> on pcib0
>> pcib0: no PRT entry for 0.31.INTA
>> virtio_pci0: <VirtIO PCI Network adapter> port 0x2000-0x201f mem
>> 0xc0000000-0xc0001fff at device 1.0 on pci0
>> vtnet0: <VirtIO Networking Adapter> on virtio_pci0
>> virtio_pci0: host features: 0x1018020
>> <NotifyOnEmpty,Status,MrgRxBuf,MacAddress>
>> virtio_pci0: negotiated features: 0x1018020
>> <NotifyOnEmpty,Status,MrgRxBuf,MacAddress>
>> vtnet0: Ethernet address: 00:a0:98:30:99:23
>> virtio_pci1: <VirtIO PCI Block adapter> port 0x2040-0x207f mem
>> 0xc0002000-0xc0003fff at device 2.0 on pci0
>> vtblk0: <VirtIO Block Adapter> on virtio_pci1
>> virtio_pci1: host features: 0x10000004 <RingIndirect,MaxNumSegs>
>> virtio_pci1: negotiated features: 0x10000004 <RingIndirect,MaxNumSegs>
>> vtblk0: 2048MB (4194304 512 byte sectors)
>> virtio_pci2: <VirtIO PCI Block adapter> port 0x2080-0x20bf mem
>> 0xc0004000-0xc0005fff at device 3.0 on pci0
>> vtblk1: <VirtIO Block Adapter> on virtio_pci2
>> virtio_pci2: host features: 0x10000004 <RingIndirect,MaxNumSegs>
>> virtio_pci2: negotiated features: 0x10000004 <RingIndirect,MaxNumSegs>
>> 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:
>>   <fstype>:<device> [options]
>>       Mount <device> using filesystem <fstype>
>>       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)
>>   <empty line>    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"
>>
>
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVfQm_46hRC_fKksCatz%2Bp44uD0DhcyKZLAF006YdeArzg>