Skip to content

Instantly share code, notes, and snippets.

@graysky2
Last active October 12, 2019 14:09
Show Gist options
  • Save graysky2/e0def08f2ceff1acda779c871c0467b2 to your computer and use it in GitHub Desktop.
Save graysky2/e0def08f2ceff1acda779c871c0467b2 to your computer and use it in GitHub Desktop.
patch for nvidia-340xx-lts
--- PKGBUILD 2019-06-07 06:25:13.000000000 -0400
+++ new 2019-10-12 09:58:41.055145754 -0400
@@ -1,10 +1,10 @@
# Maintainer: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>
+# Contributor: graysky <graysky AT archlinux DOT us>
pkgname=nvidia-340xx-lts
pkgver=340.107
-_extramodules=extramodules-4.19-lts
-pkgrel=24
+pkgrel=25
pkgdesc="NVIDIA drivers for linux-lts"
arch=('x86_64')
url="https://www.nvidia.com/"
@@ -18,7 +18,11 @@ source=("https://us.download.nvidia.com/
sha512sums=('0de6f182d67bd322df7ae04e74c0cde6973c55bfea47a8f2503a29f8a899cd1b801ae4b52d066628df4a4f9c84e5e7547465bdc37d1b87df47af43fdab23466f'
'c25d90499e1deb26129a67dd7e953be8c1e31c5770e2b8b64d03af54cf1afec1a52636e74900f8ac468692207ab8a3765a12edd581142c4d2cfd2d6e66ac7ac2')
-[[ "$CARCH" = "x86_64" ]] && _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
+_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
+
+# default is 'linux' substitute custom name here
+_kernelname=linux-lts
+_kernver="$(</usr/src/$_kernelname/version)"
prepare() {
sh ${_pkg}.run --extract-only
@@ -28,24 +32,25 @@ prepare() {
}
build() {
- _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
cd "${_pkg}/kernel"
- make SYSSRC=/usr/lib/modules/${_kernver}/build module
+ make SYSSRC=/usr/src/"$_kernelname" module
cd uvm
- make SYSSRC=/usr/lib/modules/${_kernver}/build module
+ make SYSSRC=/usr/src/"$_kernelname" module
}
package() {
depends=('linux-lts>=4.19.46' "nvidia-340xx-utils=$pkgver" 'libgl')
+ _extradir="/usr/lib/modules/$_kernver/extramodules"
+ install -Dt "${pkgdir}${_extradir}" -m644 \
+ "${srcdir}/${_pkg}/kernel"/{nvidia,uvm/nvidia-uvm}.ko
+
+ find "${pkgdir}" -name '*.ko' -exec gzip -n {} +
- install -D -m644 "${srcdir}/${_pkg}/kernel/nvidia.ko" \
- "${pkgdir}/usr/lib/modules/${_extramodules}/kernel/drivers/video/nvidia.ko"
- install -D -m644 "${srcdir}/${_pkg}/kernel/uvm/nvidia-uvm.ko" \
- "${pkgdir}/usr/lib/modules/${_extramodules}/kernel/drivers/video/nvidia-uvm.ko"
- gzip "${pkgdir}/usr/lib/modules/${_extramodules}/kernel/drivers/video/"*.ko
- install -d -m755 "${pkgdir}/usr/lib/modprobe.d"
- echo "blacklist nouveau" >> "${pkgdir}/usr/lib/modprobe.d/nvidia-lts.conf"
- echo "blacklist nvidiafb" >> "${pkgdir}/usr/lib/modprobe.d/nvidia-lts.conf"
- install -D -m644 "${srcdir}/${_pkg}/LICENSE" "${pkgdir}/usr/share/licenses/nvidia-lts/LICENSE"
+ echo "blacklist nouveau" |
+ install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia-lts.conf"
+
+ install -Dm644 "${srcdir}/${_pkg}/LICENSE" "${pkgdir}/usr/share/licenses/nvidia-lts/LICENSE"
}
+
+# vim:set ts=2 sw=2 et:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment