Enable Virtualbox guest additions for AARCH64 (#420556)

authored by Jenny and committed by GitHub bc515356 7c1454b4

+38 -12
+1 -1
nixos/modules/virtualisation/virtualbox-guest.nix
··· 104 { 105 assertions = [ 106 { 107 - assertion = pkgs.stdenv.hostPlatform.isx86; 108 message = "Virtualbox not currently supported on ${pkgs.stdenv.hostPlatform.system}"; 109 } 110 ];
··· 104 { 105 assertions = [ 106 { 107 + assertion = pkgs.stdenv.hostPlatform.isx86 || pkgs.stdenv.hostPlatform.isAarch64; 108 message = "Virtualbox not currently supported on ${pkgs.stdenv.hostPlatform.system}"; 109 } 110 ];
+6 -7
pkgs/applications/virtualization/virtualbox/guest-additions/builder.nix
··· 23 virtualboxVersion, 24 virtualboxSubVersion, 25 virtualboxSha256, 26 }: 27 28 let ··· 77 rm -r src/libs/zlib*/ 78 ''; 79 80 postPatch = '' 81 set -x 82 sed -e 's@MKISOFS --version@MKISOFS -version@' \ 83 -e 's@CXX_FLAGS="\(.*\)"@CXX_FLAGS="-std=c++17 \1"@' \ 84 -i configure 85 - ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 86 - ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 87 88 substituteInPlace ./include/VBox/dbus-calls.h --replace-fail libdbus-1.so.3 ${dbus.lib}/lib/libdbus-1.so.3 89 ··· 166 runHook preInstall 167 168 mkdir -p $out 169 - cp -rv ./out/linux.${ 170 - if stdenv.hostPlatform.is32bit then "x86" else "amd64" 171 - }/${buildType}/bin/additions/VBoxGuestAdditions-${ 172 - if stdenv.hostPlatform.is32bit then "x86" else "amd64" 173 - }.tar.bz2 $out/ 174 175 runHook postInstall 176 '';
··· 23 virtualboxVersion, 24 virtualboxSubVersion, 25 virtualboxSha256, 26 + platform, 27 }: 28 29 let ··· 78 rm -r src/libs/zlib*/ 79 ''; 80 81 + # Apply fix for: https://www.virtualbox.org/ticket/22397 82 + patches = lib.optional stdenv.hostPlatform.isAarch64 ./guest-additions-aarch64-fix.patch; 83 + 84 postPatch = '' 85 set -x 86 sed -e 's@MKISOFS --version@MKISOFS -version@' \ 87 -e 's@CXX_FLAGS="\(.*\)"@CXX_FLAGS="-std=c++17 \1"@' \ 88 -i configure 89 + ls kBuild/bin/linux.${platform}/k* tools/linux.${platform}/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} 90 91 substituteInPlace ./include/VBox/dbus-calls.h --replace-fail libdbus-1.so.3 ${dbus.lib}/lib/libdbus-1.so.3 92 ··· 169 runHook preInstall 170 171 mkdir -p $out 172 + cp -rv ./out/linux.${platform}/${buildType}/bin/additions/VBoxGuestAdditions-${platform}.tar.bz2 $out/ 173 174 runHook postInstall 175 '';
+16 -4
pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
··· 16 virtualboxSubVersion = ""; 17 virtualboxSha256 = "6f9618f39168898134975f51df7c2d6d5129c0aa82b6ae11cf47f920c70df276"; 18 19 virtualBoxNixGuestAdditionsBuilder = callPackage ./builder.nix { 20 - inherit virtualboxVersion virtualboxSubVersion virtualboxSha256; 21 }; 22 23 # Specifies how to patch binaries to make sure that libraries loaded using ··· 54 pname = "VirtualBox-GuestAdditions"; 55 version = "${virtualboxVersion}${virtualboxSubVersion}-${kernel.version}"; 56 57 - src = "${virtualBoxNixGuestAdditionsBuilder}/VBoxGuestAdditions-${ 58 - if stdenv.hostPlatform.is32bit then "x86" else "amd64" 59 - }.tar.bz2"; 60 sourceRoot = "."; 61 62 KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; ··· 159 platforms = [ 160 "i686-linux" 161 "x86_64-linux" 162 ]; 163 broken = stdenv.hostPlatform.is32bit && (kernel.kernelAtLeast "5.10"); 164 };
··· 16 virtualboxSubVersion = ""; 17 virtualboxSha256 = "6f9618f39168898134975f51df7c2d6d5129c0aa82b6ae11cf47f920c70df276"; 18 19 + platform = 20 + if stdenv.hostPlatform.isAarch64 then 21 + "arm64" 22 + else if stdenv.hostPlatform.is32bit then 23 + "x86" 24 + else 25 + "amd64"; 26 + 27 virtualBoxNixGuestAdditionsBuilder = callPackage ./builder.nix { 28 + inherit 29 + virtualboxVersion 30 + virtualboxSubVersion 31 + virtualboxSha256 32 + platform 33 + ; 34 }; 35 36 # Specifies how to patch binaries to make sure that libraries loaded using ··· 67 pname = "VirtualBox-GuestAdditions"; 68 version = "${virtualboxVersion}${virtualboxSubVersion}-${kernel.version}"; 69 70 + src = "${virtualBoxNixGuestAdditionsBuilder}/VBoxGuestAdditions-${platform}.tar.bz2"; 71 sourceRoot = "."; 72 73 KERN_DIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; ··· 170 platforms = [ 171 "i686-linux" 172 "x86_64-linux" 173 + "aarch64-linux" 174 ]; 175 broken = stdenv.hostPlatform.is32bit && (kernel.kernelAtLeast "5.10"); 176 };
+15
pkgs/applications/virtualization/virtualbox/guest-additions/guest-additions-aarch64-fix.patch
···
··· 1 + diff --git a/configure b/configure 2 + index e845993..a5b526e 100644q 3 + --- a/configure 4 + +++ b/configure 5 + @@ -422,6 +422,10 @@ check_environment() 6 + BUILD_MACHINE='sparc32' 7 + BUILD_CPU='blend' 8 + ;; 9 + + aarch64) 10 + + BUILD_MACHINE='arm64' 11 + + BUILD_CPU='blend' 12 + + ;; 13 + *) 14 + log_failure "Cannot determine system" 15 + exit 1