From e73102c66647d651c72c12e5d0413196ba138df7 Mon Sep 17 00:00:00 2001 From: Lenard Spencer Date: Sat, 15 May 2021 10:20:04 +0200 Subject: system/nvidia-driver: Updated for version 460.73.01, cleanups. Signed-off-by: Matteo Bernardini Signed-off-by: Willy Sudiarto Raharjo --- system/nvidia-driver/README | 49 ++------ system/nvidia-driver/nvidia-driver.SlackBuild | 47 ++------ system/nvidia-driver/nvidia-driver.info | 26 ++--- .../nvidia-installer-removed-sysctl-h.patch | 36 ++++++ system/nvidia-driver/nvidia-switch | 125 --------------------- 5 files changed, 70 insertions(+), 213 deletions(-) create mode 100644 system/nvidia-driver/nvidia-installer-removed-sysctl-h.patch delete mode 100644 system/nvidia-driver/nvidia-switch diff --git a/system/nvidia-driver/README b/system/nvidia-driver/README index 9f87edbdff..fcfcc44a51 100644 --- a/system/nvidia-driver/README +++ b/system/nvidia-driver/README @@ -1,21 +1,14 @@ This is the proprietary binary video driver from NVidia for the X.Org -X-server. This package does not include the kernel-module - it is +X-server. This package does not include the kernel-module - it is a part of the nvidia-kernel package at SlackBuilds.org. -NOTE: This driver is ONLY for Slackware64. For x86 32-bit support, use -nvidia-legacy390-{driver,kernel}. +NOTE: 64-bit x86_64 support ONLY for Slackware64. For x86 32-bit +support, use nvidia-legacy390-{driver,kernel} Installing the 32-bit compatibility libraries is available: if desired, do: - COMPAT32="yes" ./nvidia-driver.SlackBuild - -If you plan to test this buildscript on current/15.0, do: - CURRENT="yes" ./nvidia-driver.SlackBuild - -This avoids stomping on the libglvnd libraries, plus it forces the -script to use the prebuilt nvidia-installer since it no longer builds -in current. As a consequence, this script may no longer work in a VM. + COMPAT32="yes" ./nvidia-driver.SlackBuild This script now gives the option of installing the nvidia-persitenced daemon. For details, see README.nvidia-persitenced. @@ -26,12 +19,11 @@ man pages for details and usage. For CUDA/OpenCL to work after reboot, and for utilites such as nvidia-smi, you might need to include the following line in your -/etc/rc.d/rc.local (This is REQUIRED for nvidia-persistenced to work): +/etc/rc.d/rc.local: +(This is required if you plan on running nvidia-persistenced) # Create missing nvidia device nodes after reboot - if [ -x /usr/bin/nvidia-modprobe ]; then - /usr/bin/nvidia-modprobe -c 0 -u - fi + /usr/bin/nvidia-modprobe -c 0 -u Notes: 1. You still need to blacklist the open source nouveau driver. @@ -42,26 +34,9 @@ Notes: a prompt to remove the existing driver (it is not necessary to remove the kernel module). -3. As of version 450.xx, Nvidia no longer includes libGL.la in their - distribution package. On 14.2 ONLY, nvidia-switch saves these - files to /var/log/nvidia/{32,64}: - - libGL{,ESv1_CM,ESv2}.la - libGL.so.1.2.0 - libGLESv1_cm.so.1.1.0 - libGLESv2.so.2.0.0 - - It then modifies the .la files in /usr/lib{,64} to point to the - nvidia versions of these libraries. If you want to revert back to - the open source drivers, run 'nvidia-switch --remove' to restore - the original mesa libraries, then 'removepkg nvidia-driver' - "should" work in most cases. If you forget to run - nvidia-switch --remove, just copy the original files saved in - /var/log/nvidia/{32,64} back to /usr/lib{,64} (don't forget to run - /sbin/ldconfig). (THIS STEP IS NOT NECESSARY ON CURRENT.) +3. With Slackware 15.0, nvidia-switch has been dropped once and for + all as there are no longer any conflicts. -4. (IMPORTANT ON 14.2) When it comes time to remove this package with - 'removepkg' (or just about any other package for that matter), you - MUST run '/sbin/ldconfig' to restore any symlinks. This is due to - removepkg not running ldconfig after removing a package. - (This has been added to current/15.0.) +CAUTION! Please DO NOT USE this script for Slackware(64) versions 14.2 +or older as it WILL corrupt the mesa and xorg installations. +Please use the script from those repos instead. diff --git a/system/nvidia-driver/nvidia-driver.SlackBuild b/system/nvidia-driver/nvidia-driver.SlackBuild index e8e7cf0a8b..9e7cccdc8e 100644 --- a/system/nvidia-driver/nvidia-driver.SlackBuild +++ b/system/nvidia-driver/nvidia-driver.SlackBuild @@ -27,12 +27,10 @@ # see changelog.txt PRGNAM=nvidia-driver -VERSION=${VERSION:-460.67} +VERSION=${VERSION:-460.73.01} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -CURRENT=${CURRENT:-no} - set -e if [ -z "$ARCH" ]; then @@ -104,9 +102,12 @@ find -L . \ # Compiling the various open source apps instead of using the precompiled binaries # Compiling nvidia-installer from source -if [ "$CURRENT" = "no" ]; then + cd $TMP/nvidia-installer-$VERSION +# First, we must patch for the removed sys/sysctl.h: + patch -p1 < $CWD/nvidia-installer-removed-sysctl-h.patch + # Let's try to remove the conflicting files and GPU detection patch -p0 < $CWD/skip_conflict-GPU_detect.patch @@ -128,7 +129,6 @@ cd - # to the driver source tree for use mv -f $PKG/usr/bin/nvidia-installer $TMP/$SRCNAM mv -f $PKG/usr/man/man1/nvidia-installer.1.gz $TMP/$SRCNAM -fi if [ "${COMPAT32}" = "yes" ]; then COMP32="--install-compat32-libs --compat32-prefix=$PKG/usr" @@ -162,36 +162,12 @@ cd $TMP/$SRCNAM mv /etc/OpenCL/vendors/nvidia.icd $PKG/etc/OpenCL/vendors/nvidia.icd mv /etc/vulkan/icd.d/nvidia_icd.json $PKG/etc/vulkan/icd.d/nvidia_icd.json mv /etc/vulkan/implicit_layer.d/nvidia_layers.json $PKG/etc/vulkan/implicit_layer.d/nvidia_layers.json -# In current, mesa now puts an entry into this directory, so we -# leave it alone if it is not empty -if [ -z "$(ls -A /etc/OpenCL/vendors)" ]; then - rm -rf /etc/OpenCL -fi -# just in case any other programs make an entry here -if [ -z "$(ls -A /etc/vulkan)" ]; then - rm -rf /etc/vulkan -fi -if [ "$CURRENT" = "yes" ]; then -# libOpenCL.so is now included in current (in ocl-icd), +# libOpenCL.so is now included in 15.0 (in ocl-icd), # so we don't need this one. - rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.so.1.0.0 - if [ "${COMPAT32}" = "yes" ]; then - rm -f $PKG/usr/lib/libOpenCL.so.1.0.0 - fi -else -# Bash script to cleanly install (in doinst.sh) and uninstall the nvidia -# files so we don't stomp on any overlapping xorg files. -# Note: switching can be problematic ;-) - mkdir -p $PKG/var/log/nvidia/{32,64} - install -m 0755 $CWD/nvidia-switch $PKG/usr/sbin/ - sed -i s/PKGVERSION/$VERSION/g $PKG/usr/sbin/nvidia-switch - sed -i s/LIBDIRSUFFIX/$LIBDIRSUFFIX/g $PKG/usr/sbin/nvidia-switch - if [ ${COMPAT32} = "yes" ]; then - sed -i s/LIB32FLAG/yes/g $PKG/usr/sbin/nvidia-switch - else - sed -i s/LIB32FLAG/no/g $PKG/usr/sbin/nvidia-switch - fi +rm -f $PKG/usr/lib${LIBDIRSUFFIX}/libOpenCL.so.1.0.0 +if [ "${COMPAT32}" = "yes" ]; then + rm -f $PKG/usr/lib/libOpenCL.so.1.0.0 fi # Compile utilites from source, replacing the precompiled versions @@ -285,11 +261,6 @@ fi cat $CWD/doinst.sh > $PKG/install/doinst.sh -# 14.2 needs nvidia-switch, -current does not -if [ "$CURRENT" = "no" ]; then - echo -e "usr/sbin/nvidia-switch --install\n" >> $PKG/install/doinst.sh -fi - # Add rc.nvidia-persistenced: if [ "${PERSISTENCED:-no}" = "yes" ]; then cd $TMP diff --git a/system/nvidia-driver/nvidia-driver.info b/system/nvidia-driver/nvidia-driver.info index ca20a48252..fa96a87743 100644 --- a/system/nvidia-driver/nvidia-driver.info +++ b/system/nvidia-driver/nvidia-driver.info @@ -1,20 +1,20 @@ PRGNAM="nvidia-driver" -VERSION="460.67" +VERSION="460.73.01" HOMEPAGE="http://www.nvidia.com" DOWNLOAD="UNSUPPORTED" MD5SUM="" -DOWNLOAD_x86_64="https://download.nvidia.com/XFree86/Linux-x86_64/460.67/NVIDIA-Linux-x86_64-460.67.run \ - https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-460.67.tar.bz2 \ - https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-460.67.tar.bz2 \ - https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-460.67.tar.bz2 \ - https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-460.67.tar.bz2 \ - https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-460.67.tar.bz2" -MD5SUM_x86_64="0b246742eca035b702949631e2fcf6a2 \ - 4243fdeb81aa2025ef293c66d84bd223 \ - 4da687fb436dc72cc4aefc83ca9b1600 \ - 9168f7f3f896d1291f47a6f05ddf7ad9 \ - 774af9ca9829ad9f5acc9716c26ff0c8 \ - 5ee964e0519ae00f4184b49a609682c2" +DOWNLOAD_x86_64="https://download.nvidia.com/XFree86/Linux-x86_64/460.73.01/NVIDIA-Linux-x86_64-460.73.01.run \ + https://download.nvidia.com/XFree86/nvidia-installer/nvidia-installer-460.73.01.tar.bz2 \ + https://download.nvidia.com/XFree86/nvidia-modprobe/nvidia-modprobe-460.73.01.tar.bz2 \ + https://download.nvidia.com/XFree86/nvidia-persistenced/nvidia-persistenced-460.73.01.tar.bz2 \ + https://download.nvidia.com/XFree86/nvidia-settings/nvidia-settings-460.73.01.tar.bz2 \ + https://download.nvidia.com/XFree86/nvidia-xconfig/nvidia-xconfig-460.73.01.tar.bz2" +MD5SUM_x86_64="1fd578976c69866089dc3acf340d0953 \ + f44013b1a7a91e45fb270b849c7fd3d0 \ + f218d224ffe246d5c69658fe4ece519e \ + 64313ffa5574339ed8fc59dcd2a0b244 \ + 777761acc3149729baf7a71c00c690dd \ + a7f332a3926ff21bb28f4fe32cc8e492" REQUIRES="nvidia-kernel" MAINTAINER="Lenard Spencer" EMAIL="lenardrspencer@gmail.com" diff --git a/system/nvidia-driver/nvidia-installer-removed-sysctl-h.patch b/system/nvidia-driver/nvidia-installer-removed-sysctl-h.patch new file mode 100644 index 0000000000..7b230fcb11 --- /dev/null +++ b/system/nvidia-driver/nvidia-installer-removed-sysctl-h.patch @@ -0,0 +1,36 @@ +diff -Naur nvidia-installer-460.67.orig/kernel.c nvidia-installer-460.67/kernel.c +--- nvidia-installer-460.67.orig/kernel.c 2021-03-10 19:24:00.000000000 -0500 ++++ nvidia-installer-460.67/kernel.c 2021-04-16 17:59:48.828574898 -0400 +@@ -23,7 +23,10 @@ + #include + #include + #include +-#include ++#include ++#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30 ++ #include ++#endif + #include + #include + #include +@@ -1076,7 +1079,8 @@ + } + + if (!loglevel_set) { +- /* ++#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 30 ++ /* + * Explicitly initialize the value of len, even though it looks like the + * syscall should do that, since in practice it doesn't always actually + * set the value of the pointed-to length parameter. +@@ -1090,6 +1094,10 @@ + loglevel_set = TRUE; + } + } ++#else /* sys/sysctl.h has been removed from glibc 2.32 and later */ ++ if (!old_level) ++ loglevel_set = TRUE; ++#endif + } + + return loglevel_set; diff --git a/system/nvidia-driver/nvidia-switch b/system/nvidia-driver/nvidia-switch deleted file mode 100644 index 9196cf7b8a..0000000000 --- a/system/nvidia-driver/nvidia-switch +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh - -# Copyright 2012-2019 Edward W. Koenig, Vancouver, WA, USA -# Copyright 2020 Lenard Spencer, Orlando, FL, USA -# All rights reserved. -# -# Redistribution and use of this script, with or without modification, is -# permitted provided that the following conditions are met: -# -# 1. Redistributions of this script must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# nvidia-switch utility 4.7.2 -# -# A tool to install and cleanly remove the nvidia driver without stomping -# on the mesa files. Note: this tool "should" allow switching on the fly, -# but why? Pick a driver! You will stilll need to edit a bunch of other -# config files. - -# When ROOT= is specified when using {install,upgrade,remove}pkg, -# PATH is usually specified without a trailing "/", so we need to add it -if [ "$ROOT" = "" ]; then - ROOT="${ROOT:-"/"}" -else - ROOT="${ROOT}/" -fi -CWD=$(pwd) -COMPAT32="LIB32FLAG" # This will be replaced in the build script (yes | no) -LIBSUFFIX="LIBDIRSUFFIX" # This will be replaced in the build script -INC="${ROOT}usr/include/GL" -LIB="${ROOT}usr/lib${LIBSUFFIX}" -LIB32="${ROOT}usr/lib" - -save_GL(){ -# backup original mesa conflicts - cd $2 - case "$1" in - "nvidia") - cp libGL{,ES*}.la /var/log/nvidia/$3 - mv libGL{.so.1.2.0,ESv1_CM.so.1.1.0,ESv2.so.2.0.0} /var/log/nvidia/$3 - sed -i s/1.2.0/1.7.0/g libGL.la - sed -i s/1.1.0/1.2.0/g libGLESv1_CM.la - sed -i s/2.0.0/2.1.0/g libGLESv2.la - ;; - - "xorg") - mv /var/log/nvidia/$3/* . - ;; - - *) - echo "nothing to do for save_gl?" - exit 1 - ;; - esac - cd "$CWD" -} - -nvidia_install(){ - echo $'Installing to nvidia-driver files!\n' - echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf" - echo "and/or in either /usr/share/X11/xorg.conf.d or" - echo "/etc/X11/xorg.conf.d. Otherwise, this may lead to improperly" - echo -e "working drivers.\n" - - if [ "$LIBSUFFIX" = "64" ]; then - save_GL "nvidia" $LIB "64" - # Check for multilib configuration - if [ "$COMPAT32" = "yes" ]; then - save_GL "nvidia" $LIB32 "32" - fi - else - save_GL "nvidia" $LIB "32" - fi -} - -nvidia_remove(){ - echo $'Returning to stock xorg files!\n' - echo "Make sure the nvidia driver is DISABLED in /etc/X11/xorg.conf" - echo "and in /usr/share/X11/xorg.conf.d and /etc/X11/xorg.conf.d." - echo "Otherwise, this may lead to improperly working drivers." - echo -e "\nPLEASE run /sbin/ldconfing after removing nvidia-driver.\n" - - if [ "$LIBSUFFIX" = "64" ]; then - save_GL "xorg" $LIB "64" - # Check for multilib configuration - if [ "$COMPAT32" = "yes" ]; then - save_GL "xorg" $LIB32 "32" - fi - else - save_GL "xorg" $LIB "32" - fi -} - -usage(){ - echo "Usage:" - echo " --install Set up nvidia driver files and update symlinks" - echo " --remove Return to stock xorg files and restore symlinks" - echo " --help Show this help message" -} - -case "$1" in - "--install") - nvidia_install - ;; - "--remove") - nvidia_remove - ;; - "--help") - usage - ;; - *) - usage - ;; -esac -- cgit v1.2.3