summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core/nvidia-390xx-settings/PKGBUILD64
-rw-r--r--abs/core/nvidia-390xx-settings/libxnvctrl_so.patch67
-rw-r--r--abs/core/nvidia-390xx-utils/PKGBUILD168
-rw-r--r--abs/core/nvidia-390xx-utils/nvidia-390xx-utils.install7
-rw-r--r--abs/core/nvidia-390xx-utils/nvidia-390xx-utils.sysusers1
-rw-r--r--abs/core/nvidia-390xx-utils/nvidia-drm-outputclass.conf15
-rw-r--r--abs/core/nvidia-390xx/PKGBUILD87
-rw-r--r--abs/core/nvidia-390xx/kernel-4.16.patch33
8 files changed, 442 insertions, 0 deletions
diff --git a/abs/core/nvidia-390xx-settings/PKGBUILD b/abs/core/nvidia-390xx-settings/PKGBUILD
new file mode 100644
index 0000000..1d76904
--- /dev/null
+++ b/abs/core/nvidia-390xx-settings/PKGBUILD
@@ -0,0 +1,64 @@
+# Maintainer: Sven-Hendrik Haase <svenstaro@gmail.com>
+
+pkgbase=nvidia-390xx-settings
+pkgname=('nvidia-390xx-settings' 'libxnvctrl-390xx')
+pkgver=390.116
+pkgrel=1
+pkgdesc='Tool for configuring the NVIDIA graphics driver, 390xx legacy branch'
+url='https://github.com/NVIDIA/nvidia-settings'
+arch=('x86_64')
+license=('GPL2')
+makedepends=('git' 'inetutils' 'gtk2' 'jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-390xx-utils' 'libxext')
+options=('staticlibs')
+source=(nvidia-settings-${pkgver}.tar.gz::https://github.com/NVIDIA/nvidia-settings/archive/${pkgver}.tar.gz
+ libxnvctrl_so.patch)
+sha512sums=('81d15c4e969b8d5cc02749e9fa32d6ab75f2bccfcfd1d2d74dca4954384df730e50f774c7df45ae915fc64bb7369f438fab2d4d695044e0ba1d6d5db44875751'
+ 'f69f5dc84fe624579a3c9ce877f4ae4e34c2184877576afbea07b8abdd7ff01e470517f2b77cd11a904518cbcb83fb388ca1d08888006f0ef2854723920c9cf8')
+
+prepare() {
+ export PREFIX=/usr
+ export NV_USE_BUNDLED_LIBJANSSON=0
+ cd nvidia-settings-${pkgver}
+ patch -p1 < "${srcdir}/libxnvctrl_so.patch"
+}
+
+build() {
+ cd nvidia-settings-${pkgver}
+ make
+ make -C src/libXNVCtrl
+}
+
+package_nvidia-390xx-settings() {
+ depends=('jansson' 'gtk3' 'libxv' 'libvdpau' 'nvidia-390xx-utils' 'libxnvctrl-390xx')
+ conflicts=('nvidia-settings')
+ provides=('nvidia-settings')
+
+ cd nvidia-settings-${pkgver}
+ make DESTDIR="${pkgdir}" install
+
+ install -D -m644 doc/nvidia-settings.desktop "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+ install -D -m644 doc/nvidia-settings.png "${pkgdir}/usr/share/pixmaps/nvidia-settings.png"
+ sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "${pkgdir}/usr/share/applications/nvidia-settings.desktop"
+
+ rm "$pkgdir/usr/lib/libnvidia-gtk2.so.$pkgver"
+}
+
+package_libxnvctrl-390xx() {
+ depends=('libxext')
+ conflicts=('libxnvctrl')
+ provides=('libxnvctrl')
+ pkgdesc='NVIDIA NV-CONTROL X extension, 390xx legacy branch'
+
+ cd nvidia-settings-${pkgver}
+ install -Dm 644 doc/{NV-CONTROL-API.txt,FRAMELOCK.txt} -t "${pkgdir}/usr/share/doc/${pkgname}"
+ install -Dm 644 samples/{Makefile,README,*.c,*.h,*.mk} -t "${pkgdir}/usr/share/doc/${pkgname}/samples"
+
+ cd src/libXNVCtrl
+ install -Dm 644 *.h -t "${pkgdir}/usr/include/NVCtrl"
+ install -Dm 644 libXNVCtrl.a -t "${pkgdir}/usr/lib"
+ install -Dm 755 libXNVCtrl.so.0.0.0 -t "${pkgdir}/usr/lib"
+ ln -s libXNVCtrl.so.0.0.0 "${pkgdir}/usr/lib/libXNVCtrl.so.0"
+ ln -s libXNVCtrl.so.0 "${pkgdir}/usr/lib/libXNVCtrl.so"
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/abs/core/nvidia-390xx-settings/libxnvctrl_so.patch b/abs/core/nvidia-390xx-settings/libxnvctrl_so.patch
new file mode 100644
index 0000000..724064e
--- /dev/null
+++ b/abs/core/nvidia-390xx-settings/libxnvctrl_so.patch
@@ -0,0 +1,67 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -106,6 +106,8 @@
+ XNVCTRL_DIR ?= libXNVCtrl
+ XNVCTRL_MAKEFILE ?= Makefile
+ XNVCTRL_ARCHIVE ?= $(XNVCTRL_DIR)/libXNVCtrl.a
++XNVCTRL_SHARED ?= $(XNVCTRL_DIR)/libXNVCtrl.so.0
++XNVCTRL_LIB ?= $(XNVCTRL_SHARED)
+ XCONFIG_PARSER_DIR ?= XF86Config-parser
+ COMMON_UTILS_DIR ?= common-utils
+ COMMON_UNIX_DIR ?= common-unix
+@@ -280,15 +282,18 @@
+ $(MKDIR) $(BINDIR)
+ $(INSTALL) $(INSTALL_BIN_ARGS) $< $(BINDIR)/$(notdir $<)
+
++$(XNVCTRL_ARCHIVE) $(XNVCTRL_SHARED):
++ $(MAKE) -C $(XNVCTRL_DIR)
++
+ $(eval $(call DEBUG_INFO_RULES, $(NVIDIA_SETTINGS)))
+-$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_ARCHIVE)
++$(NVIDIA_SETTINGS).unstripped: $(OBJS) $(XNVCTRL_LIB)
+ $(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
+- -rdynamic -o $@ $(OBJS) $(XNVCTRL_ARCHIVE) $(LIBS)
++ -rdynamic -o $@ $(OBJS) $(XNVCTRL_LIB) $(LIBS)
+
+ $(eval $(call DEBUG_INFO_RULES, $(GTK2LIB)))
+ $(GTK2LIB).unstripped: $(GTK2_OBJS) $(XCP_OBJS) $(IMAGE_OBJS) $(VERSION_MK)
+ $(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
+- $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK2_LIBS) \
++ $(XNVCTRL_LIB) $(LIBS) $(GTK2_LIBS) \
+ -Wl,--unresolved-symbols=ignore-all -o $@ \
+ -Wl,-soname -Wl,$(GTK2LIB_SONAME) \
+ $(GTK2_OBJS) $(XCP_OBJS)
+@@ -297,7 +302,7 @@
+ $(eval $(call DEBUG_INFO_RULES, $(GTK3LIB)))
+ $(GTK3LIB).unstripped: $(GTK3_OBJS) $(XCP_OBJS) $(VERSION_MK)
+ $(call quiet_cmd,LINK) -shared $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) \
+- $(XNVCTRL_ARCHIVE) $(LIBS) $(GTK3_LIBS) \
++ $(XNVCTRL_LIB) $(LIBS) $(GTK3_LIBS) \
+ -Wl,--unresolved-symbols=ignore-all -o $@ \
+ -Wl,-soname -Wl,$(GTK3LIB_SONAME) \
+ $(GTK3_OBJS) $(XCP_OBJS)
+--- a/src/libXNVCtrl/Makefile
++++ b/src/libXNVCtrl/Makefile
+@@ -55,10 +55,17 @@
+ .PHONY: clean
+
+ all: $(LIBXNVCTRL)
++all: libXNVCtrl.so
+
+ $(LIBXNVCTRL) : $(OBJS)
+ $(AR) ru $@ $(OBJS)
+
++libXNVCtrl.so: $(OBJS)
++ $(RM) $@ $@.*
++ $(CC) -shared -Wl,-soname=$@.0 -o $@.0.0.0 $(LDFLAGS) $^ -lXext -lX11
++ ln -s $@.0.0.0 $@.0
++ ln -s $@.0 $@
++
+ # define the rule to build each object file
+ $(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
+
+@@ -68,3 +75,4 @@
+ clean:
+ rm -rf $(LIBXNVCTRL) *~ $(STAMP_C) \
+ $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d
++ rm -f libXNVCtrl.so libXNVCtrl.so.*
diff --git a/abs/core/nvidia-390xx-utils/PKGBUILD b/abs/core/nvidia-390xx-utils/PKGBUILD
new file mode 100644
index 0000000..3d413d1
--- /dev/null
+++ b/abs/core/nvidia-390xx-utils/PKGBUILD
@@ -0,0 +1,168 @@
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Maintainer: Thomas Baechler <thomas@archlinux.org>
+# Contributor: James Rayner <iphitus@gmail.com>
+
+pkgbase=nvidia-390xx-utils
+pkgname=('nvidia-390xx-utils' 'opencl-nvidia-390xx')
+pkgver=390.116
+pkgrel=1
+arch=('x86_64')
+url="http://www.nvidia.com/"
+license=('custom')
+options=('!strip')
+source=('nvidia-drm-outputclass.conf'
+ 'nvidia-390xx-utils.sysusers'
+ "http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run")
+sha512sums=('c49d246a519731bfab9d22afa5c2dd2d366db06d80182738b84881e93cd697c783f16ee04819275c05597bb063451a5d6102fbc562cd078d2a374533a23cea48'
+ '4b3ad73f5076ba90fe0b3a2e712ac9cde76f469cd8070280f960c3ce7dc502d1927f525ae18d008075c8f08ea432f7be0a6c3a7a6b49c361126dcf42f97ec499'
+ '842e57b479d833a40fe1e8ecf72217c43d71a07e91cb4b6d14bd3b6326a0ef035e6423c15849ccc23ff82d2740ae8c21a9742502b958bd748736abac5e7d9f1e')
+
+_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
+
+create_links() {
+ # create soname links
+ find "$pkgdir" -type f -name '*.so*' ! -path '*xorg/*' -print0 | while read -d $'\0' _lib; do
+ _soname=$(dirname "${_lib}")/$(readelf -d "${_lib}" | grep -Po 'SONAME.*: \[\K[^]]*' || true)
+ _base=$(echo ${_soname} | sed -r 's/(.*).so.*/\1.so/')
+ [[ -e "${_soname}" ]] || ln -s $(basename "${_lib}") "${_soname}"
+ [[ -e "${_base}" ]] || ln -s $(basename "${_soname}") "${_base}"
+ done
+}
+
+prepare() {
+ sh "${_pkg}.run" --extract-only
+ cd "${_pkg}"
+ bsdtar -xf nvidia-persistenced-init.tar.bz2
+
+ sed -i 's/__NV_VK_ICD__/libGLX_nvidia.so.0/' nvidia_icd.json.template
+}
+
+package_opencl-nvidia-390xx() {
+ pkgdesc="OpenCL implemention for NVIDIA"
+ depends=('zlib')
+ optdepends=('opencl-headers: headers necessary for OpenCL development')
+ conflicts=('opencl-nvidia')
+ provides=('opencl-nvidia' 'opencl-driver')
+ cd "${_pkg}"
+
+ # OpenCL
+ install -D -m644 nvidia.icd "${pkgdir}/etc/OpenCL/vendors/nvidia.icd"
+ install -D -m755 "libnvidia-compiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-compiler.so.${pkgver}"
+ install -D -m755 "libnvidia-opencl.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-opencl.so.${pkgver}"
+
+ create_links
+
+ mkdir -p "${pkgdir}/usr/share/licenses"
+ ln -s nvidia "${pkgdir}/usr/share/licenses/opencl-nvidia"
+}
+
+package_nvidia-390xx-utils() {
+ pkgdesc="NVIDIA drivers utilities"
+ depends=('xorg-server' 'libglvnd' 'egl-wayland')
+ optdepends=('nvidia-390xx-settings: configuration tool'
+ 'xorg-server-devel: nvidia-xconfig'
+ 'opencl-nvidia-390xx: OpenCL support')
+ conflicts=('nvidia-390xx-libgl' 'nvidia-utils' 'nvidia-libgl')
+ provides=('vulkan-driver' 'opengl-driver' 'nvidia-utils' 'nvidia-390xx-libgl' 'nvidia-libgl')
+ replaces=('nvidia-390xx-libgl')
+ install="${pkgname}.install"
+
+ cd "${_pkg}"
+
+ # X driver
+ install -D -m755 nvidia_drv.so "${pkgdir}/usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+ # GLX extension module for X
+ install -D -m755 "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so.${pkgver}"
+ ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so.1" # X doesn't find glx otherwise
+ ln -s "libglx.so.${pkgver}" "${pkgdir}/usr/lib/nvidia/xorg/libglx.so" # X doesn't find glx otherwise
+
+ install -D -m755 "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_nvidia.so.${pkgver}"
+ # now in mesa driver
+ #ln -s "libGLX_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLX_indirect.so.0"
+
+ # OpenGL libraries
+ install -D -m755 "libEGL_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libEGL_nvidia.so.${pkgver}"
+ install -D -m755 "libGLESv1_CM_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv1_CM_nvidia.so.${pkgver}"
+ install -D -m755 "libGLESv2_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/libGLESv2_nvidia.so.${pkgver}"
+ install -D -m644 "10_nvidia.json" "${pkgdir}/usr/share/glvnd/egl_vendor.d/10_nvidia.json"
+
+ # OpenGL core library
+ install -D -m755 "libnvidia-glcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glcore.so.${pkgver}"
+ install -D -m755 "libnvidia-eglcore.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-eglcore.so.${pkgver}"
+ install -D -m755 "libnvidia-glsi.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-glsi.so.${pkgver}"
+
+ # misc
+ install -D -m755 "libnvidia-ifr.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ifr.so.${pkgver}"
+ install -D -m755 "libnvidia-fbc.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fbc.so.${pkgver}"
+ install -D -m755 "libnvidia-encode.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-encode.so.${pkgver}"
+ install -D -m755 "libnvidia-cfg.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-cfg.so.${pkgver}"
+ install -D -m755 "libnvidia-ml.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ml.so.${pkgver}"
+
+ # Vulkan ICD
+ install -D -m644 "nvidia_icd.json.template" "${pkgdir}/usr/share/vulkan/icd.d/nvidia_icd.json"
+
+ # VDPAU
+ install -D -m755 "libvdpau_nvidia.so.${pkgver}" "${pkgdir}/usr/lib/vdpau/libvdpau_nvidia.so.${pkgver}"
+
+ # nvidia-tls library
+ install -D -m755 "libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-tls.so.${pkgver}"
+ install -D -m755 "tls/libnvidia-tls.so.${pkgver}" "${pkgdir}/usr/lib/tls/libnvidia-tls.so.${pkgver}"
+
+ # CUDA
+ install -D -m755 "libcuda.so.${pkgver}" "${pkgdir}/usr/lib/libcuda.so.${pkgver}"
+ install -D -m755 "libnvcuvid.so.${pkgver}" "${pkgdir}/usr/lib/libnvcuvid.so.${pkgver}"
+
+ # PTX JIT Compiler (Parallel Thread Execution (PTX) is a pseudo-assembly language for CUDA)
+ install -D -m755 "libnvidia-ptxjitcompiler.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-ptxjitcompiler.so.${pkgver}"
+
+ # Fat (multiarchitecture) binary loader
+ install -D -m755 "libnvidia-fatbinaryloader.so.${pkgver}" "${pkgdir}/usr/lib/libnvidia-fatbinaryloader.so.${pkgver}"
+
+ # DEBUG
+ install -D -m755 nvidia-debugdump "${pkgdir}/usr/bin/nvidia-debugdump"
+
+ # nvidia-xconfig
+ install -D -m755 nvidia-xconfig "${pkgdir}/usr/bin/nvidia-xconfig"
+ install -D -m644 nvidia-xconfig.1.gz "${pkgdir}/usr/share/man/man1/nvidia-xconfig.1.gz"
+
+ # nvidia-bug-report
+ install -D -m755 nvidia-bug-report.sh "${pkgdir}/usr/bin/nvidia-bug-report.sh"
+
+ # nvidia-smi
+ install -D -m755 nvidia-smi "${pkgdir}/usr/bin/nvidia-smi"
+ install -D -m644 nvidia-smi.1.gz "${pkgdir}/usr/share/man/man1/nvidia-smi.1.gz"
+
+ # nvidia-cuda-mps
+ install -D -m755 nvidia-cuda-mps-server "${pkgdir}/usr/bin/nvidia-cuda-mps-server"
+ install -D -m755 nvidia-cuda-mps-control "${pkgdir}/usr/bin/nvidia-cuda-mps-control"
+ install -D -m644 nvidia-cuda-mps-control.1.gz "${pkgdir}/usr/share/man/man1/nvidia-cuda-mps-control.1.gz"
+
+ # nvidia-modprobe
+ # This should be removed if nvidia fixed their uvm module!
+ install -D -m4755 nvidia-modprobe "${pkgdir}/usr/bin/nvidia-modprobe"
+ install -D -m644 nvidia-modprobe.1.gz "${pkgdir}/usr/share/man/man1/nvidia-modprobe.1.gz"
+
+ # nvidia-persistenced
+ install -D -m755 nvidia-persistenced "${pkgdir}/usr/bin/nvidia-persistenced"
+ install -D -m644 nvidia-persistenced.1.gz "${pkgdir}/usr/share/man/man1/nvidia-persistenced.1.gz"
+ install -D -m644 nvidia-persistenced-init/systemd/nvidia-persistenced.service.template "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
+ sed -i 's/__USER__/nvidia-persistenced/' "${pkgdir}/usr/lib/systemd/system/nvidia-persistenced.service"
+
+ # application profiles
+ install -D -m644 nvidia-application-profiles-${pkgver}-rc "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-rc"
+ install -D -m644 nvidia-application-profiles-${pkgver}-key-documentation "${pkgdir}/usr/share/nvidia/nvidia-application-profiles-${pkgver}-key-documentation"
+
+ install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/nvidia-utils/LICENSE"
+ install -D -m644 README.txt "${pkgdir}/usr/share/doc/nvidia/README"
+ install -D -m644 NVIDIA_Changelog "${pkgdir}/usr/share/doc/nvidia/NVIDIA_Changelog"
+ cp -r html "${pkgdir}/usr/share/doc/nvidia/"
+ ln -s nvidia "${pkgdir}/usr/share/doc/nvidia-utils"
+
+ # distro specific files must be installed in /usr/share/X11/xorg.conf.d
+ install -D -m644 "${srcdir}/nvidia-drm-outputclass.conf" "${pkgdir}/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf"
+
+ install -Dm644 "${srcdir}/nvidia-390xx-utils.sysusers" "${pkgdir}/usr/lib/sysusers.d/$pkgname.conf"
+
+ create_links
+}
diff --git a/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.install b/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.install
new file mode 100644
index 0000000..47847c7
--- /dev/null
+++ b/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.install
@@ -0,0 +1,7 @@
+post_upgrade() {
+ echo "If you run into trouble with CUDA not being available, run nvidia-modprobe first."
+}
+
+post_install() {
+ post_upgrade
+}
diff --git a/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.sysusers b/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.sysusers
new file mode 100644
index 0000000..71c0608
--- /dev/null
+++ b/abs/core/nvidia-390xx-utils/nvidia-390xx-utils.sysusers
@@ -0,0 +1 @@
+u nvidia-persistenced 143 'NVIDIA Persistence Daemon'
diff --git a/abs/core/nvidia-390xx-utils/nvidia-drm-outputclass.conf b/abs/core/nvidia-390xx-utils/nvidia-drm-outputclass.conf
new file mode 100644
index 0000000..dd2936c
--- /dev/null
+++ b/abs/core/nvidia-390xx-utils/nvidia-drm-outputclass.conf
@@ -0,0 +1,15 @@
+Section "OutputClass"
+ Identifier "intel"
+ MatchDriver "i915"
+ Driver "modesetting"
+EndSection
+
+Section "OutputClass"
+ Identifier "nvidia"
+ MatchDriver "nvidia-drm"
+ Driver "nvidia"
+ Option "AllowEmptyInitialConfiguration"
+ Option "PrimaryGPU" "yes"
+ ModulePath "/usr/lib/nvidia/xorg"
+ ModulePath "/usr/lib/xorg/modules"
+EndSection
diff --git a/abs/core/nvidia-390xx/PKGBUILD b/abs/core/nvidia-390xx/PKGBUILD
new file mode 100644
index 0000000..644790d
--- /dev/null
+++ b/abs/core/nvidia-390xx/PKGBUILD
@@ -0,0 +1,87 @@
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Maintainer: Felix Yan <felixonmars@archlinux.org>
+# Contributor: Thomas Baechler <thomas@archlinux.org>
+
+pkgbase=nvidia-390xx
+pkgname=(nvidia-390xx nvidia-390xx-dkms)
+pkgver=390.116
+_extramodules=extramodules-4.9-ARCH
+pkgrel=3
+pkgdesc="NVIDIA drivers for linux, 390xx legacy branch"
+arch=('x86_64')
+url="http://www.nvidia.com/"
+makedepends=("nvidia-390xx-utils=${pkgver}" 'libglvnd' 'linux' 'linux-headers>=4.9' 'linux-headers<4.10')
+conflicts=('nvidia')
+license=('custom')
+options=('!strip')
+_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
+source=("http://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/${_pkg}.run"
+ kernel-4.16.patch)
+sha256sums=('de85a2eea39ca16e25645b345259b01fbe858b833286b7e6785afa273009ef6f'
+ '622ac792ec200b2239cb663c0010392118b78c9904973d82cd261165c16d6385')
+
+prepare() {
+ sh "${_pkg}.run" --extract-only
+ cd "${_pkg}"
+
+ # Restore phys_to_dma support (still needed for 396.18)
+ # https://bugs.archlinux.org/task/58074
+ patch -Np1 -i ../kernel-4.16.patch
+
+ cp -a kernel kernel-dkms
+ cd kernel-dkms
+ sed -i "s/__VERSION_STRING/${pkgver}/" dkms.conf
+ sed -i 's/__JOBS/`nproc`/' dkms.conf
+ sed -i 's/__DKMS_MODULES//' dkms.conf
+ sed -i '$iBUILT_MODULE_NAME[0]="nvidia"\
+DEST_MODULE_LOCATION[0]="/kernel/drivers/video"\
+BUILT_MODULE_NAME[1]="nvidia-uvm"\
+DEST_MODULE_LOCATION[1]="/kernel/drivers/video"\
+BUILT_MODULE_NAME[2]="nvidia-modeset"\
+DEST_MODULE_LOCATION[2]="/kernel/drivers/video"\
+BUILT_MODULE_NAME[3]="nvidia-drm"\
+DEST_MODULE_LOCATION[3]="/kernel/drivers/video"' dkms.conf
+
+ # Gift for linux-rt guys
+ sed -i 's/NV_EXCLUDE_BUILD_MODULES/IGNORE_PREEMPT_RT_PRESENCE=1 NV_EXCLUDE_BUILD_MODULES/' dkms.conf
+}
+
+build() {
+ _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"
+ cd "${_pkg}"/kernel
+ make SYSSRC=/usr/lib/modules/"${_kernver}/build" module
+}
+
+package_nvidia-390xx() {
+ pkgdesc="NVIDIA drivers for linux, 390xx legacy branch"
+ depends=('linux>=4.9' 'linux<4.10' "nvidia-390xx-utils=${pkgver}" 'libglvnd')
+
+ install -Dt "${pkgdir}/usr/lib/modules/${_extramodules}" -m644 \
+ "${srcdir}/${_pkg}/kernel"/nvidia{,-modeset,-drm,-uvm}.ko
+
+ find "${pkgdir}" -name '*.ko' -exec gzip -n {} +
+
+ echo "blacklist nouveau" |
+ install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modprobe.d/${pkgname}.conf"
+
+ install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
+}
+
+package_nvidia-390xx-dkms() {
+ pkgdesc="NVIDIA driver sources for linux, 390xx legacy branch"
+ depends=('dkms' "nvidia-390xx-utils=$pkgver" 'libglvnd')
+ optdepends=('linux-headers: Build the module for Arch kernel'
+ 'linux-lts-headers: Build the module for LTS Arch kernel')
+ provides=("nvidia-390xx=$pkgver")
+ conflicts+=('nvidia-390xx')
+
+ 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/${pkgname}.conf"
+
+ install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 "${srcdir}/${_pkg}/LICENSE"
+}
diff --git a/abs/core/nvidia-390xx/kernel-4.16.patch b/abs/core/nvidia-390xx/kernel-4.16.patch
new file mode 100644
index 0000000..6717281
--- /dev/null
+++ b/abs/core/nvidia-390xx/kernel-4.16.patch
@@ -0,0 +1,33 @@
+diff --git a/kernel/common/inc/nv-linux.h b/kernel/common/inc/nv-linux.h
+index 10fc418..22ef968 100644
+--- a/kernel/common/inc/nv-linux.h
++++ b/kernel/common/inc/nv-linux.h
+@@ -175,7 +175,11 @@ static inline uid_t __kuid_val(kuid_t uid)
+
+ #if defined(NV_VM_INSERT_PAGE_PRESENT)
+ #include <linux/pagemap.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+ #include <linux/dma-mapping.h>
++#else
++#include <linux/dma-direct.h>
++#endif
+ #endif
+
+ #if defined(CONFIG_SWIOTLB) && defined(NVCPU_AARCH64)
+diff --git a/kernel/conftest.sh b/kernel/conftest.sh
+index b23dbb4..42dc576 100755
+--- a/kernel/conftest.sh
++++ b/kernel/conftest.sh
+@@ -1906,7 +1906,12 @@ compile_test() {
+ # Determine if the phys_to_dma function is present.
+ #
+ CODE="
++ #include <linux/version.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
+ #include <linux/dma-mapping.h>
++#else
++ #include <linux/dma-direct.h>
++#endif
+ void conftest_phys_to_dma(void) {
+ phys_to_dma();
+ }"