diff options
author | aszlig <aszlig@redmoonstudios.org> | 2017-07-04 20:04:45 +0200 |
---|---|---|
committer | aszlig <aszlig@redmoonstudios.org> | 2017-07-04 20:08:42 +0200 |
commit | 12ee0fbd8883cb5a17b499c42c8d6cdf602d1640 (patch) | |
tree | b22edc2c00366c0748b4416f194ed57a3858bdd9 /pkgs/applications/virtualization/virtualbox | |
parent | f873ba8cc8bb69b57913f2468f0dd78ddbeb427d (diff) | |
download | nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar.gz nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar.bz2 nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar.lz nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar.xz nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.tar.zst nixlib-12ee0fbd8883cb5a17b499c42c8d6cdf602d1640.zip |
virtualbox: Add patch for Linux 4.12
Compiling the kernel modules on Linux 4.12 fails, so I've included an upstream patch from: https://www.virtualbox.org/changeset/66927/vbox The patch is applied against the guest additions as well, where we need to transform the patch a bit so that we get CR LF line endings (DOS format), which is what is the case for the guest additions ISO. I've tested this with all the subtests of the "virtualbox" NixOS VM tests and they all succeed on x86_64-linux. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/applications/virtualization/virtualbox')
3 files changed, 84 insertions, 1 deletions
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix index 73ba76676b98..6675068bda97 100644 --- a/pkgs/applications/virtualization/virtualbox/default.nix +++ b/pkgs/applications/virtualization/virtualbox/default.nix @@ -88,7 +88,7 @@ in stdenv.mkDerivation { ''; patches = optional enableHardening ./hardened.patch - ++ [ ./qtx11extras.patch ]; + ++ [ ./qtx11extras.patch ./linux-4.12.patch ]; postPatch = '' sed -i -e 's|/sbin/ifconfig|${nettools}/bin/ifconfig|' \ diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix index 3c9f28f4f2d5..8865022c23e4 100644 --- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix +++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix @@ -62,6 +62,9 @@ stdenv.mkDerivation { for i in * do cd $i + # Files within the guest additions ISO are using DOS line endings + sed -re '/^(@@|---|\+\+\+)/!s/$/\r/' ${../linux-4.12.patch} \ + | patch -d vboxguest -p4 find . -type f | xargs sed 's/depmod -a/true/' -i make cd .. diff --git a/pkgs/applications/virtualization/virtualbox/linux-4.12.patch b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch new file mode 100644 index 000000000000..7157365466f9 --- /dev/null +++ b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch @@ -0,0 +1,80 @@ +commit 47fee9325e3b5feed0dbc4ba9e2de77c6d55e3bb +Author: vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> +Date: Wed May 17 09:42:23 2017 +0000 + + Runtime/r0drv: Linux 4.12 5-level page table adaptions + + + git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@66927 cfe28804-0f27-0410-a406-dd0f0b0b656f + +diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +index 28dc33f963..41ed058860 100644 +--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c ++++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c +@@ -902,6 +902,9 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv) + union + { + pgd_t Global; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ p4d_t Four; ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + pud_t Upper; + #endif +@@ -917,12 +920,26 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv) + u.Global = *pgd_offset(current->active_mm, ulAddr); + if (RT_UNLIKELY(pgd_none(u.Global))) + return NULL; +- +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++ u.Four = *p4d_offset(&u.Global, ulAddr); ++ if (RT_UNLIKELY(p4d_none(u.Four))) ++ return NULL; ++ if (p4d_large(u.Four)) ++ { ++ pPage = p4d_page(u.Four); ++ AssertReturn(pPage, NULL); ++ pfn = page_to_pfn(pPage); /* doing the safe way... */ ++ AssertCompile(P4D_SHIFT - PAGE_SHIFT < 31); ++ pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (P4D_SHIFT - PAGE_SHIFT)) - 1); ++ return pfn_to_page(pfn); ++ } ++ u.Upper = *pud_offset(&u.Four, ulAddr); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + u.Upper = *pud_offset(&u.Global, ulAddr); ++#endif + if (RT_UNLIKELY(pud_none(u.Upper))) + return NULL; +-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) + if (pud_large(u.Upper)) + { + pPage = pud_page(u.Upper); +@@ -931,8 +948,8 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv) + pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (PUD_SHIFT - PAGE_SHIFT)) - 1); + return pfn_to_page(pfn); + } +-# endif +- ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11) + u.Middle = *pmd_offset(&u.Upper, ulAddr); + #else /* < 2.6.11 */ + u.Middle = *pmd_offset(&u.Global, ulAddr); +diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +index 5afdee9e71..20aab0817f 100644 +--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h ++++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h +@@ -159,6 +159,11 @@ + # include <asm/tlbflush.h> + #endif + ++/* for set_pages_x() */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) ++# include <asm/set_memory.h> ++#endif ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) + # include <asm/smap.h> + #else |