From 5bec9dc65b46eeb45a63a9f7875b5ddfbb798d10 Mon Sep 17 00:00:00 2001 From: Ambroz Bizjak Date: Sat, 4 May 2019 16:18:39 +0200 Subject: [PATCH] virtualbox: 5.2.28 -> 6.0.6 Quite some fixing was needed to get this to work. Changes in VirtualBox and additions: - VirtualBox is no longer officially supported on 32-bit hosts so i686-linux is removed from platforms for VirtualBox and the extension pack. 32-bit additions still work. - There was a refactoring of kernel module makefiles and two resulting bugs affected us which had to be patched. These bugs were reported to the bug tracker (see comments near patches). - The Qt5X11Extras makefile patch broke. Fixed it to apply again, making the libraries logic simpler and more correct (it just uses a different base path instead of always linking to Qt5X11Extras). - Added a patch to remove "test1" and "test2" kernel messages due to forgotten debugging code. - virtualbox-host NixOS module: the VirtualBoxVM executable should be setuid not VirtualBox. This matches how the official installer sets it up. - Additions: replaced a for loop for installing kernel modules with just a "make install", which seems to work without any of the things done in the previous code. - Additions: The package defined buildCommand which resulted in phases not running, including RUNPATH stripping in fixupPhase, and installPhase was defined which was not even run. Fixed this by refactoring using phases. Had to set dontStrip otherwise binaries were broken by stripping. The libdbus path had to be added later in fixupPhase because it is used via dlopen not directly linked. - Additions: Added zlib and libc to patchelf, otherwise runtime library errors result from some binaries. For some reason the missing libc only manifested itself for mount.vboxsf when included in the initrd. Changes in nixos/tests/virtualbox: - Update the simple-gui test to send the right keys to start the VM. With VirtualBox 5 it was enough to just send "return", but with 6 the Tools thing may be selected by default. Send "home" to reliably select Tools, "down" to move to the VM and "return" to start it. - Disable the VirtualBox UART by default because it causes a crash due to a regression in VirtualBox (specific to software virtualization and serial port usage). It can still be enabled using an option but there is an assert that KVM nested virtualization is enabled, which works around the problem (see below). - Add an option to enable nested KVM virtualization, allowing VirtualBox to use hardware virtualization. This works around the UART problem and also allows using 64-bit guests, but requires a kernel module parameter. - Add an option to run 64-bit guests. Tested that the tests pass with that. As mentioned this requires KVM nested virtualization. --- .../virtualisation/virtualbox-host.nix | 2 +- nixos/tests/virtualbox.nix | 42 +++++++-- .../virtualization/virtualbox/default.nix | 19 +++-- .../virtualization/virtualbox/extpack.nix | 6 +- .../virtualbox/fix_kbuild.patch | 12 +++ .../virtualbox/fix_module_makefile_sed.patch | 36 ++++++++ .../virtualbox/fix_printk_test.patch | 14 +++ .../virtualbox/guest-additions/default.nix | 82 ++++++++---------- .../guest-additions/fix_kerndir.patch | 38 --------- .../guest-additions/fix_kernincl.patch | 12 --- .../virtualbox/qtx11extras.patch | 19 +---- pkgs/os-specific/linux/virtualbox/default.nix | 6 -- .../linux/virtualbox/fix_kbuild.patch | 85 ------------------- .../linux/virtualbox/fix_kerndir.patch | 48 ----------- 14 files changed, 146 insertions(+), 275 deletions(-) create mode 100644 pkgs/applications/virtualization/virtualbox/fix_kbuild.patch create mode 100644 pkgs/applications/virtualization/virtualbox/fix_module_makefile_sed.patch create mode 100644 pkgs/applications/virtualization/virtualbox/fix_printk_test.patch delete mode 100644 pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch delete mode 100644 pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch delete mode 100644 pkgs/os-specific/linux/virtualbox/fix_kbuild.patch delete mode 100644 pkgs/os-specific/linux/virtualbox/fix_kerndir.patch diff --git a/nixos/modules/virtualisation/virtualbox-host.nix b/nixos/modules/virtualisation/virtualbox-host.nix index 6f737018174..41bcb909fb5 100644 --- a/nixos/modules/virtualisation/virtualbox-host.nix +++ b/nixos/modules/virtualisation/virtualbox-host.nix @@ -104,7 +104,7 @@ in "VBoxNetNAT" "VBoxSDL" "VBoxVolInfo" - "VirtualBox" + "VirtualBoxVM" ])); users.groups.vboxusers.gid = config.ids.gids.vboxusers; diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index 84d5f3e1530..844ce47d743 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -2,9 +2,26 @@ config ? {}, pkgs ? import ../.. { inherit system config; }, debug ? false, - enableUnfree ? false + enableUnfree ? false, + # Nested KVM virtualization (https://www.linux-kvm.org/page/Nested_Guests) + # requires a modprobe flag on the build machine: (kvm-amd for AMD CPUs) + # boot.extraModprobeConfig = "options kvm-intel nested=Y"; + # Without this VirtualBox will use SW virtualization and will only be able + # to run 32-bit guests. + useKvmNestedVirt ? false, + # Whether to run 64-bit guests instead of 32-bit. Requires nested KVM. + use64bitGuest ? false, + # Whether to enable the virtual UART in VirtualBox guests, allowing to see + # the guest console. There is currently a bug in VirtualBox where this will + # cause a crash if running with SW virtualization + # (https://www.virtualbox.org/ticket/18632). If you need to debug the tests + # then enable this and nested KVM to work around the crash (see above). + enableVBoxUART ? false }: +assert use64bitGuest -> useKvmNestedVirt; +assert enableVBoxUART -> useKvmNestedVirt; # VirtualBox bug, see above + with import ../lib/testing.nix { inherit system pkgs; }; with pkgs.lib; @@ -94,7 +111,7 @@ let testVM = vmName: vmScript: let cfg = (import ../lib/eval-config.nix { - system = "i686-linux"; + system = if use64bitGuest then "x86_64-linux" else "i686-linux"; modules = [ ../modules/profiles/minimal.nix (testVMConfig vmName vmScript) @@ -141,13 +158,15 @@ let sharePath = "/home/alice/vboxshare-${name}"; createFlags = mkFlags [ - "--ostype Linux26" + "--ostype ${if use64bitGuest then "Linux26_64" else "Linux26"}" "--register" ]; - vmFlags = mkFlags ([ - "--uart1 0x3F8 4" - "--uartmode1 client /run/virtualbox-log-${name}.sock" + vmFlags = mkFlags ( + (optionals enableVBoxUART [ + "--uart1 0x3F8 4" + "--uartmode1 client /run/virtualbox-log-${name}.sock" + ]) ++ [ "--memory 768" "--audio none" ] ++ (attrs.vmFlags or [])); @@ -180,7 +199,7 @@ let ]; in { machine = { - systemd.sockets."vboxtestlog-${name}" = { + systemd.sockets."vboxtestlog-${name}" = mkIf enableVBoxUART { description = "VirtualBox Test Machine Log Socket For ${name}"; wantedBy = [ "sockets.target" ]; before = [ "multi-user.target" ]; @@ -188,7 +207,7 @@ let socketConfig.Accept = true; }; - systemd.services."vboxtestlog-${name}@" = { + systemd.services."vboxtestlog-${name}@" = mkIf enableVBoxUART { description = "VirtualBox Test Machine Log For ${name}"; serviceConfig.StandardInput = "socket"; serviceConfig.StandardOutput = "syslog"; @@ -346,6 +365,8 @@ let vmConfigs = mapAttrsToList mkVMConf vms; in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs; virtualisation.memorySize = 2048; + virtualisation.qemu.options = + if useKvmNestedVirt then ["-cpu" "kvm64,vmx=on"] else []; virtualisation.virtualbox.host.enable = true; services.xserver.displayManager.auto.user = "alice"; users.users.alice.extraGroups = let @@ -412,9 +433,14 @@ in mapAttrs (mkVBoxTest false vboxVMs) { ); $machine->sleep(5); $machine->screenshot("gui_manager_started"); + # Home to select Tools, down to move to the VM, enter to start it. + $machine->sendKeys("home"); + $machine->sendKeys("down"); $machine->sendKeys("ret"); $machine->screenshot("gui_manager_sent_startup"); waitForStartup_simple (sub { + $machine->sendKeys("home"); + $machine->sendKeys("down"); $machine->sendKeys("ret"); }); $machine->screenshot("gui_started"); diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index fd572a9f2eb..9011e15fae3 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -1,4 +1,4 @@ -{ config, stdenv, fetchurl, lib, fetchpatch, iasl, dev86, pam, libxslt, libxml2 +{ config, stdenv, fetchurl, lib, iasl, dev86, pam, libxslt, libxml2 , libX11, xorgproto, libXext, libXcursor, libXmu, qt5, libIDL, SDL, libcap , libpng, glib, lvm2, libXrandr, libXinerama, libopus , pkgconfig, which, docbook_xsl, docbook_xml_dtd_43 @@ -21,8 +21,8 @@ let buildType = "release"; # Remember to change the extpackRev and version in extpack.nix and # guest-additions/default.nix as well. - main = "0jmrbyhs92lyarpvylxqn2ajxdg9b290w5nd4g0i4h83d28bwbw0"; - version = "5.2.28"; + main = "0lp584a350ya1zn03lhgmdbi91yp8yfja9hlg2jz1xyfj2dc869l"; + version = "6.0.6"; in stdenv.mkDerivation { name = "virtualbox-${version}"; @@ -76,11 +76,12 @@ in stdenv.mkDerivation { optional enableHardening ./hardened.patch ++ [ ./qtx11extras.patch - (fetchpatch { - name = "010-qt-5.11.patch"; - url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/010-qt-5.11.patch?h=packages/virtualbox"; - sha256 = "0hjx99pg40wqyggnrpylrp5zngva4xrnk7r90i0ynrqc7n84g9pn"; - }) + # https://www.virtualbox.org/ticket/18620 + ./fix_kbuild.patch + # https://www.virtualbox.org/ticket/18621 + ./fix_module_makefile_sed.patch + # https://forums.virtualbox.org/viewtopic.php?f=7&t=92815 + ./fix_printk_test.patch ]; postPatch = '' @@ -192,6 +193,6 @@ in stdenv.mkDerivation { license = licenses.gpl2; homepage = https://www.virtualbox.org/; maintainers = with maintainers; [ flokli sander ]; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/applications/virtualization/virtualbox/extpack.nix b/pkgs/applications/virtualization/virtualbox/extpack.nix index 0e8a6eb25da..d26909ad79a 100644 --- a/pkgs/applications/virtualization/virtualbox/extpack.nix +++ b/pkgs/applications/virtualization/virtualbox/extpack.nix @@ -2,7 +2,7 @@ with lib; -let version = "5.2.28"; +let version = "6.0.6"; in fetchurl rec { name = "Oracle_VM_VirtualBox_Extension_Pack-${version}.vbox-extpack"; @@ -10,7 +10,7 @@ fetchurl rec { sha256 = # Manually sha256sum the extensionPack file, must be hex! # Thus do not use `nix-prefetch-url` but instead plain old `sha256sum`. - let value = "376e07cbf2ff2844c95c800346c8e4697d7bc671ae0e21e46153b2e7b4ccc1d6"; + let value = "794f023a186bd217c29c3d30bd1434b6e9de3b242c7bf740d06d10f2d3d981c6"; in assert (builtins.stringLength value) == 64; value; meta = { @@ -18,6 +18,6 @@ fetchurl rec { license = licenses.virtualbox-puel; homepage = https://www.virtualbox.org/; maintainers = with maintainers; [ flokli sander cdepillabout ]; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = [ "x86_64-linux" ]; }; } diff --git a/pkgs/applications/virtualization/virtualbox/fix_kbuild.patch b/pkgs/applications/virtualization/virtualbox/fix_kbuild.patch new file mode 100644 index 00000000000..7cafeada7d9 --- /dev/null +++ b/pkgs/applications/virtualization/virtualbox/fix_kbuild.patch @@ -0,0 +1,12 @@ +diff -urN a/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile b/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile +--- a/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile ++++ b/src/VBox/HostDrivers/VBoxNetAdp/linux/Makefile +@@ -58,7 +58,7 @@ + RT_WITH_VBOX \ + VBOX_WITH_HARDENING \ + VBOX_WITH_64_BITS_GUESTS # <-- must be consistent with Config.kmk! +-VBOXMOD_CFLAGS = -include $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h -fno-pie -Wno-declaration-after-statement ++VBOXMOD_CFLAGS = -include $(VBOXNETADPT_DIR)include/VBox/SUPDrvMangling.h -fno-pie -Wno-declaration-after-statement + + include $(obj)/Makefile-footer.gmk + diff --git a/pkgs/applications/virtualization/virtualbox/fix_module_makefile_sed.patch b/pkgs/applications/virtualization/virtualbox/fix_module_makefile_sed.patch new file mode 100644 index 00000000000..6bfa5a4404b --- /dev/null +++ b/pkgs/applications/virtualization/virtualbox/fix_module_makefile_sed.patch @@ -0,0 +1,36 @@ +diff -urN VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk +--- VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk 2019-04-16 12:16:38.000000000 +0200 ++++ VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk 2019-05-04 15:19:14.545497602 +0200 +@@ -175,7 +175,7 @@ + | $$(dir $$@) + $(QUIET)$(RM) -f -- $@ + ifndef VBOX_WITH_HARDENING +- $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< ++ $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $< + else + $(QUIET)$(CP) -f $< $@ + endif +diff -urN VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk +--- VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk 2019-04-16 12:16:39.000000000 +0200 ++++ VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk 2019-05-04 15:19:13.809493324 +0200 +@@ -525,7 +525,7 @@ + | $$(dir $$@) + $(QUIET)$(RM) -f -- $@ + ifndef VBOX_WITH_HARDENING +- $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< ++ $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $< + else + $(QUIET)$(CP) -f $< $@ + endif +diff -urN VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxPci/Makefile.kmk VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxPci/Makefile.kmk +--- VirtualBox-6.0.6/src/VBox/HostDrivers/VBoxPci/Makefile.kmk 2019-04-16 12:16:40.000000000 +0200 ++++ VirtualBox-6.0.6.new/src/VBox/HostDrivers/VBoxPci/Makefile.kmk 2019-05-04 15:42:12.029664987 +0200 +@@ -67,7 +67,7 @@ + | $$(dir $$@) + $(QUIET)$(RM) -f -- $@ + ifndef VBOX_WITH_HARDENING +- $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< ++ $(QUIET)$(SED) -e "s;VBOX_WITH_HARDENING;;g" --output $@ $< + else + $(QUIET)$(CP) -f $< $@ + endif diff --git a/pkgs/applications/virtualization/virtualbox/fix_printk_test.patch b/pkgs/applications/virtualization/virtualbox/fix_printk_test.patch new file mode 100644 index 00000000000..eceaff2dc61 --- /dev/null +++ b/pkgs/applications/virtualization/virtualbox/fix_printk_test.patch @@ -0,0 +1,14 @@ +diff -urN VirtualBox-6.0.6/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c VirtualBox-6.0.6.new/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c +--- VirtualBox-6.0.6/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c 2019-04-16 12:16:37.000000000 +0200 ++++ VirtualBox-6.0.6.new/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c 2019-05-04 15:59:44.439905223 +0200 +@@ -426,10 +426,8 @@ + int rc; + PSUPDRVSESSION pSession; + Log(("VBoxDrvLinuxCreate: pFilp=%p pid=%d/%d %s\n", pFilp, RTProcSelf(), current->pid, current->comm)); +- printk("test1\n"); + + #ifdef VBOX_WITH_HARDENING +- printk("test2\n"); + /* + * Only root is allowed to access the unrestricted device, enforce it! + */ diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix index ecefc9bc07e..1a5c6c670c8 100644 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix +++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, lib, patchelf, cdrkit, kernel, which, makeWrapper -, xorg, dbus, virtualbox }: +, zlib, xorg, dbus, virtualbox }: let version = virtualbox.version; @@ -19,32 +19,23 @@ stdenv.mkDerivation { src = fetchurl { url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso"; - sha256 = "0cwdmdgcd1jysyw7c9b3cdk1ngk5nq7slh1zkhxkvvq142cnm1v9"; + sha256 = "1srcsf9264l5yxbq2x83z66j38blbfrywq5lkzwb5kih6sv548c3"; }; KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; KERN_INCL = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/source/include"; - patchFlags = [ "-p1" "-d" "install/src/vboxguest-${version}" ]; - - patches = [ - ./fix_kerndir.patch - ./fix_kernincl.patch - ]; + # If you add a patch you probably need this. + #patchFlags = [ "-p1" "-d" "install/src/vboxguest-${version}" ]; hardeningDisable = [ "pic" ]; NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types -Wno-error=implicit-function-declaration"; nativeBuildInputs = [ patchelf makeWrapper ]; - buildInputs = [ cdrkit dbus ] ++ kernel.moduleBuildDependencies; + buildInputs = [ cdrkit ] ++ kernel.moduleBuildDependencies; - installPhase = '' - mkdir -p $out - cp -r install/* $out - ''; - - buildCommand = with xorg; '' + unpackPhase = '' ${if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then '' isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run chmod 755 ./VBoxLinuxAdditions.run @@ -63,39 +54,30 @@ stdenv.mkDerivation { '' else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions") } + ''; - cd ../ - patchPhase - cd install/src - - # Build kernel modules - export INSTALL_MOD_PATH=$out + doConfigure = false; + buildPhase = '' + # Build kernel modules. + cd src find . -type f | xargs sed 's/depmod -a/true/' -i - cd vboxguest-${version} - + # Run just make first. If we only did make install, we get symbol warnings during build. make - cd ../.. # Change the interpreter for various binaries - for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} other/mount.vboxsf - do - ${if stdenv.hostPlatform.system == "i686-linux" then '' - patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $i - '' - else if stdenv.hostPlatform.system == "x86_64-linux" then '' - patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2 $i - '' - else throw ("Architecture: "+stdenv.hostPlatform.system+" not supported for VirtualBox guest additions") - } - patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc dbus libX11 libXt libXext libXmu libXfixes libXrandr libXcursor ]} $i + for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} other/mount.vboxsf; do + patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} $i + patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc zlib + xorg.libX11 xorg.libXt xorg.libXext xorg.libXmu xorg.libXfixes xorg.libXrandr xorg.libXcursor ]} $i done for i in lib/VBoxOGL*.so do - patchelf --set-rpath ${lib.makeLibraryPath [ "$out" dbus libXcomposite libXdamage libXext libXfixes ]} $i + patchelf --set-rpath ${lib.makeLibraryPath [ "$out" + xorg.libXcomposite xorg.libXdamage xorg.libXext xorg.libXfixes ]} $i done # FIXME: Virtualbox 4.3.22 moved VBoxClient-all (required by Guest Additions @@ -105,6 +87,13 @@ stdenv.mkDerivation { # Remove references to /usr from various scripts and files sed -i -e "s|/usr/bin|$out/bin|" other/vboxclient.desktop sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all + ''; + + installPhase = '' + # Install kernel modules. + cd src/vboxguest-${version} + make install INSTALL_MOD_PATH=$out + cd ../.. # Install binaries install -D -m 755 other/mount.vboxsf $out/bin/mount.vboxsf @@ -131,21 +120,18 @@ stdenv.mkDerivation { # Install Xorg drivers mkdir -p $out/lib/xorg/modules/{drivers,input} install -m 644 other/vboxvideo_drv_${xserverABI}.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so + ''; - # Install kernel modules - cd src + # Stripping breaks these binaries for some reason. + dontStrip = true; - for i in * - do - cd $i - kernelVersion=$(cd ${kernel.dev}/lib/modules; ls) - export MODULE_DIR=$out/lib/modules/$kernelVersion/misc - find . -type f | xargs sed -i -e "s|-o root||g" \ - -e "s|-g root||g" - make install - cd .. + # Some code dlopen() libdbus, patch RUNPATH in fixupPhase so it isn't stripped. + postFixup = '' + for i in $(grep -F libdbus-1.so -l -r $out/{lib,bin}); do + origRpath=$(patchelf --print-rpath "$i") + patchelf --set-rpath "$origRpath:${lib.makeLibraryPath [ dbus ]}" "$i" done - ''; # */ + ''; meta = { description = "Guest additions for VirtualBox"; diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch b/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch deleted file mode 100644 index 0be949f63c9..00000000000 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kerndir.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/vboxsf/Makefile.include.header b/vboxsf/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxsf/Makefile.include.header -+++ b/vboxsf/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) - -diff --git a/vboxguest/Makefile.include.header b/vboxguest/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxguest/Makefile.include.header -+++ b/vboxguest/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) - -diff --git a/vboxvideo/Makefile.include.header b/vboxvideo/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxvideo/Makefile.include.header -+++ b/vboxvideo/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch b/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch deleted file mode 100644 index e59e2e98c1b..00000000000 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/fix_kernincl.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/vboxvideo/Makefile.include.header b/vboxvideo/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxvideo/Makefile.include.header -+++ b/vboxvideo/Makefile.include.header -@@ -122,7 +122,6 @@ ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - Specify KERN_VER= and run Make again) - endif - # Kernel include folder --KERN_INCL := $(KERN_DIR)/include - # module install folder - INSTALL_MOD_DIR ?= misc - MODULE_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KERN_VER)/$(INSTALL_MOD_DIR) diff --git a/pkgs/applications/virtualization/virtualbox/qtx11extras.patch b/pkgs/applications/virtualization/virtualbox/qtx11extras.patch index 6ed74e3e23e..a3aa98b081d 100644 --- a/pkgs/applications/virtualization/virtualbox/qtx11extras.patch +++ b/pkgs/applications/virtualization/virtualbox/qtx11extras.patch @@ -2,30 +2,15 @@ diff --git a/kBuild/units/qt5.kmk b/kBuild/units/qt5.kmk index 71b96a3..73391f0 100644 --- a/kBuild/units/qt5.kmk +++ b/kBuild/units/qt5.kmk -@@ -1019,9 +1019,10 @@ else +@@ -1054,9 +1054,9 @@ else $(eval $(target)_LIBS += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) ) endif else - $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) ) -+ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) \ -+ $(PATH_QT5_X11_EXTRAS_LIB)/lib$(qt_prefix)Qt5X11Extras$(qt_infix)$(SUFF_DLL)) ++ $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(if $(filter X11Extras,$(module)),$(PATH_QT5_X11_EXTRAS_LIB),$(PATH_SDK_QT5_LIB))/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) ) endif - $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) ) + $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) $(PATH_QT5_X11_EXTRAS_INC)/QtX11Extras ) endif $(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) ) -diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk -index 3295bfefe7..796370623c 100644 ---- a/src/VBox/Frontends/VirtualBox/Makefile.kmk -+++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk -@@ -916,9 +916,6 @@ endif - # The Qt modules we're using. - # (The include directory and lib/framework for each module will be added by the Qt unit.) - VirtualBox_QT_MODULES = Core Gui Widgets PrintSupport --VirtualBox_QT_MODULES.linux += X11Extras --VirtualBox_QT_MODULES.solaris += X11Extras --VirtualBox_QT_MODULES.freebsd += X11Extras - VirtualBox_QT_MODULES.darwin += MacExtras - VirtualBox_QT_MODULES.win += WinExtras - if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_GUI_USE_QGL) diff --git a/pkgs/os-specific/linux/virtualbox/default.nix b/pkgs/os-specific/linux/virtualbox/default.nix index 9e2dee099ce..f2fd4d4a61a 100644 --- a/pkgs/os-specific/linux/virtualbox/default.nix +++ b/pkgs/os-specific/linux/virtualbox/default.nix @@ -9,13 +9,7 @@ stdenv.mkDerivation { nativeBuildInputs = kernel.moduleBuildDependencies; - patches = [ - ./fix_kerndir.patch - ./fix_kbuild.patch - ]; - KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; - INCLUDE_BASE = "${virtualbox.modsrc}"; makeFlags = [ "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" diff --git a/pkgs/os-specific/linux/virtualbox/fix_kbuild.patch b/pkgs/os-specific/linux/virtualbox/fix_kbuild.patch deleted file mode 100644 index 242a905c1a0..00000000000 --- a/pkgs/os-specific/linux/virtualbox/fix_kbuild.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff --git a/vboxdrv/Makefile b/vboxdrv/Makefile -index e262c61..4af8dac 100644 ---- a/vboxdrv/Makefile -+++ b/vboxdrv/Makefile -@@ -131,7 +131,7 @@ ifdef VBOX_WITH_NATIVE_DTRACE - MOD_OBJS += SUPDrvDTrace.o - endif - --MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) -+MOD_INCL = $(addprefix -I$(INCLUDE_BASE)/$(MOD_NAME),/ /include /r0drv/linux) - ifdef VBOX_WITH_NATIVE_DTRACE - MOD_INCL += -I/usr/include/linux -I/usr/include - endif -@@ -157,7 +157,7 @@ ifdef VBOX_WITH_TEXT_MODMEM_HACK - endif - - # build defs --MOD_CFLAGS = -include $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h \ -+MOD_CFLAGS = -include include/VBox/SUPDrvMangling.h \ - -fno-omit-frame-pointer -fno-pie - - include $(obj)/Makefile.include.footer -diff --git a/vboxnetadp/Makefile b/vboxnetadp/Makefile -index e262c61..4af8dac 100644 ---- a/vboxnetadp/Makefile -+++ b/vboxnetadp/Makefile -@@ -34,7 +34,7 @@ MOD_OBJS += math/gcc/divdi3.o \ - math/gcc/umoddi3.o - endif - --MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) -+MOD_INCL = $(addprefix -I$(INCLUDE_BASE)/$(MOD_NAME),/ /include /r0drv/linux) - MOD_DEFS = -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX \ - -DRT_WITH_VBOX -DVBOX_WITH_HARDENING \ - -Wno-declaration-after-statement -@@ -59,6 +59,6 @@ ifdef VBOX_USE_INSERT_PAGE - endif - - # build defs --MOD_CFLAGS = -include $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h -fno-pie -+MOD_CFLAGS = -include include/VBox/SUPDrvMangling.h -fno-pie - - include $(obj)/Makefile.include.footer -diff --git a/vboxnetflt/Makefile b/vboxnetflt/Makefile -index e262c61..4af8dac 100644 ---- a/vboxnetflt/Makefile -+++ b/vboxnetflt/Makefile -@@ -38,7 +38,7 @@ MOD_OBJS += math/gcc/divdi3.o \ - math/gcc/umoddi3.o - endif - --MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) -+MOD_INCL = $(addprefix -I$(INCLUDE_BASE)/$(MOD_NAME),/ /include /r0drv/linux) - MOD_DEFS = -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ - -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING \ - -Wno-declaration-after-statement -@@ -63,6 +63,6 @@ ifdef VBOX_USE_INSERT_PAGE - endif - - # build defs --MOD_CFLAGS = -include $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h -fno-pie -+MOD_CFLAGS = -include include/VBox/SUPDrvMangling.h -fno-pie - - include $(obj)/Makefile.include.footer -diff --git a/vboxpci/Makefile b/vboxpci/Makefile -index e262c61..4af8dac 100644 ---- a/vboxpci/Makefile -+++ b/vboxpci/Makefile -@@ -38,7 +38,7 @@ MOD_OBJS += math/gcc/divdi3.o \ - math/gcc/umoddi3.o - endif - --MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) -+MOD_INCL = $(addprefix -I$(INCLUDE_BASE)/$(MOD_NAME),/ /include /r0drv/linux) - MOD_DEFS = -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX \ - -DRT_WITH_VBOX -DVBOX_WITH_HARDENING - ifeq ($(BUILD_TARGET_ARCH),amd64) -@@ -60,6 +60,6 @@ ifdef VBOX_USE_INSERT_PAGE - endif - - # build defs --MOD_CFLAGS = -include $(KBUILD_EXTMOD)/include/VBox/SUPDrvMangling.h -fno-pie -+MOD_CFLAGS = -include include/VBox/SUPDrvMangling.h -fno-pie - - include $(obj)/Makefile.include.footer diff --git a/pkgs/os-specific/linux/virtualbox/fix_kerndir.patch b/pkgs/os-specific/linux/virtualbox/fix_kerndir.patch deleted file mode 100644 index 70ddbbb2ebd..00000000000 --- a/pkgs/os-specific/linux/virtualbox/fix_kerndir.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git a/vboxdrv/Makefile.include.header b/vboxdrv/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxdrv/Makefile.include.header -+++ b/vboxdrv/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) -diff --git a/vboxnetadp/Makefile.include.header b/vboxnetadp/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxnetadp/Makefile.include.header -+++ b/vboxnetadp/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) -diff --git a/vboxnetflt/Makefile.include.header b/vboxnetflt/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxnetflt/Makefile.include.header -+++ b/vboxnetflt/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again) -diff --git a/vboxpci/Makefile.include.header b/vboxpci/Makefile.include.header -index 8df1eb4d25..5a3e5604e7 100644 ---- a/vboxpci/Makefile.include.header -+++ b/vboxpci/Makefile.include.header -@@ -117,7 +117,6 @@ else # neq($(KERNELRELEASE),) - endif # neq($(KERNELRELEASE),) - - # Kernel build folder --KERN_DIR := /lib/modules/$(KERN_VER)/build - ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) - $(error Error: unable to find the headers of the Linux kernel to build against. \ - Specify KERN_VER= and run Make again)