IT-Dienstleistungen

Using bhyve configuration files for virtual machines on FreeBSD - Windows 7 64 bit example

All posts

bhyve's -k option allows you to use a key=value configuration file to control all aspects of your virtual machine. While production-ready tools such as vm-bhyve may already suit your needs, you may prefer to configure your virtual machine in the most direct way possible.

bhyve -k configfile - Windows 7 64 bit example

Note that you can add XHCI or networking devices after the installation. Avoid using XHCI or virtio during the installation, otherwise you might scare the Windows 7 installer and it will crash.

Notes:

  • Windows expects local time, so use rtc.use_localtime=true.
  • Windows 7 requires 512K sector sizes, use sectorsize=512/512 and adjust your PCI definition as appropriate.
  • Remember that wait=true makes your virtual machine wait until a VNC connection is established so you have the chance to "Press any key" to start the Windows installation.
  • Remember to copy BHYVE_UEFI.fd and BHYVE_UEFI_VARS.fd to a dedicated directory and use the copies for the virtual machine.
  • Configuring /dev/nmdm0A into the Windows 7 virtual machine allows you to observe the installation via the other end on /dev/nmdm0B. You can verify that your Windows 7 installation crashed when this connection becomes unresponsive.
name=win7
cpus=1
cores=1
threads=1
sockets=1
memory.size=2048M
keyboard.layout=de
rtc.use_localtime=true
acpi_tables=false
acpi_tables_in_memory=false
pci.enable_bars=false
destroy_on_poweroff=true
memory.wired=true
x86.strictmsr=false
x86.vmexit_on_hlt=true
x86.vmexit_on_pause=true
pci.0.0.0.device=hostbridge
pci.0.2.0.device=virtio-net
pci.0.2.0.backend=tap0
pci.0.2.0.mac=02:de:ad:be:ef:01
pci.0.6.0.device=ahci
pci.0.6.0.port.1.type=cd
pci.0.6.0.port.1.path=/path/to/win7.iso
pci.0.6.0.port.2.type=hd
pci.0.6.0.port.2.path=/path/to/existing/win764bit/disk0
pci.0.6.0.port.2.sectorsize=512/512
pci.0.29.0.device=fbuf
pci.0.29.0.wait=true
pci.0.29.0.rfb=127.0.0.1:5900
pci.0.29.0.vga=io
pci.0.29.0.w=1024
pci.0.29.0.h=768
pci.0.29.0.password=hunter2
pci.0.31.0.device=lpc
lpc.bootrom=/path/to/win764bit/efi/BHYVE_UEFI.fd
lpc.bootvars=/path/to/win764bit/efi/BHYVE_UEFI_VARS.fd
lpc.com1.path=/dev/nmdm0A
lpc.fwcfg=qemu