Skip to content

Instantly share code, notes, and snippets.

@graysky2
Created August 12, 2020 10:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graysky2/25422e5160ea8d92da5977674c541c39 to your computer and use it in GitHub Desktop.
Save graysky2/25422e5160ea8d92da5977674c541c39 to your computer and use it in GitHub Desktop.
nvidia-340xx for 5.8
# Maintainer: Jerry Xiao <aur@mail.jerryxiao.cc>
# Maintainer: graysky <graysky AT archlinux DOT us>
# Contributor: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>
pkgbase=nvidia-340xx
pkgname=(nvidia-340xx nvidia-340xx-dkms)
pkgver=340.108
pkgrel=9
pkgdesc="NVIDIA drivers for linux, 340xx legacy branch"
arch=('x86_64')
url="https://www.nvidia.com/"
makedepends=("nvidia-340xx-utils=${pkgver}" 'linux>=5.5' 'linux-headers>=5.5')
conflicts=('nvidia')
license=('custom')
options=(!strip)
source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run"
kernel-5.7.patch::https://gitlab.manjaro.org/packages/extra/linux57-extramodules/nvidia-340xx/-/raw/master/kernel-5.7.patch?inline=false
buildfix_kernel_5.8.patch
)
b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028'
'e1e3d2dd5f4c79bb6c0235236ba5c092d3d2ff07175125947d01817f014652b5ebf93710270189cc06c03a96172627adeaf495607c360f2470f62bca2a6a55ba'
'bd75129644bd11caed8d9d1e2d5bbbced59bcdcb7784c3defe9a48b4c4de09adde59626456b0bc8c789d2e1e4844c21a7f2e5795d9eefbb548914af1ca8a60ae')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
# default is 'linux' substitute custom name here
_kernelname=linux
_kernver="$(</usr/src/$_kernelname/version)"
_extradir="/usr/lib/modules/$_kernver/extramodules"
prepare() {
sh "${_pkg}.run" --extract-only
cd "${_pkg}"
# seems manjaro is keeping this current
# https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx
(patch -p1 --no-backup-if-mismatch -i "$srcdir"/kernel-5.7.patch)
# https://launchpad.net/~kelebek333/+archive/ubuntu/nvidia-legacy/+packages
# the following was extracted from
# https://launchpadlibrarian.net/492468557/nvidia-graphics-drivers-340_340.108-1lmtrfocal3_340.108-2lmtrfocal.diff.gz
(cd kernel && patch -p1 --no-backup-if-mismatch -i "$srcdir"/buildfix_kernel_5.8.patch)
cp -a kernel kernel-dkms
}
build() {
cd "${_pkg}/kernel"
make SYSSRC="/usr/src/$_kernelname" module
cd uvm
make SYSSRC="/usr/src/$_kernelname" module
}
package_nvidia-340xx() {
pkgdesc="NVIDIA drivers for linux, 340xx legacy branch"
depends=('linux>=5.3.6' "nvidia-340xx-utils=$pkgver" 'libgl')
install -Dt "${pkgdir}${_extradir}" -m644 \
"${srcdir}/${_pkg}/kernel"/{nvidia,uvm/nvidia-uvm}.ko
find "${pkgdir}" -name '*.ko' -exec gzip -n {} +
echo "blacklist nouveau" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/nvidia-340xx.conf"
}
package_nvidia-340xx-dkms() {
pkgdesc="NVIDIA driver sources for linux, 340xx legacy branch"
depends=('dkms' "nvidia-340xx-utils=$pkgver" 'libgl')
optdepends=('linux-headers: Build the module for Arch kernel')
provides=("nvidia-340xx=$pkgver")
conflicts+=('nvidia-340xx')
cd "${_pkg}"
install -dm 755 "${pkgdir}"/usr/src
cp -dr --no-preserve='ownership' kernel-dkms "${pkgdir}/usr/src/nvidia-${pkgver}"
cat "${pkgdir}"/usr/src/nvidia-${pkgver}/uvm/dkms.conf.fragment >> "${pkgdir}"/usr/src/nvidia-${pkgver}/dkms.conf
echo "blacklist nouveau" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
}
# 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