From 7192accaa7323882b8a531f9e0f4df368f82f1bd Mon Sep 17 00:00:00 2001 From: Edward Koenig Date: Sun, 14 Apr 2013 12:56:35 -0500 Subject: system/qemu: Updated for version 1.4.0. Signed-off-by: Robby Workman --- system/qemu/65-kvm.rules | 2 ++ system/qemu/README | 29 +++++++++++------- system/qemu/qemu.SlackBuild | 73 ++++++++++++++++++++++++++++++++++----------- system/qemu/qemu.info | 10 +++---- 4 files changed, 82 insertions(+), 32 deletions(-) create mode 100644 system/qemu/65-kvm.rules diff --git a/system/qemu/65-kvm.rules b/system/qemu/65-kvm.rules new file mode 100644 index 0000000000..3c11863c57 --- /dev/null +++ b/system/qemu/65-kvm.rules @@ -0,0 +1,2 @@ +KERNEL=="kvm", GROUP="@GROUP@", MODE="0660" +KERNEL=="vhost-net", GROUP="@GROUP@", MODE="0660" diff --git a/system/qemu/README b/system/qemu/README index 253779d6ea..514b17ff6c 100644 --- a/system/qemu/README +++ b/system/qemu/README @@ -4,15 +4,24 @@ When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performances. -When used as a virtualizer, QEMU achieves near native performances by -executing the guest code directly on the host CPU. A host driver called -the QEMU accelerator (also known as KQEMU) is needed in this case -(contained in the optional dependency kqemu). The virtualizer mode -requires that both the host and guest machine use x86 compatible -processors. +qemu-kvm achieves near native performances by leveraging the kvm-kmod +modules and executing the guest code directly on the host CPU. +Slackware provides pre-built 32/64 bit x86 kvm-kmod modules or you can +build different versions with the kvm-kmod package. +qemu-kvm code has been merged back into qemu since version 1.3.0. -NOTE: -qemu builds man-pages at compile-time; to do so, /sbin must be in the -current $PATH. Be sure to run the script as root ( "su -" ). +By default, this script builds only the x86 and arm emulation targets +for qemu; if you prefer to build all supported targets, do this: -spice is an optional dependency. + TARGETS=all ./qemu.SlackBuild + +We patch the installed udev rules to require membership in "users" +group instead of a custom "kvm" group to uses /dev/kvm. If you prefer +something different, then run the build script like this: + + KVMGROUP=group ./qemu.SlackBuild + +Don't forget to load the 'kvm-intel' or 'kvm-amd' module (depending on +your processor) prior to launching qemu-system-x86_64 with kvm enabled. + +spice and usbredir are optional dependencies. diff --git a/system/qemu/qemu.SlackBuild b/system/qemu/qemu.SlackBuild index 1117f6737b..3b9f7888eb 100644 --- a/system/qemu/qemu.SlackBuild +++ b/system/qemu/qemu.SlackBuild @@ -3,6 +3,7 @@ # Slackware build script for qemu # Copyright 2009, 2010 Andrew Brouwers +# Copyright 2013 Edward Koenig, Vancouver, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,10 +23,15 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Modified by the SlackBuilds.org project +# Changelog +# 1.0 27-FEB-2013 New SBo maintainer +# 1.0 07-MAR-2013 updated to 1.4, includes qemu-kvm; thanks to +# rworkman and ponce for script ideas. +# 1.1 28-MAR-2013 fix missing docs per C. Willing and +# add missing --libdir (patched in qemu-trivial upstream) PRGNAM=qemu -VERSION=${VERSION:-1.2.0} +VERSION=${VERSION:-1.4.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -45,17 +51,33 @@ OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" + KVMARCH="i386" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" + KVMARCH="i386" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" + KVMARCH="x86_64" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi +# Enable only x86* and arm emulation for qemu: if you want to build +# all the targets available use TARGETS=all +if [ "${TARGETS:-}" = "all" ]; then + targets="" +else + targets="--target-list=i386-softmmu,x86_64-softmmu,i386-linux-user,x86_64-linux-user,arm-softmmu,arm-linux-user,armeb-linux-user" +fi + +KVMGROUP=${KVMGROUP:-users} + +# Needed to build man pages if built after plain "su" +export PATH=$PATH:/usr/share/texmf/bin + set -e rm -rf $PKG @@ -67,38 +89,55 @@ cd $PRGNAM-$VERSION chown -R root:root . chmod -R u+w,go+r-w,a-s . -# To get the stable-1.0 patches, do this in git checkout of qemu: -# git format-patch v1.0.1..origin/stable-1.0 -#for i in $CWD/patches/*.patch ; do patch -p1 < $i ; done - -# Disable debug (hardcoded) and remove double CFLAGS -sed -i "s|^CFLAGS=\"-g\ |CFLAGS=\"|" configure -sed -i "s|^LDFLAGS=\"-g\ |LDFLAGS=\"|" configure -sed -i "s|^\ \ CFLAGS=\"-O2\ | CFLAGS=\"|" configure +# Remove double CFLAGS +sed -i "s|^\ \ CFLAGS=\"-O2\ | CFLAGS=\"|" configure || exit 1 -# check if spice support is enabled +# check if spice is there if pkg-config --exists spice-server ; then with_spice="--enable-spice" else with_spice="--disable-spice" fi -# --libdir isn't recognized and isn't needed anyway +# check if usbredir is there +if pkg-config --exists libusbredirhost ; then + with_usbredir="--enable-usb-redir" +else + with_usbredir="--disable-usb-redir" +fi + +# --libdir is recognized but not advertised in --help CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ - --enable-system \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ --sysconfdir=/etc \ + --enable-system \ + --enable-kvm \ + --enable-mixemu \ + --disable-debug-info \ --audio-drv-list=alsa,oss,sdl,esd \ - $with_spice + --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus,hda \ + $targets \ + $with_spice \ + $with_usbredir + +make V=1 OS_CFLAGS="$SLKCFLAGS" -make OS_CFLAGS="$SLKCFLAGS" make install DESTDIR=$PKG +# install some udev rules for /dev/kvm +mkdir -p $PKG/lib/udev/rules.d/ +sed "s/@GROUP@/$KVMGROUP/" $CWD/65-kvm.rules \ + > $PKG/lib/udev/rules.d/65-kvm.rules + find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# create a symlink for qemu-kvm to support aqemu and such frontends +[ ! -z $KVMARCH ] && ln -s qemu-system-$KVMARCH $PKG/usr/bin/qemu-kvm + # move any generated man pages to their proper location if [ -d $PKG/usr/share/man ]; then mv $PKG/usr/share/man $PKG/usr @@ -107,8 +146,8 @@ fi # Add docs, and if present, built documentation to the proper location mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a TODO README LICENSE COPYING COPYING.LIB MAINTAINERS \ - $PKG/usr/doc/$PRGNAM-$VERSION +cp -a TODO README LICENSE COPYING COPYING.LIB MAINTAINERS $PKG/usr/doc/$PRGNAM-$VERSION +cp -a docs/* $PKG/usr/doc/$PRGNAM-$VERSION if [ -d $PKG/usr/share/doc ]; then mv $PKG/usr/share/doc/qemu/* $PKG/usr/doc/$PRGNAM-$VERSION/ rm -rf $PKG/usr/share/doc diff --git a/system/qemu/qemu.info b/system/qemu/qemu.info index 6b8e0a9d98..e7d33915ca 100644 --- a/system/qemu/qemu.info +++ b/system/qemu/qemu.info @@ -1,10 +1,10 @@ PRGNAM="qemu" -VERSION="1.2.0" +VERSION="1.4.0" HOMEPAGE="http://wiki.qemu.org/Main_Page" -DOWNLOAD="http://wiki.qemu.org/download/qemu-1.2.0.tar.bz2" -MD5SUM="78eb1e984f4532aa9f2bdd3c127b5b61" +DOWNLOAD="http://wiki.qemu.org/download/qemu-1.4.0.tar.bz2" +MD5SUM="78f13b774814b6b7ebcaf4f9b9204318" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Andrew Brouwers" -EMAIL="abrouwers@gmail.com" +MAINTAINER="Edward Koenig" +EMAIL="kingbeowulf@gmail.com" -- cgit v1.2.3