diff options
author | Michał Pałka <michal.palka@chalmers.se> | 2017-05-11 10:12:47 +0000 |
---|---|---|
committer | Michał Pałka <michal.palka@chalmers.se> | 2017-06-27 12:01:53 +0000 |
commit | 9e6bfbb2f92d8e1995365775bee63809631b132c (patch) | |
tree | 0b24721a8ea1877ee3acc04c658ff1ef7ded29b7 /pkgs/applications/virtualization/xen | |
parent | 4c0203b094c5a4d334daaf4ab8c6dc98c67fa8d0 (diff) | |
download | nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar.gz nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar.bz2 nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar.lz nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar.xz nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.tar.zst nixlib-9e6bfbb2f92d8e1995365775bee63809631b132c.zip |
xen_4_8: init at 4.8.1
This commit adds the xen_4_8 package to be used instead of xen (currently at 4.5.5): * Add packages xen_4_8, xen_4_8-slim and xen_4_8-light * Add packages qemu_xen_4_8 and qemu_xen_4_8-light to be used with xen_4_8-slim and xen_4_8-light respectively. * Add systemd to buildInputs of xen (it is required by oxenstored) * Adapt xen service to work with the new version of xen * Use xen-init-dom0 to initlilise dom0 in xen-store * Currently, the virtualisation.xen.stored option is ignored if xen 4.8 is used
Diffstat (limited to 'pkgs/applications/virtualization/xen')
-rw-r--r-- | pkgs/applications/virtualization/xen/4.8.nix | 165 | ||||
-rw-r--r-- | pkgs/applications/virtualization/xen/generic.nix | 23 | ||||
-rw-r--r-- | pkgs/applications/virtualization/xen/packages.nix | 50 |
3 files changed, 230 insertions, 8 deletions
diff --git a/pkgs/applications/virtualization/xen/4.8.nix b/pkgs/applications/virtualization/xen/4.8.nix new file mode 100644 index 000000000000..487758719e74 --- /dev/null +++ b/pkgs/applications/virtualization/xen/4.8.nix @@ -0,0 +1,165 @@ +{ stdenv, callPackage, fetchurl, fetchpatch, fetchgit +, withInternalQemu ? true +, withInternalTraditionalQemu ? true +, withInternalSeabios ? true +, withSeabios ? !withInternalSeabios, seabios ? null +, withInternalOVMF ? false # FIXME: tricky to build +, withOVMF ? false, OVMF +, withLibHVM ? true + +# qemu +, udev, pciutils, xorg, SDL, pixman, acl, glusterfs, spice_protocol, usbredir +, alsaLib +, ... } @ args: + +assert withInternalSeabios -> !withSeabios; +assert withInternalOVMF -> !withOVMF; + +with stdenv.lib; + +# Patching XEN? Check the XSAs at +# https://xenbits.xen.org/xsa/ +# and try applying all the ones we don't have yet. + +let + xsaPatch = { name , sha256 }: (fetchpatch { + url = "https://xenbits.xen.org/xsa/xsa${name}.patch"; + inherit sha256; + }); + + qemuDeps = [ + udev pciutils xorg.libX11 SDL pixman acl glusterfs spice_protocol usbredir + alsaLib + ]; +in + +callPackage (import ./generic.nix (rec { + version = "4.8.1"; + + src = fetchurl { + url = "http://bits.xensource.com/oss-xen/release/${version}/xen-${version}.tar.gz"; + sha256 = "158kb1w61jmwxi3fc560s4269hhpxrin9xhm60ljj52njhxias8x"; + }; + + # Sources needed to build tools and firmwares. + xenfiles = optionalAttrs withInternalQemu { + "qemu-xen" = { + src = fetchgit { + url = https://xenbits.xen.org/git-http/qemu-xen.git; + rev = "refs/tags/qemu-xen-${version}"; + sha256 = "1v19pp86kcgwvsbkrdrn4rlaj02i4054avw8k70w1m0rnwgcsdbs"; + }; + buildInputs = qemuDeps; + patches = [ + #(xsaPatch { + # name = "197-4.5-qemuu"; + # sha256 = "09gp980qdlfpfmxy0nk7ncyaa024jnrpzx9gpq2kah21xygy5myx"; + #}) + ]; + meta.description = "Xen's fork of upstream Qemu"; + }; + } // optionalAttrs withInternalTraditionalQemu { + "qemu-xen-traditional" = { + src = fetchgit { + url = https://xenbits.xen.org/git-http/qemu-xen-traditional.git; + rev = "refs/tags/xen-${version}"; + sha256 = "0mryap5y53r09m7qc0b821f717ghwm654r8c3ik1w7adzxr0l5qk"; + }; + buildInputs = qemuDeps; + patches = [ + ]; + postPatch = '' + substituteInPlace xen-hooks.mak \ + --replace /usr/include/pci ${pciutils}/include/pci + ''; + meta.description = "Xen's fork of upstream Qemu that uses old device model"; + }; + } // optionalAttrs withInternalSeabios { + "firmware/seabios-dir-remote" = { + src = fetchgit { + url = https://xenbits.xen.org/git-http/seabios.git; + rev = "f0cdc36d2f2424f6b40438f7ee7cc502c0eff4df"; + sha256 = "1wq5pjkjrfzqnq3wyr15mcn1l4c563m65gdyf8jm97kgb13pwwfm"; + }; + patches = [ ./0000-qemu-seabios-enable-ATA_DMA.patch ]; + meta.description = "Xen's fork of Seabios"; + }; + } // optionalAttrs withInternalOVMF { + "firmware/ovmf-dir-remote" = { + src = fetchgit { + url = https://xenbits.xen.org/git-http/ovmf.git; + rev = "173bf5c847e3ca8b42c11796ce048d8e2e916ff8"; + sha256 = "07zmdj90zjrzip74fvd4ss8n8njk6cim85s58mc6snxmqqv7gmcr"; + }; + meta.description = "Xen's fork of OVMF"; + }; + } // { + # TODO: patch Xen to make this optional? + "firmware/etherboot/ipxe.git" = { + src = fetchgit { + url = https://git.ipxe.org/ipxe.git; + rev = "356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d"; + sha256 = "15n400vm3id5r8y3k6lrp9ab2911a9vh9856f5gvphkazfnmns09"; + }; + meta.description = "Xen's fork of iPXE"; + }; + } // optionalAttrs withLibHVM { + "xen-libhvm-dir-remote" = { + src = fetchgit { + name = "xen-libhvm"; + url = https://github.com/michalpalka/xen-libhvm; + rev = "83065d36b36d6d527c2a4e0f5aaf0a09ee83122c"; + sha256 = "1jzv479wvgjkazprqdzcdjy199azmx2xl3pnxli39kc5mvjz3lzd"; + }; + buildPhase = '' + make + cd biospt + cc -Wall -g -D_LINUX -Wstrict-prototypes biospt.c -o biospt -I../libhvm -L../libhvm -lxenhvm + ''; + installPhase = '' + make install + cp biospt/biospt $out/bin/ + ''; + meta = { + description = '' + Helper library for reading ACPI and SMBIOS firmware values + from the host system for use with the HVM guest firmware + pass-through feature in Xen''; + license = licenses.bsd2; + }; + }; + }; + + configureFlags = [] + ++ optional (!withInternalQemu) "--with-system-qemu" # use qemu from PATH + ++ optional (withInternalTraditionalQemu) "--enable-qemu-traditional" + ++ optional (!withInternalTraditionalQemu) "--disable-qemu-traditional" + + ++ optional (withSeabios) "--with-system-seabios=${seabios}" + ++ optional (!withInternalSeabios && !withSeabios) "--disable-seabios" + + ++ optional (withOVMF) "--with-system-ovmf=${OVMF.fd}/FV/OVMF.fd" + ++ optional (withInternalOVMF) "--enable-ovmf"; + + patches = + [ (xsaPatch { + name = "213-4.8"; + sha256 = "0ia3zr6r3bqy2h48fdy7p0iz423lniy3i0qkdvzgv5a8m80darr2"; + }) + (xsaPatch { + name = "214"; + sha256 = "0qapzx63z0yl84phnpnglpkxp6b9sy1y7cilhwjhxyigpfnm2rrk"; + }) + ]; + + # Fix build on Glibc 2.24. + NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; + + postPatch = '' + # Avoid a glibc >= 2.25 deprecation warnings that get fatal via -Werror. + sed 1i'#include <sys/sysmacros.h>' \ + -i tools/blktap2/control/tap-ctl-allocate.c \ + -i tools/libxl/libxl_device.c + ''; + +})) args diff --git a/pkgs/applications/virtualization/xen/generic.nix b/pkgs/applications/virtualization/xen/generic.nix index b0b353c5fa28..434853b7cc12 100644 --- a/pkgs/applications/virtualization/xen/generic.nix +++ b/pkgs/applications/virtualization/xen/generic.nix @@ -14,7 +14,7 @@ config: # Scripts , coreutils, gawk, gnused, gnugrep, diffutils, multipath-tools , iproute, inetutils, iptables, bridge-utils, openvswitch, nbd, drbd -, lvm2, utillinux, procps +, lvm2, utillinux, procps, systemd # Documentation # python2Packages.markdown @@ -61,7 +61,7 @@ stdenv.mkDerivation (rec { libiconv libuuid ncurses openssl perl python2Packages.python xz yajl zlib # oxenstored - ocamlPackages.findlib ocamlPackages.ocaml + ocamlPackages.findlib ocamlPackages.ocaml systemd # Python fixes python2Packages.wrapPython @@ -153,12 +153,19 @@ stdenv.mkDerivation (rec { substituteInPlace tools/xenstat/Makefile \ --replace /usr/include/curses.h ${ncurses.dev}/include/curses.h - # TODO: use this as a template and support our own if-up scripts instead? - substituteInPlace tools/hotplug/Linux/xen-backend.rules.in \ - --replace "@XEN_SCRIPT_DIR@" $out/etc/xen/scripts + ${optionalString (config.version >= "4.8") '' + substituteInPlace tools/hotplug/Linux/launch-xenstore.in \ + --replace /bin/mkdir mkdir + ''} - # blktap is not provided by xen, but by xapi - sed -i '/blktap/d' tools/hotplug/Linux/xen-backend.rules.in + ${optionalString (config.version < "4.6") '' + # TODO: use this as a template and support our own if-up scripts instead? + substituteInPlace tools/hotplug/Linux/xen-backend.rules.in \ + --replace "@XEN_SCRIPT_DIR@" $out/etc/xen/scripts + + # blktap is not provided by xen, but by xapi + sed -i '/blktap/d' tools/hotplug/Linux/xen-backend.rules.in + ''} ${withTools "patches" (name: x: '' ${concatMapStringsSep "\n" (p: '' @@ -191,7 +198,7 @@ stdenv.mkDerivation (rec { ''; installPhase = '' - mkdir -p $out $out/share + mkdir -p $out $out/share $out/share/man cp -prvd dist/install/nix/store/*/* $out/ cp -prvd dist/install/boot $out/boot cp -prvd dist/install/etc $out diff --git a/pkgs/applications/virtualization/xen/packages.nix b/pkgs/applications/virtualization/xen/packages.nix index 633ec4f3d124..8f5262acb024 100644 --- a/pkgs/applications/virtualization/xen/packages.nix +++ b/pkgs/applications/virtualization/xen/packages.nix @@ -57,6 +57,56 @@ rec { }; }; + xen_4_8-vanilla = callPackage ./4.8.nix { + # At the very least included seabios and etherboot need gcc49, + # so we have to build all of it with gcc49. + stdenv = overrideCC stdenv gcc49; + + meta = { + description = "vanilla"; + longDescription = '' + Vanilla version of Xen. Uses forks of Qemu and Seabios bundled + with Xen. This gives vanilla experince, but wastes space and + build time: typical NixOS setup that runs lots of VMs will + build three different versions of Qemu when using this (two + forks and upstream). + ''; + }; + }; + + xen_4_8-slim = xen_4_8-vanilla.override { + withInternalQemu = false; + withInternalTraditionalQemu = true; + withInternalSeabios = false; + withSeabios = true; + + meta = { + description = "slim"; + longDescription = '' + Slimmed-down version of Xen that reuses nixpkgs packages as + much as possible. Different parts may get out of sync, but + this builds faster and uses less space than vanilla. Use with + `qemu_xen` from nixpkgs. + ''; + }; + }; + + xen_4_8-light = xen_4_8-vanilla.override { + withInternalQemu = false; + withInternalTraditionalQemu = false; + withInternalSeabios = false; + withSeabios = true; + + meta = { + description = "light"; + longDescription = '' + Slimmed-down version of Xen without `qemu-traditional` (you + don't need it if you don't know what it is). Use with + `qemu_xen-light` from nixpkgs. + ''; + }; + }; + xen-vanilla = xen_4_5-vanilla; xen-slim = xen_4_5-slim; xen-light = xen_4_5-light; |