Here’s an explanation of how to install virtio drivers on FreeBSD9.0 VM.
just referred to http://www.area536.com/projects/freebsd-as-a-kvm-guest-using-virtio/
many thanks!
FreeBSD 9.0 VM is running within Ubuntu 13.04 KVM host.
KVM host info
| 
root@ubuntu-1:~# tail -1 /etc/lsb-release 
DISTRIB_DESCRIPTION="Ubuntu 13.04" 
# uname -ri 
3.8.0-23-generic x86_64 
# kvm --version 
W: kvm binary is deprecated, please use qemu-system-x86_64 instead 
QEMU emulator version 1.4.0 (Debian 1.4.0+dfsg-1expubuntu4), Copyright (c) 2003-2008 Fabrice Bellard 
# libvirtd --version 
libvirtd (libvirt) 1.0.2 | 
on the BSD VM 
| 
bsd# cp /usr/share/examples/cvsup/standard-supfile /root/ 
bsd# cd /root/ | 
edit standard-supfile
from
| 
*default host=CHANGE_THIS.FreeBSD.org | 
to
| 
*default host=cvsup10.FreeBSD.org | 
build virtio drivers
| 
bsd# csup ./standard-supfile 
# cd  /usr/ports/emulators/virtio-kmod/ 
# make 
# make install 
# make clean | 
create a loader.conf file to load virtio drivers
| 
# cat /boot/loader.conf 
virtio_load="YES" 
virtio_pci_load="YES" 
virtio_blk_load="YES" 
if_vtnet_load="YES" 
virtio_balloon_load="YES" | 
reboot the VM to confirm if BSD loads virtio drivers. 
| 
# shutdown -r now | 
after rebooting the OS
| 
# dmesg | grep -i virtio 
virtio_pci0: <VirtIO PCI Balloon adapter> port 0xc060-0xc07f irq 10 at device 5.0 on pci0 
vtballoon0: <VirtIO Balloon Adapter> on virtio_pci0 
virtio_pci0: host features: 0x71000002 <EventIdx,RingIndirect,NotifyOnEmpty,StatsVq> 
virtio_pci0: negotiated features: 0x0 | 
If your VM can load virtio drivers successfuly , edit /etc/rc.conf and /etc/fstab to use virtio drivers
on the BSD VM ( this is for vNIC )
| 
# cat /etc/rc.conf 
hostname="bsd90" 
keymap="jp.106.kbd" 
ifconfig_em0="DHCP" 
sshd_enable="YES" 
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable 
dumpdev="AUTO" 
ifconfig_vtnet0_name="em0" | 
on the BSD VM ( this is for vHDD )
| 
# cat /etc/fstab 
# Device        Mountpoint      FStype  Options Dump    Pass# 
#/dev/ada0p2    /               ufs     rw      1       1 
/dev/vtbd0p2    /               ufs     rw      1       1 
/dev/ada0p3     none            swap    sw      0       0 | 
shutdown the VM
| 
# shutdown –p now | 
on the KVM host , start virt-manager and change driver of the BSD VM to virtio
vNIC
vHDD
click apply and then start the VM
on the VM
| 
# kldstat 
Id Refs Address            Size     Name 
 1   12 0xffffffff80200000 11cdab0  kernel 
 2    5 0xffffffff813ce000 4e38     virtio.ko 
 3    1 0xffffffff813d3000 5868     virtio_pci.ko 
 4    1 0xffffffff813d9000 52d8     virtio_blk.ko 
 5    1 0xffffffff813df000 ad80     if_vtnet.ko 
 6    1 0xffffffff813ea000 31f8     virtio_balloon.ko | 

No comments:
Post a Comment
Note: Only a member of this blog may post a comment.