Date: Sunday, December 10, 2017 @ 16:39:56 Author: heftig Revision: 312060
archrelease: copy trunk to staging-x86_64 Added: nvidia-304xx/repos/staging-x86_64/ nvidia-304xx/repos/staging-x86_64/PKGBUILD (from rev 312059, nvidia-304xx/trunk/PKGBUILD) nvidia-304xx/repos/staging-x86_64/disable-mtrr.patch (from rev 312059, nvidia-304xx/trunk/disable-mtrr.patch) nvidia-304xx/repos/staging-x86_64/kernel-4.14.patch (from rev 312059, nvidia-304xx/trunk/kernel-4.14.patch) --------------------+ PKGBUILD | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ disable-mtrr.patch | 24 +++++++++++++++++ kernel-4.14.patch | 29 ++++++++++++++++++++ 3 files changed, 124 insertions(+) Copied: nvidia-304xx/repos/staging-x86_64/PKGBUILD (from rev 312059, nvidia-304xx/trunk/PKGBUILD) =================================================================== --- staging-x86_64/PKGBUILD (rev 0) +++ staging-x86_64/PKGBUILD 2017-12-10 16:39:56 UTC (rev 312060) @@ -0,0 +1,71 @@ +# $Id$ +# Maintainer: Felix Yan <felixonm...@archlinux.org> +# Contributor: Thomas Baechler <tho...@archlinux.org> + +pkgbase=nvidia-304xx +pkgname=(nvidia-304xx nvidia-304xx-dkms) +pkgver=304.137 +_extramodules=extramodules-4.14-ARCH +pkgrel=14 +pkgdesc="NVIDIA drivers for linux, 304xx legacy branch" +arch=('x86_64') +url="http://www.nvidia.com/" +makedepends=("nvidia-304xx-utils=${pkgver}" 'linux' 'linux-headers>=4.14' 'linux-headers<4.15') +conflicts=('nvidia') +license=('custom') +options=('!strip') +source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run" + 'disable-mtrr.patch' 'kernel-4.14.patch') +sha512sums=('4ab648647e4f3e2c352b2eab6454c264fe4728d8eb1264fafee2a4ab1a4ce59516abcf8490044d31e35309ea951e564cc217e13f7139a48bbf650a4238c5b87c' + '54e8825e523f11706890e09e476498f3a30f75ce4e350ff2ff8a1e1c3af574d9ccfb8903543766b6863d94cdfbf46e68cd3d33380867dd976cafc8dd2dd78774' + 'ccaa40e085d985ec4280003e36dd06e60958ed1408867379fd21a68a18d48aa4be311bf9ad1e804f7a7245c90be98e919d2ec30f45d290f1cdb19c866bdb8a8d') + +_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" + +prepare() { + sh "${_pkg}.run" --extract-only + cd "${_pkg}" + # patches here + + patch -Np1 --no-backup-if-mismatch < "${srcdir}/kernel-4.14.patch" + + # FS#47092 + #patch -d kernel -Np1 --no-backup-if-mismatch < "${srcdir}/disable-mtrr.patch" + + cp -a kernel kernel-dkms +} + +build() { + _kernver="$(cat /usr/lib/modules/${_extramodules}/version)" + cd "${_pkg}"/kernel + make SYSSRC=/usr/lib/modules/"${_kernver}/build" module +} + +package_nvidia-304xx() { + pkgdesc="NVIDIA drivers for linux, 304xx legacy branch" + depends=('linux>=4.14' 'linux<4.15' "nvidia-304xx-utils=${pkgver}" 'libgl') + + install -Dt "${pkgdir}/usr/lib/modules/${_extramodules}" -m644 \ + "${srcdir}/${_pkg}/kernel"/nvidia.ko + + find "${pkgdir}" -name '*.ko' -exec gzip -n {} + + + echo "blacklist nouveau" | + install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} + +package_nvidia-304xx-dkms() { + pkgdesc="NVIDIA driver sources for linux, 304xx legacy branch" + depends=('dkms' "nvidia-304xx-utils=$pkgver" 'libgl') + optdepends=('linux-headers: Build the module for Arch kernel' + 'linux-lts-headers: Build the module for LTS Arch kernel') + conflicts+=('nvidia-304xx') + + cd ${_pkg} + + install -dm 755 "${pkgdir}"/usr/src + cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}" + + echo "blacklist nouveau" | + install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia.conf" +} Copied: nvidia-304xx/repos/staging-x86_64/disable-mtrr.patch (from rev 312059, nvidia-304xx/trunk/disable-mtrr.patch) =================================================================== --- staging-x86_64/disable-mtrr.patch (rev 0) +++ staging-x86_64/disable-mtrr.patch 2017-12-10 16:39:56 UTC (rev 312060) @@ -0,0 +1,24 @@ +Author: Luca Boccassi <luca.bocca...@gmail.com> +Description: Disable MTRR on kernel >= 4.3 + From kernel 4.3 and newer (commit 2baa891e42d84) mtrr_add and mtrr_del are no + longer exported. The Nvidia kernel shim still uses it as of 304.131, causing + the module to error out when loading. Disable MTRR if running on 4.3 or greater + until upstream fixes it. +--- a/nv-linux.h ++++ b/nv-linux.h +@@ -256,6 +256,15 @@ + #include <linux/seq_file.h> + #endif + ++/* ++ * As of version 304.131, os-agp.c and os-mtrr.c still use deprecated ++ * kernel APIs for mtrr which are no longer exported since 4.3, causing ++ * the module to error out when loaded. ++ */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) ++#undef CONFIG_MTRR ++#endif ++ + #if !defined(NV_VMWARE) && defined(CONFIG_MTRR) + #include <asm/mtrr.h> + #endif Copied: nvidia-304xx/repos/staging-x86_64/kernel-4.14.patch (from rev 312059, nvidia-304xx/trunk/kernel-4.14.patch) =================================================================== --- staging-x86_64/kernel-4.14.patch (rev 0) +++ staging-x86_64/kernel-4.14.patch 2017-12-10 16:39:56 UTC (rev 312060) @@ -0,0 +1,29 @@ +diff -u -r NVIDIA-Linux-x86_64-340.104-no-compat32/kernel/nv-drm.c NVIDIA-Linux-x86_64-340.104-no-compat32-kernel4.14/kernel/nv-drm.c +--- NVIDIA-Linux-x86_64-340.104-no-compat32/kernel/nv-drm.c 2017-09-15 01:16:51.000000000 +0200 ++++ NVIDIA-Linux-x86_64-340.104-no-compat32-kernel4.14/kernel/nv-drm.c 2017-11-19 00:51:45.006654148 +0100 +@@ -173,8 +173,12 @@ + { + int ret = 0; + #if defined(NV_DRM_AVAILABLE) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ ret = drm_legacy_pci_init(&nv_drm_driver, pci_driver); ++#else + ret = drm_pci_init(&nv_drm_driver, pci_driver); + #endif ++#endif + return ret; + } + +@@ -183,8 +187,12 @@ + ) + { + #if defined(NV_DRM_AVAILABLE) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) ++ drm_legacy_pci_exit(&nv_drm_driver, pci_driver); ++#else + drm_pci_exit(&nv_drm_driver, pci_driver); + #endif ++#endif + } + + RM_STATUS NV_API_CALL nv_alloc_os_descriptor_handle(