# cd /var/ports/bhykx/sysutils/grub2-bhyve # make install
# sed -Ee 's/^(network0_switch=).*$/\1"local"/' \
/vm/.templates/netbsd.conf > /vm/.templates/netbsd7.conf
# cat /vm/.templates/netbsd7.conf
loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="local"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="knetbsd -h -r cd0a /netbsd"
grub_run0="knetbsd -h -r ld0a /netbsd"
root@vm:~ #
# vm iso \
ftp://ftp.netbsd.org/pub/NetBSD/images/7.0.2/NetBSD-7.0.2-amd64.iso \
#
# vm create -t netbsd7 netbsd
# ll /vm/netbsd/
total 1
-rw-r--r-- 1 root wheel 34359738368 Dec 6 07:33 disk0.img
-r--r--r-- 1 root wheel 178 Dec 6 07:33 tbedfc.conf
# cat /vm/netbsd/netbsd.conf
loader="grub"
cpu=1
memory=256M
network0_type="virtio-net"
network0_switch="local"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="knetbsd -h -r cd0a /netbsd"
grub_run0="knetbsd -h -r ld0a /netbsd"
uuid="d3a5e6af-bc18-11e6-8698-003048dcbe58"
# mkdir /boot/grub
# cp \
/var/ports/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/tests/boot/* \
/boot/grub/
# vm install netbsd NetBSD-7.0.2-amd64.iso
Starting netbsd
* found guest in /vm/netbsd
! no unrestricted guest support in cpu. only single vcpu FreeBSD \
guests supported
root@vm:~ #
% egrep -RnH 'no unrestricted guest support in cpu' \
/usr/local/lib/vm-bhyve/
/usr/local/lib/vm-bhyve/vm-core:427: echo " ! no unrestricted \
guest support in cpu. only single vcpu FreeBSD guests \
supported"
/usr/local/lib/vm-bhyve/vm-core.org:425: echo " ! no unrestricted \
guest support in cpu. only single vcpu FreeBSD guests \
supported"
%
if [ -n "${VM_NO_UG}" -a "${_loader}" != "bhyveload" ]; then
echo " ! no unrestricted guest support in cpu. only single vcpu FreeBSD \
guests supported"
return 1
fi
% egrep -RnH 'VM_NO_UG=' /usr/local/lib/vm-bhyve/
/usr/local/lib/vm-bhyve/vm-util:89: [ -z "${_result}" ] && \
VM_NO_UG="1"
/usr/local/lib/vm-bhyve/vm-core:423: echo \
"VM_NO_UG=\"${VM_NO_UG}\""
%
# check ept for intel
_mesg=$(grep -E '^[ ]+VT-x' /var/run/dmesg.boot | tail -n 1)
if [ -n "${_mesg}" ]; then
# look for ept
_result=$(echo "${_mesg}" |grep "EPT")
[ -z "${_result}" ] && util::err "it doesn't look like your cpu supports \
bhyve (missing EPT)"
# look for unrestricted guest
_result=$(echo "${_mesg}" |grep ",UG")
[ -z "${_result}" ] && VM_NO_UG="1"
fi
The bhyve design requires a processor that supports Intel Extended Page \
Tables (
EPT) or AMD Rapid Virtualization Indexing (RVI) or Nested Page Tables \
(NPT).
Hosting Linux guests or FreeBSD guests with more than one vCPU requires VMX
unrestricted mode support (UG). Most newer processors, specifically the \
Intel
Core i3/i5/i7 and Intel Xeon E3/E5/E7, support these features. UG support \
was
introduced with Intel's Westmere micro-architecture. For a complete list of \
Intel
processors that support EPT, refer to \
http://ark.intel.com/search/advanced?s=t&
ExtendedPageTables=true. RVI is found on the third generation and later of \
the
AMD Opteron (Barcelona) processors. The easiest way to tell if a processor
supports bhyve is to run dmesg or look in /var/run/dmesg.boot for the \
POPCNT
processor feature flag on the Features2 line for AMD processors or EPT and \
UG on
the VT-x line for Intel processors.
UG(VMX unrestricted mode support)が付いてないCPUでは
でした;-(
BHyVeをやる前には必ず
% egrep '^ *VT-x:.*,UG' /var/run/dmesg.boot
で確かめましょう.