PKGBUILD 3.2 KB
Newer Older
Mark Wagie's avatar
Mark Wagie committed
1
2
# Contributor: Sven-Hendrik Haase <svenstaro@archlinux.org>

Mark Wagie's avatar
Mark Wagie committed
3
# https://us.download.nvidia.com/XFree86/Linux-x86_64/515.48.07/README/kernel_open.html
Mark Wagie's avatar
Mark Wagie committed
4
5

pkgname=nvidia-open-dkms
Mark Wagie's avatar
Mark Wagie committed
6
7
pkgver=515.48.07
pkgrel=1
Mark Wagie's avatar
Mark Wagie committed
8
9
10
11
pkgdesc="NVIDIA open kernel modules"
arch=('x86_64')
url="https://github.com/NVIDIA/open-gpu-kernel-modules"
depends=('dkms' "nvidia-utils=${pkgver}" 'libglvnd')
Mark Wagie's avatar
Mark Wagie committed
12
makedepends=('auth-tarball-from-git' 'linux-headers')
Mark Wagie's avatar
Mark Wagie committed
13
14
license=('GPL')
options=('!lto' '!buildflags')
15
16
provides=('nvidia-open' 'NVIDIA-MODULE')
conflicts=('nvidia-open' 'NVIDIA-MODULE')
Mark Wagie's avatar
Mark Wagie committed
17
18
19
20
source=("$pkgname-$pkgver.tar.gz::https://github.com/NVIDIA/open-gpu-kernel-modules/archive/refs/tags/${pkgver}.tar.gz"
        'andy.pgp') # Andy Ritger <aritger@nvidia.com>
sha512sums=('b5f8b608343c93e0755d0c847d472a68f773c9d9ffb268462489d3d4aad3ab0abe8fb11860ec637abea135bda4eef55c4ffd00d4f817fa48161b5908a09bdf34'
            'a1e1ee8bec37158dcdcf4f6b16c1e1faf746f8fb676a276590712bb039c6f761797a8550b9545e68421b0388f80804565839e8cef518577580c7193cfa7dfc27')
Mark Wagie's avatar
Mark Wagie committed
21
22
23

prepare() {
  cd open-gpu-kernel-modules-${pkgver}
Mark Wagie's avatar
Mark Wagie committed
24
25
26
27
  auth-tarball-from-git --keyring ../andy.pgp \
    --tag ${pkgver} --prefix open-gpu-kernel-modules-${pkgver} \
    https://github.com/NVIDIA/open-gpu-kernel-modules.git ../${pkgname}-${pkgver}.tar.gz

Mark Wagie's avatar
Mark Wagie committed
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  # Attempt to make this reproducible
  sed -i "s/^HOSTNAME.*/HOSTNAME = echo manjarolinux"/ utils.mk
  sed -i "s/^WHOAMI.*/WHOAMI = echo manjarolinux-builder"/ utils.mk
  sed -i "s/^DATE.*/DATE = date -r version.mk"/ utils.mk

  sed -i "s/__VERSION_STRING/${pkgver}/" kernel-open/dkms.conf
  sed -i 's/__JOBS/`nproc`/' kernel-open/dkms.conf
  sed -i 's/__EXCLUDE_MODULES//' kernel-open/dkms.conf
  sed -i 's/__DKMS_MODULES//' kernel-open/dkms.conf
  sed -i '$i\
BUILT_MODULE_NAME[0]="nvidia"\
BUILT_MODULE_LOCATION[0]="kernel-open"\
DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
BUILT_MODULE_NAME[1]="nvidia-uvm"\
BUILT_MODULE_LOCATION[1]="kernel-open"\
DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
BUILT_MODULE_NAME[2]="nvidia-modeset"\
BUILT_MODULE_LOCATION[2]="kernel-open"\
DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
BUILT_MODULE_NAME[3]="nvidia-drm"\
BUILT_MODULE_LOCATION[3]="kernel-open"\
DEST_MODULE_LOCATION[3]="/kernel/drivers/video"\
BUILT_MODULE_NAME[4]="nvidia-peermem"\
BUILT_MODULE_LOCATION[4]="kernel-open"\
DEST_MODULE_LOCATION[4]="/kernel/drivers/video"' kernel-open/dkms.conf

  # Clean version for later copying for DKMS
  cp -r ../open-gpu-kernel-modules-${pkgver} "$srcdir"/open-gpu-kernel-modules-dkms
}

build() {
Mark Wagie's avatar
Mark Wagie committed
59
  _kernver="$(uname -r)"
Mark Wagie's avatar
Mark Wagie committed
60
  cd open-gpu-kernel-modules-${pkgver}
Mark Wagie's avatar
Mark Wagie committed
61
  make SYSSRC=/usr/lib/modules/"${_kernver}/build"
Mark Wagie's avatar
Mark Wagie committed
62
63
64
65
66
67
68
69
70
71
72
73
}

package() {
  install -dm 755 "${pkgdir}"/usr/src
  # cp -dr --no-preserve='ownership' kernel-open "${pkgdir}/usr/src/nvidia-$pkgver"
  cp -dr --no-preserve='ownership' open-gpu-kernel-modules-dkms "${pkgdir}/usr/src/nvidia-$pkgver"
  mv "${pkgdir}/usr/src/nvidia-$pkgver/kernel-open/dkms.conf" "${pkgdir}/usr/src/nvidia-$pkgver/dkms.conf"

  # Force module to load even on unsupported GPUs
  mkdir -p "$pkgdir"/usr/lib/modprobe.d
  echo "options nvidia NVreg_OpenRmEnableUnsupportedGpus=1" > "$pkgdir"/usr/lib/modprobe.d/nvidia-open.conf

Mark Wagie's avatar
Mark Wagie committed
74
  install -Dm644 open-gpu-kernel-modules-${pkgver}/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname/
Mark Wagie's avatar
Mark Wagie committed
75
}