Port for package building of virtio kernel lodable modules.

This port support only 8.2 and 9.0 releases.

WWW: http://people.FreeBSD.org/~kuriyama/virtio/

Feature safe:	yes
This commit is contained in:
Jun Kuriyama 2011-11-21 15:15:54 +00:00
parent 2e84009fda
commit a84067960d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=286189
5 changed files with 102 additions and 0 deletions

View file

@ -161,6 +161,7 @@
SUBDIR += vgb-bin
SUBDIR += vgba-bin
SUBDIR += vice
SUBDIR += virtio-kmod
SUBDIR += virtualbox-ose
SUBDIR += virtualbox-ose-additions
SUBDIR += virtualbox-ose-kmod

View file

@ -0,0 +1,58 @@
# New ports collection makefile for: virtio-kmod
# Date created: 20 Nov 2011
# Whom: Jun Kuriyama <kuriyama@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= virtio
PORTVERSION= 0.${SVN_REV}
CATEGORIES= emulators
MASTER_SITES= # none
PKGNAMESUFFIX= -kmod
DISTFILES= # none
MAINTAINER= kuriyama@FreeBSD.org
COMMENT= virtio kernel modules port for 8.2/9.0
FETCH_DEPENDS= svn:${PORTSDIR}/devel/subversion
ONLY_FOR_ARCHS= amd64 i386
WRKSRC= ${WRKDIR}
SVN_REV= 227652
SVN_MIRROR?= http://svn.freebsd.org/base
KMODDIR?= modules
PLIST_SUB= KMODDIR=${KMODDIR}
SVN= ${LOCALBASE}/bin/svn
.if !exists(${SRC_BASE}/sys/Makefile)
IGNORE= requires kernel source to be installed
.endif
.include <bsd.port.pre.mk>
.if ${OSREL} != "8.2" && ${OSREL} != "9.0"
IGNORE= not supported $${OSREL} (${OSREL})
.endif
do-extract:
${MKDIR} ${WRKSRC}
${CP} -Rp ${SRC_BASE}/sys ${WRKSRC}/
cd ${WRKSRC}/sys/dev && ${SVN} co -r ${SVN_REV} ${SVN_MIRROR}/head/sys/dev/virtio
cd ${WRKSRC}/sys/modules && ${SVN} co -r ${SVN_REV} ${SVN_MIRROR}/head/sys/modules/virtio
do-build:
cd ${WRKSRC}/sys/modules/virtio; ${MAKE} DEBUG_FLAGS=-g
do-install:
${MKDIR} ${PREFIX}/${KMODDIR}
.for f in pci/virtio_pci virtio/virtio block/virtio_blk balloon/virtio_balloon network/if_vtnet
${INSTALL_KLD} ${WRKSRC}/sys/modules/virtio/${f}.ko ${PREFIX}/${KMODDIR}/
${INSTALL_KLD} ${WRKSRC}/sys/modules/virtio/${f}.ko.symbols ${PREFIX}/${KMODDIR}/
.endfor
post-install:
${CAT} ${PKGMESSAGE}
.include <bsd.port.post.mk>

View file

@ -0,0 +1,5 @@
Port for package building of virtio kernel lodable modules.
This port support only 8.2 and 9.0 releases.
WWW: http://people.FreeBSD.org/~kuriyama/virtio/

View file

@ -0,0 +1,27 @@
To use these modules, copy into /boot/kernel directory:
# cp -Rp ${PREFIX}/modules/* /boot/kernel/
# kldxref /boot/kernel
and add loading lines in /boot/loader.conf:
virtio_load="YES"
virtio_pci_load="YES"
virtio_blk_load="YES"
if_vtnet_load="YES"
virtio_balloon_load="YES"
and edit fstab and interface config in rc.conf:
# sed -i.bak -e 's|/dev/ada?/|/dev/vtbd/|' /etc/fstab
# sed -i.bak -e 's|em0|vtnet0|' /etc/rc.conf
and enable virtio devices in host's domain.xml:
- <target dev='hda' bus='ide'/>
+ <target dev='vda' bus='virtio'/>
...
- <model type='e1000'/>
- <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

View file

@ -0,0 +1,11 @@
%%KMODDIR%%/if_vtnet.ko
%%KMODDIR%%/if_vtnet.ko.symbols
%%KMODDIR%%/virtio.ko
%%KMODDIR%%/virtio.ko.symbols
%%KMODDIR%%/virtio_balloon.ko
%%KMODDIR%%/virtio_balloon.ko.symbols
%%KMODDIR%%/virtio_blk.ko
%%KMODDIR%%/virtio_blk.ko.symbols
%%KMODDIR%%/virtio_pci.ko
%%KMODDIR%%/virtio_pci.ko.symbols
@dirrmtry %%KMODDIR%%