blob: a3b913c88a3d52ddea59861172e5843936824ae6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: 2007/10/02 19:00:00 philantrop Exp $
inherit linux-mod eutils
DESCRIPTION="KVM is a full virtualisation solution for Linux on hardware containing virtualization extensions (Intel VT or AMD-V)"
HOMEPAGE="http://kvm.qumranet.com/kvmwiki"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=">=media-libs/libsdl-1.2.11
>=media-libs/alsa-lib-1.0.13
app-text/texi2html
!app-emulation/qemu
dev-lang/python
>=sys-fs/e2fsprogs-1.39"
RDEPEND="${DEPEND}
sys-apps/usermode-utilities"
RESTRICT="strip"
BUILD_TARGETS="all"
MODULE_NAMES="kvm(extra:"${S}"/kernel:"${S}"/kernel)
kvm-intel(extra:"${S}"/kernel:"${S}"/kernel)
kvm-amd(extra:"${S}"/kernel:"${S}"/kernel)"
QA_TEXTRELS="usr/bin/qemu
usr/bin/qemu-system-sparc
usr/bin/qemu-system-arm
usr/bin/qemu-system-ppc
usr/bin/qemu-system-mips
usr/bin/qemu-system-x86_64"
QA_EXECSTACK="usr/share/kvm/openbios-sparc32"
QA_WX_LOAD="usr/share/kvm/openbios-sparc32"
src_unpack() {
# Don't continue if the KVM modules that come with the kernel are compiled
if linux_chkconfig_present KVM ; then
eerror "${P} doesn't work with the kernel modules"
die "${PN} module is included in the kernel"
fi
unpack ${A}
cd "${S}"
# Change script to change some options.
epatch "${FILESDIR}/kvm-kvm.patch"
# Improve the ifup script to allow for non-root use, etc.
epatch "${FILESDIR}/scripts-qemu-ifup.patch"
# Change the path to the network stuff to /etc/kvm
epatch "${FILESDIR}/qemu-vl.c.patch"
# Change the DATADIR to kvm instead of qemu
epatch "${FILESDIR}/${P}-qemu_configure.patch"
}
src_compile() {
# fix make install to not install modules
sed -i -e '/$(kcmd)/d' "${WORKDIR}/${P}/Makefile"
# The included qemu is not intended to run without kvm. Thus, we can use
# gcc4 as well and disable the gcc-check for gcc3.
conf_opts="--prefix=/usr --disable-gcc-check --qemu-cc=gcc"
linux-mod_pkg_setup
# Non-standard configure script. So econf doesn't work here.
./configure ${conf_opts} || die "Configure failed"
linux-mod_src_compile
emake user qemu || die "make failed"
}
src_install() {
# fix make install to not install modules
sed -i -e '/$(kcmd)/d' "${WORKDIR}/${P}/Makefile"
emake DESTDIR="${D}" install || die "make install failed"
linux-mod_src_install
exeinto /usr/bin/
doexe "${S}/kvm" "${S}/kvm_stat"
mv "${D}/usr/share/doc/qemu" "${D}/usr/share/doc/kvm"
mv "${D}/usr/share/man/man1/qemu.1" "${D}/usr/share/man/man1/kvm.1"
insinto /etc/udev/rules.d/
doins "${WORKDIR}/${P}/scripts/65-kvm.rules"
insinto /etc/kvm/
insopts -m0755
doins "${WORKDIR}/${P}/scripts/qemu-ifup"
}
pkg_postinst() {
linux-mod_pkg_postinst
enewgroup kvm
elog "Make sure you have the kernel module loaded before running kvm."
elog "The easiest way to ensure that the kernel module is loaded is to load it"
elog "on boot."
elog "For AMD CPUs:"
elog "echo kvm-amd >> /etc/modules.autoload.d/kernel-2.6"
elog "For Intel CPUs:"
elog "echo kvm-intel >> /etc/modules.autoload.d/kernel-2.6"
echo
elog "Make sure your user is in the 'kvm' group"
elog "Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
echo
elog "If qemu complains about not having a 1024 Hz timer, then run this:"
elog "echo dev.rtc.max-user-freq=1024 >> /etc/sysctl.conf"
echo
elog "If you want network support in the guest OS, you'll need to make"
elog "sure you compile in support for 802.1d Ethernet Bridging in the "
elog "kernel, set up a bridge network interface and make sure you"
elog "compile Universal TUN/TAP device driver support as a kernel module"
elog "and make it load on boot:"
elog "echo tun >> /etc/modules.autoload.d/kernel-2.6"
}
|