diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index e1ae4df44439..3a6cdb6f8c60 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl, python, zlib, pkgconfig, glib, ncurses, perl, pixman , attr, libcap, vde2, alsaLib, texinfo, libuuid +, makeWrapper , sdlSupport ? true, SDL , vncSupport ? true, libjpeg, libpng , spiceSupport ? true, spice, spice_protocol @@ -16,7 +17,7 @@ stdenv.mkDerivation rec { buildInputs = [ python zlib pkgconfig glib ncurses perl pixman attr libcap - vde2 alsaLib texinfo libuuid + vde2 alsaLib texinfo libuuid makeWrapper ] ++ stdenv.lib.optionals sdlSupport [ SDL ] ++ stdenv.lib.optionals vncSupport [ libjpeg libpng ] @@ -31,6 +32,15 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional spiceSupport "--enable-spice" ++ stdenv.lib.optional x86Only "--target-list=i386-softmmu,x86_64-softmmu"; + postInstall = + '' + # Add a ‘qemu-kvm’ wrapper for compatibility/convenience. + p="$out/bin/qemu-system-${if stdenv.system == "x86_64-linux" then "x86_64" else "i386"}" + if [ -e "$p" ]; then + makeWrapper "$p" $out/bin/qemu-kvm --add-flags "-enable-kvm" + fi + ''; + meta = { homepage = http://www.qemu.org/; description = "A generic and open source machine emulator and virtualizer"; diff --git a/pkgs/os-specific/linux/qemu-kvm/default.nix b/pkgs/os-specific/linux/qemu-kvm/default.nix deleted file mode 100644 index 2f93769d2801..000000000000 --- a/pkgs/os-specific/linux/qemu-kvm/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ stdenv, fetchurl, attr, zlib, SDL, alsaLib, pkgconfig, pciutils, libuuid, vde2 -, libjpeg, libpng, ncurses, python, glib, libaio, mesa, perl, texinfo -, spice, spice_protocol, spiceSupport ? false }: - -assert stdenv.isLinux; - -let version = "1.2.0"; in - -stdenv.mkDerivation rec { - name = "qemu-kvm-${version}"; - - src = fetchurl { - url = "mirror://sourceforge/kvm/qemu-kvm/${version}/${name}.tar.gz"; - sha256 = "018vb5nmk2fsm143bs2bl2wirhasd4b10d7jchl32zik4inbk2p9"; - }; - - buildInputs = - [ attr zlib SDL alsaLib pkgconfig pciutils libuuid vde2 libjpeg libpng - ncurses python glib libaio mesa texinfo perl - ] ++ stdenv.lib.optionals spiceSupport [ spice_protocol spice ]; - - patches = [ ./fix-librt-check.patch ./fix-usb-passthrough.patch ]; - - postPatch = '' - patchShebangs . - sed '/qtest_add_func.*check_time/d' -i tests/rtc-test.c - '' # disable tests that meddle with system time, they seem to work bad, maybe due to newer glib - + stdenv.lib.optionalString spiceSupport '' - for i in configure spice-qemu-char.c ui/spice-input.c ui/spice-core.c ui/qemu-spice.h; do - substituteInPlace $i --replace '#include ' '#include ' - done - ''; - - configureFlags = - [ "--audio-drv-list=alsa" - "--smbd=smbd" # use `smbd' from $PATH - "--enable-docs" - "--python=${python}/bin/python" - ] ++ stdenv.lib.optional spiceSupport "--enable-spice"; - - postInstall = - '' - # Libvirt expects us to be called `qemu-kvm'. Otherwise it will - # set the domain type to "qemu" rather than "kvm", which can - # cause architecture selection to misbehave. - ln -sv $(cd $out/bin && echo qemu-system-*) $out/bin/qemu-kvm - ''; - - doCheck = true; - - enableParallelBuilding = true; - - meta = { - homepage = http://www.linux-kvm.org/; - description = "A full virtualization solution for Linux on x86 hardware containing virtualization extensions"; - platforms = stdenv.lib.platforms.linux; - }; -} diff --git a/pkgs/os-specific/linux/qemu-kvm/fix-librt-check.patch b/pkgs/os-specific/linux/qemu-kvm/fix-librt-check.patch deleted file mode 100644 index 57de288723e8..000000000000 --- a/pkgs/os-specific/linux/qemu-kvm/fix-librt-check.patch +++ /dev/null @@ -1,72 +0,0 @@ -commit 8bacde8d86a09699207d85d4bab06162aed18dc4 -Author: Natanael Copa -Date: Wed Sep 12 09:06:51 2012 +0000 - - configure: properly check if -lrt and -lm is needed - - Fixes build against uClibc. - - uClibc provides 2 versions of clock_gettime(), one with realtime - support and one without (this is so you can avoid linking in -lrt - unless actually needed). This means that the clock_gettime() don't - need -lrt. We still need it for timer_create() so we check for this - function in addition. - - We also need check if -lm is needed for isnan(). - - Both -lm and -lrt are needed for libs_qga. - - Signed-off-by: Natanael Copa - Signed-off-by: Blue Swirl - -diff --git a/configure b/configure -index 7656c32..9ab13db 100755 ---- a/configure -+++ b/configure -@@ -2671,17 +2671,44 @@ fi - - - ########################################## -+# Do we need libm -+cat > $TMPC << EOF -+#include -+int main(void) { return isnan(sin(0.0)); } -+EOF -+if compile_prog "" "" ; then -+ : -+elif compile_prog "" "-lm" ; then -+ LIBS="-lm $LIBS" -+ libs_qga="-lm $libs_qga" -+else -+ echo -+ echo "Error: libm check failed" -+ echo -+ exit 1 -+fi -+ -+########################################## - # Do we need librt -+# uClibc provides 2 versions of clock_gettime(), one with realtime -+# support and one without. This means that the clock_gettime() don't -+# need -lrt. We still need it for timer_create() so we check for this -+# function in addition. - cat > $TMPC < - #include --int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); } -+int main(void) { -+ timer_create(CLOCK_REALTIME, NULL, NULL); -+ return clock_gettime(CLOCK_REALTIME, NULL); -+} - EOF - - if compile_prog "" "" ; then - : --elif compile_prog "" "-lrt" ; then -+# we need pthread for static linking. use previous pthread test result -+elif compile_prog "" "-lrt $pthread_lib" ; then - LIBS="-lrt $LIBS" -+ libs_qga="-lrt $libs_qga" - fi - - if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ diff --git a/pkgs/os-specific/linux/qemu-kvm/fix-usb-passthrough.patch b/pkgs/os-specific/linux/qemu-kvm/fix-usb-passthrough.patch deleted file mode 100644 index a73df310629d..000000000000 --- a/pkgs/os-specific/linux/qemu-kvm/fix-usb-passthrough.patch +++ /dev/null @@ -1,45 +0,0 @@ -https://bugs.launchpad.net/qemu/+bug/1033727 - -From: Hans de Goede -Date: Wed, 12 Sep 2012 13:08:40 +0000 (+0200) -Subject: uhci: Don't queue up packets after one with the SPD flag set -X-Git-Tag: v1.3.0-rc0~483^2 -X-Git-Url: http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=72a04d0c178f01908d74539230d9de64ffc6da19 -Bug-Debian: http://bugs.debian.org/683983 - -uhci: Don't queue up packets after one with the SPD flag set - -Don't queue up packets after a packet with the SPD (short packet detect) -flag set. Since we won't know if the packet will actually be short until it -has completed, and if it is short we should stop the queue. - -This fixes a miniature photoframe emulating a USB cdrom with the windows -software for it not working. - -Signed-off-by: Hans de Goede -Signed-off-by: Gerd Hoffmann ---- - -diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c -index c7c8786..cdc8bc3 100644 ---- a/hw/usb/hcd-uhci.c -+++ b/hw/usb/hcd-uhci.c -@@ -1000,6 +1000,9 @@ static void uhci_fill_queue(UHCIState *s, UHCI_TD *td) - } - assert(ret == TD_RESULT_ASYNC_START); - assert(int_mask == 0); -+ if (ptd.ctrl & TD_CTRL_SPD) { -+ break; -+ } - plink = ptd.link; - } - } -@@ -1097,7 +1100,7 @@ static void uhci_process_frame(UHCIState *s) - - case TD_RESULT_ASYNC_START: - trace_usb_uhci_td_async(curr_qh & ~0xf, link & ~0xf); -- if (is_valid(td.link)) { -+ if (is_valid(td.link) && !(td.ctrl & TD_CTRL_SPD)) { - uhci_fill_queue(s, &td); - } - link = curr_qh ? qh.link : td.link; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5d06b8732bb9..8c6eae1919e0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6717,7 +6717,7 @@ let "procps-ng" = callPackage ../os-specific/linux/procps-ng { }; - qemu_kvm = callPackage ../os-specific/linux/qemu-kvm { }; + qemu_kvm = qemu.override { x86Only = true; }; firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { };