diff options
author | Lenard Spencer <lenardrspencer@gmai.com> | 2020-04-10 00:30:11 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-04-10 00:30:11 +0700 |
commit | 00eaecf3ff2cdb1b5b3b55d72859318316e3b871 (patch) | |
tree | 71a483911a2c15c760042c97a5bdb8d70114125e | |
parent | 13be2dd8a9eb24c0c37cf1c62e0f616633dee5e1 (diff) | |
download | slackbuilds-00eaecf3ff2cdb1b5b3b55d72859318316e3b871.tar.gz |
system/nvidia-legacy390-driver: added rc.nvidia-persistenced.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/nvidia-legacy390-driver/README | 71 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/README.nvidia-persistenced | 26 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/changelog.txt | 3 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/doinst.sh | 2 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild | 157 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/nvidia-legacy390-driver.info | 4 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/nvidia-switch | 181 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/rc.nvidia-persistenced | 80 | ||||
-rw-r--r-- | system/nvidia-legacy390-driver/slack-desc | 2 |
9 files changed, 303 insertions, 223 deletions
diff --git a/system/nvidia-legacy390-driver/README b/system/nvidia-legacy390-driver/README index e608bf4c96..0fefce671d 100644 --- a/system/nvidia-legacy390-driver/README +++ b/system/nvidia-legacy390-driver/README @@ -5,10 +5,16 @@ of the nvidia-legacy390-kernel package at SlackBuilds.org. Installing the 32-bit compatibility libraries is available: if desired, do: COMPAT32="yes" ./nvidia-legacy390-driver.SlackBuild -GLVND GLX client libraries are now the default. If these cause any -compatibility issues with older GLX sofware, either upgrade your software -or try: - GLVND="no" ./nvidia-legacy390-driver.SlackBuild +If you plan to test this buildscript on current (15.0 EXPERIMENTAL), to +avoid stomping on xorg-serverand libglvnd, do: + CURRENT="yes" ./nvidia-driver.SlackBuild + +If you build and install this driver on current WITHOUT using the +CURRENT="yes" flag, it will corrupt both xorg-server AND libglvnd, so +after removing the driver both packages will have to be reinstalled. + +This script now installs the nvidia-persistenced daemon. For details see +README.nvidia-persistenced. Several useful utilities are included: nvidia-xsettings, nvidia-smi, and nvidia-settings. Please refer to the Nvidia documentation and man pages @@ -16,44 +22,45 @@ 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: --------------8<--------------- -# Create missing nvidia device nodes after reboot -/usr/bin/nvidia-modprobe -c 0 -u -------------->8--------------- - -Since this nvidia-legacy390-driver conflicts with some files of xorg, it's -a bit complex to install/uninstall the driver. However, installation of the -nvidia-legacy390-driver package itself backs up the conflicting files and puts -the nvidia-specific files into place. - -Included is a script called nvidia-switch, which is used to switch from -the xorg driver to the nvidia driver, but it will not edit xorg.conf -for you; you have to do that manually. The nvidia-switch script is -installed to /usr/sbin. NOTE: Although nvidia-switch is aware of a -COMPAT32 environment, its use therein is not supported. +(this is REQUIRED for nvidia-persistenced to work properly) + + # Create missing nvidia device nodes after reboot + /usr/bin/nvidia-modprobe -c 0 -u + +Included is a script called nvidia-switch, which is used to switch between +the xorg and nvidia drivers, but it will not edit xorg.conf for you; +you have to do that manually. The nvidia-switch script is installed to +/usr/sbin. Usage of nvidia-switch: - nvidia-switch --install <--> install the nvidia files and save the - stock xorg files. + nvidia-switch --install <--> save the stock xorg files and + install the nvidia files and symlinks. nvidia-switch --remove <--> remove the nvidia files and symlinks and restore the stock xorg files. -You do NOT have to run nvidia-switch after installing the package. +NOTES: +Since nvidia-legacy390-driver conflicts with some files of xorg, it's a +bit complex to install/uninstall the driver. However, installation of the +nvidia-legacy390-driver package backs up the conflicting files and puts +the nvidia-specific files into place by automatically running + nvidia-switch --install +in doinst.sh. -Before uninstalling or upgrading this package, it is important that +Before uninstalling or upgrading this package, it is IMPORTANT that you execute 'nvidia-switch --remove', which will switch back to the stock xorg files and remove all links created by nvidia-switch during installation. If you forget to do this, you might have to do the switch manually, since 'nvidia-switch --install' may fail, resulting in xorg -not working. Here are the affected files: +not working. Here are the affected files (and their packages): - /usr/lib[64]/libGL.so.1.2 - /usr/lib[64]/libGL.la - /usr/lib[64]/libGLESv1_CM.so.1.0.0 - /usr/lib[64]/libGLESv2.so.2.0.0 - /usr/lib[64]/libEGL.so.1.0.0 - /usr/lib[64]/xorg/modules/libwfb.so - /usr/lib[64]/xorg/modules/extensions/libglx.so + /usr/lib[64]/libGL.so.1.2 (mesa) + /usr/lib[64]/libGL.la (mesa) + /usr/lib[64]/libGLESv1_CM.so.1.0.0 (mesa) + /usr/lib[64]/libGLESv2.so.2.0.0 (mesa) + /usr/lib[64]/libEGL.so.1.0.0 (mesa) + /usr/lib[64]/xorg/modules/libwfb.so (xorg-server) + /usr/lib[64]/xorg/modules/extensions/libglx.so (xorg-server) Simply remove the dead nvidia symlinks and and reinstall the mesa and -xorg-server packages. See 'nvidia-switch --help'. +xorg-server packages. (In current, only xorg-server is affected.) + diff --git a/system/nvidia-legacy390-driver/README.nvidia-persistenced b/system/nvidia-legacy390-driver/README.nvidia-persistenced new file mode 100644 index 0000000000..6a701bb7bd --- /dev/null +++ b/system/nvidia-legacy390-driver/README.nvidia-persistenced @@ -0,0 +1,26 @@ +The driver now includes rc.nvidia-persistenced as an option. While it can +be run as root, it is more secure to run it as an unpriveleged user, so we +run it as user nvidia. Create the nvidia user and group with the following: + + # groupadd -g 365 nvidia + # useradd -u 365 -g 365 -c "Nvidia" -d /dev/null -s /bin/false nvidia + +To activate the daemon, add the following to /etc/rc.d/local: + +# Start the nvidia-persistenced daemon: +if [ -x /etc/rc.d/rc.nvidia-persistenced ]; then + /etc/rc.d/rc.nvidia-persistenced start +fi + +and then 'chmod +x /etc/rc.d/rc.nvidia-persistenced' to make it executable. + +Add the following to /etc/rc.d/rc.local_shutdown: + +# Stop the nvidia-persistenced daemon: +if [ -x /etc/rc.d/rc.nvidia-persistenced ]; then + /etc/rc.d/rc.nvidia-persistenced stop +fi + +NOTE: This may not work on all systems. If you encounter problems +with it, just 'chmod -x /etc/rc.d/rc.persistenced' and it will no +longer load. YMMV. diff --git a/system/nvidia-legacy390-driver/changelog.txt b/system/nvidia-legacy390-driver/changelog.txt index b964866875..5596de99d7 100644 --- a/system/nvidia-legacy390-driver/changelog.txt +++ b/system/nvidia-legacy390-driver/changelog.txt @@ -41,4 +41,5 @@ 6.1 26-FEB-2019 version update LLB; compatibility with recent kernels 6.2 15-AUG-2019 version update LLB 6.3 22-Feb-2020 version update LLB, minor edits - +6.4 03-APR-2020 script cleanups, add rc.nvidia-persistenced; now works on -current + New maintainer Lenard Spencer <lenardrspencer@gmail.com> diff --git a/system/nvidia-legacy390-driver/doinst.sh b/system/nvidia-legacy390-driver/doinst.sh index 8ee62f049e..e0d49fcf75 100644 --- a/system/nvidia-legacy390-driver/doinst.sh +++ b/system/nvidia-legacy390-driver/doinst.sh @@ -2,5 +2,5 @@ if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications fi -./usr/sbin/nvidia-switch --install +usr/sbin/nvidia-switch --install diff --git a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild index 8ceef4ab81..c22fca04c2 100644 --- a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild +++ b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild @@ -3,6 +3,7 @@ # Slackware build script for nvidia-legacy390-driver # 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 @@ -26,11 +27,10 @@ PRGNAM=nvidia-legacy390-driver VERSION=${VERSION:-390.132} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} -GLVND=${GLVND:-yes} -# libglnvd may land in mesa and is Nvidia recommended +CURRENT=${CURRENT:-no} set -e @@ -69,6 +69,13 @@ else COMPAT32=no fi +# Abort if an Nvidia driver is still installed: +if [ -x /usr/bin/nvidia-installer ]; then + echo -e "\n A previous Nvidia installation has been detected!" + echo -e " Please remove the installed driver and rerun this script.\n" + exit 1 +fi + SRCNAM=NVIDIA-Linux-$TARGET-${VERSION} # make a clean package directory tree @@ -76,14 +83,11 @@ rm -rf $PKG rm -rf $TMP/$SRCNAM mkdir -p $TMP $PKG $OUTPUT $PKG/install mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/xorg/modules/{drivers,extensions} \ - $PKG/etc/OpenCL/vendors/ $PKG/usr/{bin,doc,man/man1,sbin} \ + $PKG/etc/OpenCL/vendors/ $PKG/usr/{bin,doc,man/man1} \ $PKG/usr/share/{applications,nvidia,pixmaps,egl/egl_external_platform.d} \ $PKG/usr/include/GL $PKG/etc/vulkan/icd.d $PKG/etc/X11/xorg.conf.d \ - $PKG/etc/X11/glvnd/egl_vendor.d $PKG/var/log/nvidia/{32,64} \ + $PKG/etc/X11/glvnd/egl_vendor.d $PKG/var/log -if [ "$COMPAT32" = "yes" ]; then - mkdir -p $PKG/usr/lib/tls -fi # Extract all the sources cd $TMP @@ -132,15 +136,10 @@ cd - mv -f $PKG/usr/bin/nvidia-installer $TMP/$SRCNAM mv -f $PKG/usr/man/man1/nvidia-installer.1.gz $TMP/$SRCNAM -# Configure options -if [ "$GLVND" = "yes" ]; then - GLVNDOPT="--install-libglvnd --glvnd-glx-client --glvnd-egl-client" -else - GLVNDOPT="--no-install-libglvnd --no-glvnd-glx-client --no-glvnd-egl-client" -fi if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then COMP32="--install-compat32-libs --compat32-prefix=$PKG/usr" - MULTI="_multi" + MULTI="_multilib" + mkdir $PKG/usr/lib else if [ ! "$ARCH" = "x86_64" ]; then COMP32="" @@ -152,6 +151,7 @@ fi # Install the binary libs using nvidia-installer compiled above cd $TMP/$SRCNAM + ./nvidia-installer -s --no-kernel-module --no-drm --no-unified-memory \ -z -n -b --no-rpms --no-distro-scripts \ --no-kernel-module-source --no-x-check --force-libglx-indirect \ @@ -168,17 +168,16 @@ cd $TMP/$SRCNAM --log-file-name=$PKG/var/log/nvidia-installer.log \ --egl-external-platform-config-path=$PKG/usr/share/egl/egl_external_platform.d \ --no-nvidia-modprobe \ - $GLVNDOPT \ $COMP32 -# Clean-up: we really do not need this: -rm -rf /var/lib/nvidia -# which 32-bit tls? why? why? -if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then - install -m 755 32/tls/libnvidia-tls.so.$VERSION $PKG/usr/lib/tls/libnvidia-tls.so.$VERSION - cd $PKG/usr/lib - ln -sf tls/libnvidia-tls.so.$VERSION libnvidia-tls.so.$VERSION - cd - +# Move ICDs to $PKG and cleanup (no switch option in installer?) +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 +rm -rf /etc/vulkan +# 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 # Compile utilites from source, replacing the precompiled versions @@ -240,8 +239,8 @@ cd - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" make - - install -m 755 _out/Linux_$TARGET/nvidia-modprobe $PKG/usr/bin/ +# must be installed suid root for nvidia-persistenced to work properly + install -m 4755 _out/Linux_$TARGET/nvidia-modprobe $PKG/usr/bin/ install -m 644 _out/Linux_$TARGET/nvidia-modprobe.1.gz $PKG/usr/man/man1/ cd - @@ -255,7 +254,7 @@ cd - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; CFLAGS="$SLKCFLAGS" make -#FIXME: need rc.nvidia-persistenced script; see doc + install -m 755 _out/Linux_$TARGET/nvidia-persistenced $PKG/usr/bin/ install -m 644 _out/Linux_$TARGET/nvidia-persistenced.1.gz $PKG/usr/man/man1/ cd - @@ -263,13 +262,16 @@ cd - # Bash script to cleanly install (in doinst.sh) and uninstall the nvidia files # so we don't stomp on the overlapping xorg files. # Note: switching can be problematic ;-) +mkdir -p $PKG/usr/sbin 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 [ "$GLVND" = "yes" ]; then +if [ "$CURRENT" = "no" ]; then sed -i s/GLVNDFLAG/yes/g $PKG/usr/sbin/nvidia-switch + sed -i s/GLVERSION/1.2.0/g $PKG/usr/sbin/nvidia-switch else sed -i s/GLVNDFLAG/no/g $PKG/usr/sbin/nvidia-switch + sed -i s/GLVERSION/1.7.0/g $PKG/usr/sbin/nvidia-switch fi if [ ${COMPAT32} = "yes" ]; then sed -i s/LIB32FLAG/yes/g $PKG/usr/sbin/nvidia-switch @@ -278,41 +280,26 @@ else fi # These add or correct wrong paths -sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la -sed -i "s|/usr/X11R6/lib|/usr/lib$LIBDIRSUFFIX|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la +if [ "$CURRENT" = "no" ]; then + sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la + sed -i "s|/usr/X11R6/lib|/usr/lib$LIBDIRSUFFIX|" $PKG/usr/lib$LIBDIRSUFFIX/libGL.la + + if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then + sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib/libGL.la + sed -i "s|/usr/X11R6/lib|/usr/lib|" $PKG/usr/lib/libGL.la + sed -i "s|'/usr/'|'/usr/lib'|" $PKG/usr/lib/libGL.la + fi +fi sed -i "s|__UTILS_PATH__|/usr/bin|" $PKG/usr/share/applications/nvidia-settings.desktop sed -i "s|__PIXMAP_PATH__|/usr/share/pixmaps|" $PKG/usr/share/applications/nvidia-settings.desktop sed -i "s|__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__|Application;Settings;|" $PKG/usr/share/applications/nvidia-settings.desktop -if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then - sed -i "s|$TMP/package-$PRGNAM/usr|/usr|" $PKG/usr/lib/libGL.la - sed -i "s|/usr/X11R6/lib|/usr/lib|" $PKG/usr/lib/libGL.la - sed -i "s|'/usr/'|'/usr/lib'|" $PKG/usr/lib/libGL.la -fi - # rename wrong/conficting files as needed; remove conflicting symlinks created by installer cd $PKG/usr/lib$LIBDIRSUFFIX - if [ "$GLVND" = "yes" ]; then + if [ "$CURRENT" = "no" ]; then mv libEGL.so.1.1.0 libEGL.so.1.1.0-nvidia - fi - mv libGL.la libGL.la-nvidia - mv libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1.2.0-nvidia - mv libGLESv2.so.2.1.0 libGLESv2.so.2.1.0-nvidia - rm -f libEGL.so - rm -f libGL.so - rm -f libGL.so.1 - rm -f libGLESv1_CM.so - rm -f libGLESv2.so - rm -f xorg/modules/libwfb.so - rm -f xorg/modules/extensions/libglx.so -cd - - -if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then - cd $PKG/usr/lib - if [ "$GLVND" = "yes" ]; then - mv libEGL.so.1.1.0 libEGL.so.1.1.0-nvidia - fi mv libGL.la libGL.la-nvidia + mv libGL.so.1.7.0 libGL.so.1.7.0-nvidia mv libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1.2.0-nvidia mv libGLESv2.so.2.1.0 libGLESv2.so.2.1.0-nvidia rm -f libEGL.so @@ -320,24 +307,50 @@ if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then rm -f libGL.so.1 rm -f libGLESv1_CM.so rm -f libGLESv2.so + else + rm libGL.la + rm libOpenCL.so.1.0.0 + fi + rm -f xorg/modules/libwfb.so + if [ -e xorg/modules/extensions/libglx.so ]; then + (cd xorg/modules/extensions + rm libglx.so + ) + fi +cd - + +if [ "$ARCH" = "x86_64" -a "${COMPAT32}" = "yes" ]; then + cd $PKG/usr/lib + if [ "$CURRENT" = "no" ]; then + mv libEGL.so.1.1.0 libEGL.so.1.1.0-nvidia + mv libGL.la libGL.la-nvidia + mv libGLESv1_CM.so.1.2.0 libGLESv1_CM.so.1.2.0-nvidia + mv libGLESv2.so.2.1.0 libGLESv2.so.2.1.0-nvidia + rm -f libEGL.so + rm -f libGL.so + rm -f libGL.so.1 + rm -f libGLESv1_CM.so + rm -f libGLESv2.so + else + rm libGL.la + rm libOpenCL.so.1.0.0 + fi cd - -# FIXME With COMPAT32=yes on pure x86_64, a weird /usr/lib/libGL.so.1 symlink to $PKG/usr/lib64/libGL.so.1 -# appears? Who would do this, so ignoring for now. +# FIXME With COMPAT32=yes on pure x86_64, a weird /usr/lib/libGL.so.1 +# symlink to $PKG/usr/lib64/libGL.so.1 appears? Who would do this, +# so ignoring for now. fi -# Move ICDs to $PKG and cleanup (no switch option in installer?) -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 -rm -rf /etc/OpenCL -rm -rf /etc/vulkan - -# Remove xorg conf file since we take care of that in nvidia-legacy390-driver +# Remove xorg conf file since we handle that in nvidia-legacy390-kernel rm -rf $PKG/etc/X11/xorg.conf.d -cat <<EOF > $PKG/var/log/nvidia/README.txt +if [ "$CURRENT" = "no" ]; then + mkdir -p $PKG/var/log/nvidia/{32,64} + cat <<EOF > $PKG/var/log/nvidia/README.txt Do NOT delete this directory! nvidia-switch will backup the original X.org libraries here. EOF +fi cd $TMP/$SRCNAM # put docs in the right place @@ -347,9 +360,23 @@ mv $PKG/usr/share/doc/NVIDIA_GLX-1.0 $PKG/usr/doc/$PRGNAM-$VERSION rm -rf $PKG/usr/share/doc cp -a LICENSE NVIDIA_Changelog README.txt $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.Slackware +cp $CWD/README.nvidia-persistenced $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild sed "s/PKGVERSION/$VERSION/g" $CWD/slack-desc > $PKG/install/slack-desc +if [ "$COMPAT32" = "yes" ]; then + sed -i "s|@MULTILIB@| This package includes the 32-bit compatibility libraries.|" $PKG/install/slack-desc +else + sed -i "s|@MULTILIB@||" $PKG/install/slack-desc +fi + +# Add rc.nvidia-persistenced: +mkdir -p $PKG/var/run/nvidia-persistenced +chown nvidia:nvidia $PKG/var/run/nvidia-persistenced +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.nvidia-persistenced > $PKG/etc/rc.d/rc.nvidia-persistenced +sed -i "s|__USER__|nvidia|" $PKG/etc/rc.d/rc.nvidia-persistenced + cat $CWD/doinst.sh > $PKG/install/doinst.sh # Flag install as multlib as needed and build package. diff --git a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info index 9322a5d803..a7a9835ec6 100644 --- a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info +++ b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.info @@ -26,5 +26,5 @@ MD5SUM_x86_64="c6a37fc418ede54ad63fdf5c96f54958 \ 45e7cc0e1717fb23c675f11607a2d756 \ 4d6bb6e058282d7da8673953c9755e38" REQUIRES="nvidia-legacy390-kernel" -MAINTAINER="unmaintained" -EMAIL="nobody@nowhere" +MAINTAINER="Lenard Spencer" +EMAIL="lenardrspencer@gmail.com" diff --git a/system/nvidia-legacy390-driver/nvidia-switch b/system/nvidia-legacy390-driver/nvidia-switch index 9ae63aedca..aa92b3a01a 100644 --- a/system/nvidia-legacy390-driver/nvidia-switch +++ b/system/nvidia-legacy390-driver/nvidia-switch @@ -1,6 +1,7 @@ #!/bin/sh # Copyright 2012-2017 Edward W. Koenig, Vancouver, WA, USA +# Updates copyright 2020 Lenard Spencer, Orlando, FL, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -20,15 +21,23 @@ # 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.0 +# nvidia-switch utility 4.0.1 # -# A tool to install and cleanly remove the nvidia driver without stomping on the xorg files. -# Note: this tool "should" allow switching on the fly, but why? Pick a driver! You will still -# need to edit a bunch of other config files. +# A tool to install and cleanly remove the nvidia driver without +# stomping on the xorg files. Note: this tool "should" allow switching +# on the fly, but why? Pick a driver! You will still need to edit a bunch +#of other config files. # TO-DO: needs more cleanup, simplify linking using system tools -ROOT="${ROOT:-/}" + +# When ROOT=<PATH> is specified when using {install,upgrade,remove}pkg, +# PATH is usually specified without a trailing "/", so we add one here +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 @@ -38,9 +47,8 @@ LIB32="${ROOT}usr/lib" XMOD="${LIB}/xorg/modules" XLIB="$XMOD/extensions" NV_VERSION="PKGVERSION" # This will be replaced in the build script -GL_VERSION="1.2.0" +GL_VERSION="GLVERSION" GLVND="GLVNDFLAG" # This will be replaced in the build script (yes | no) -NV_CONF="${ROOT}usr/share/X11/xorg.conf.d/10-nvidia.conf" SAVELIBS="${ROOT}var/log/nvidia" save_GL(){ @@ -57,54 +65,39 @@ save_GL(){ case "$1" in "nvidia") - mv libGL.so.$GL_VERSION $SAVELIBS/libGL.so.$GL_VERSION - mv libGL.la $SAVELIBS/libGL.la - mv libEGL.so.1.0.0 $SAVELIBS/libEGL.so.1.0.0 - mv libGLESv1_CM.so.1.1.0 $SAVELIBS/libGLESv1_CM.so.1.1.0 - mv libGLESv2.so.2.0.0 $SAVELIBS/libGLESv2.so.2.0.0 - mv libGL.la-nvidia libGL.la - if [ "$GLVND" = "yes" ]; then - ln -sf libGL.so.1.7.0 libGL.so.1 - ln -sf libGL.so.1.7.0 libGL.so + mv libGL.so.$GL_VERSION $SAVELIBS + mv libGL.la $SAVELIBS + mv libEGL.so.1.?.0 $SAVELIBS + mv libGLESv1_CM.so.1.1.0 $SAVELIBS + mv libGLESv2.so.2.0.0 $SAVELIBS + mv libGL.la-nvidia libGL.la + ln -sf libGL.so.1.7.0-nvidia libGL.so.1 + ln -sf libGL.so.1 libGL.so ln -sf libEGL.so.1.1.0-nvidia libEGL.so.1.1.0 - ln -sf libEGL.so.1.1.0-nvidia libEGL.so - else - ln -sf libGL.so.$NV_VERSION libGL.so.1 - ln -sf libGL.so.$NV_VERSION libGL.so - ln -sf libEGL.so.$NV_VERSION libEGL.so.1 - ln -sf libEGL.so.$NV_VERSION libEGL.so + ln -sf libEGL.so.1 libEGL.so + ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.libGLESv1_CM.so.1 + ln -sf libGLESv1_CM.so.1 libGLESv1_CM.so + ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so.2 + ln -sf libGLESv2.so.2 libGLESv2.so fi - - ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so.1.2.0 - ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so.1 - ln -sf libGLESv1_CM.so.1.2.0-nvidia libGLESv1_CM.so - - ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so.2.1.0 - ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so.2 - ln -sf libGLESv2.so.2.1.0-nvidia libGLESv2.so ;; "xorg") - mv libGL.la libGL.la-nvidia - mv $SAVELIBS/libGL.so.$GL_VERSION libGL.so.$GL_VERSION - mv $SAVELIBS/libGL.la libGL.la - mv $SAVELIBS/libEGL.so.1.0.0 libEGL.so.1.0.0 - mv $SAVELIBS/libGLESv1_CM.so.1.1.0 libGLESv1_CM.so.1.1.0 - mv $SAVELIBS/libGLESv2.so.2.0.0 libGLESv2.so.2.0.0 - - ln -sf libGL.so.$GL_VERSION libGL.so.1 - ln -sf libGL.so.$GL_VERSION libGL.so - ln -sf libEGL.so.1.0.0 libEGL.so.1 - ln -sf libEGL.so.1.0.0 libEGL.so - rm -f libEGL.so.1.1.0 - - ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so.1 - ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so - ln -sf libGLESv2.so.2.0.0 libGLESv2.so.2 - ln -sf libGLESv2.so.2.0.0 libGLESv2.so - rm -f libGLESv1_CM.so.1.2.0 - rm -f libGLESv2.so.2.1.0 + if [ -e libGL.la ]; then + mv libGL.la libGL.la-nvidia + fi + if [ "$GLVND" = "yes" ]; then + mv $SAVELIBS/* . + ln -sf libGL.so.$GL_VERSION libGL.so.1 + ln -sf libGL.so.1 libGL.so + ln -sf libEGL.so.1.0.0 libEGL.so.1 + ln -sf libEGL.so.1 libEGL.so + ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so.1 + ln -sf libGLESv1_CM.so.1.1.0 libGLESv1_CM.so + ln -sf libGLESv2.so.2.0.0 libGLESv2.so.2 + ln -sf libGLESv2.so.2.0.0 libGLESv2.so + fi ;; *) @@ -120,17 +113,19 @@ save_glx(){ case "$1" in "nvidia") if [ -e libglx.so ]; then - mv libglx.so xorg-libglx.so + mv libglx.so libglx.so-xorg fi ln -sf libglx.so.$NV_VERSION libglx.so ;; "xorg") - if [ -e xorg-libglx.so ]; then + if [ -e libglx.so-xorg ]; then rm -f libglx.so - mv xorg-libglx.so libglx.so + mv libglx.so-xorg libglx.so else - rm -f libglx.so - fi + if [ ! -e libglx.so ]; then + echo -e "WARNING: libglx.so not found! Please reinstall xorg-server!\n" + fi + fi ;; *) echo "nothing to do for save_glx?" @@ -142,18 +137,12 @@ save_glx(){ save_wfb(){ cd "$XMOD" - if [ -e libwfb.so ]; then - echo "Using existing Xorg libwfb..." - else - if [ "$1" = "nvidia" ]; then - ln -sf libwfb.so.$NV_VERSION libwfb.so.1 - ln -sf libwfb.so.1 libwfb.so + if [ "$1" = "nvidia" ]; then + ln -sf libnvidia-wfb.so.$NV_VERSION libnvidia-wfb.so.1 fi if [ "$1" = "xorg" ]; then - rm -f libwfb.so - rm -f libwfb.so.1 + rm -f libnvidia-wfb.so.1 fi - fi cd "$CWD" } @@ -162,10 +151,10 @@ nvidia_install(){ echo "Creating missing $SAVELIB ..." mkdir -p $SAVELIBS fi - echo $'Installing to nvidia-legacy390-driver files!\n' + echo $'Installing to nvidia-legacy390-driver files:\n' echo "Make sure the nvidia driver is ENABLED in /etc/X11/xorg.conf" - echo "and in /etc/X11/xorg.conf.d." - echo "Otherwise, this may lead to improperly working drivers." + echo "and in /etc/X11/xorg.conf.d. Otherwise, this may lead to" + echo -e "improperly working drivers.\n" save_glx "nvidia" save_GL "nvidia" $LIB @@ -177,11 +166,13 @@ nvidia_install(){ } nvidia_remove(){ - echo $'Returning to stock xorg files!\n' + echo $'Returning to stock xorg files:\n' echo "Make sure the nvidia driver is DISABLED in /usr/share/X11/xorg.conf.d" echo "/etc/X11/xorg.conf and in /etc/X11/xorg.conf.d." - echo "Otherwise, this may lead to improperly working drivers." - + echo -e "Otherwise, this may lead to improperly working drivers.\n" + if [ "$GLVND" = "yes" ]; then + echo -e "Be sure to run /sbin/ldconfig after removing nvidia-legacy390-driver.\n" + fi save_glx "xorg" save_GL "xorg" $LIB save_wfb "xorg" @@ -190,63 +181,14 @@ nvidia_remove(){ if [ "$COMPAT32" = "yes" ]; then save_GL "xorg" $LIB32 fi - - if [ -e $NV_CONF ]; then - echo "removing $NV_CONF: you will need to provide your own" - echo "or reinstall nvidia-legacy390-driver." - rm -f $NV_CONF - fi } -restore(){ -# Attempt to reinstall damaged stock packages if something went wrong. -# Obviously, you will need to run this after '--remove' and after -# 'removepkg nvidia-legacy390-driver'. -# User must: -# 1. remove any dangling symlinks and xorg-*, *-nvidia files in /usr/lib*/, -# and any other housekeeping tasks. -# 2. copy stock Slackware packages to /root/Slackware or provide an alternate location -# 3. be running Slackware-14.2, not current -# 4. realize that COMPAT32 is not stable ;-) - if [ "$LIBSUFFIX" = "64" ]; then ARCH="x86_64" else ARCH="x86" fi -PKGPATH=${PKGPATH:-/root/Slackware} -MESA="mesa-11.2.2-$ARCH-1.txz" -MESA32="mesa-compat32-11.2.2-$ARCH-1compat32.txz" -XORG="xorg-server-1.18.3-$ARCH-2.txz" -# Note: The above is for stock 14.2; modify as needed for /patches or -# multilib updates -if [ -d $PKGPATH ]; then - if [ `find $PKGPATH -prune -empty -type d` ]; then - echo "Your $PKGPATH is empty!" - else - upgradepkg --reinstall --install-new $MESA $XORG - if [ "COMPAT32" = "yes" ]; then - upgradepkg --reinstall --install-new $MESA32 - fi - fi -else - echo "Please create $PKGPATH containing the appropriate packages" -fi -} - -usage(){ - echo "Usage:" - echo " --install Set up nvidia driver files" - echo " --remove Return to stock xorg files and restore all symlinks" - echo " --restore Reinstall stock Mesa and xorg-server [EXPERIMENTAL]" - echo " mesa-11.2.2, org-server-1.18.3, and optionally" - echo " mesa-compat32-11.2.2 are expected in /root/Slackware" - echo " Use 'PKGPATH=\"<location>\" nvidia-switch --restore'" - echo " to override." - echo " --help Show this help message" -} - case "$1" in "--install") nvidia_install @@ -254,9 +196,6 @@ case "$1" in "--remove") nvidia_remove ;; - "--restore") - restore - ;; "--help") usage ;; diff --git a/system/nvidia-legacy390-driver/rc.nvidia-persistenced b/system/nvidia-legacy390-driver/rc.nvidia-persistenced new file mode 100644 index 0000000000..bf53fd9345 --- /dev/null +++ b/system/nvidia-legacy390-driver/rc.nvidia-persistenced @@ -0,0 +1,80 @@ +#!/bin/sh -e +# +# NVIDIA Persistence Daemon Init Script +# +# Copyright (c) 2013 NVIDIA Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +# This is a sample System V init script, designed to show how the NVIDIA +# Persistence Daemon can be started. +# +# This sample does not rely on any init system functions, to ensure the +# widest portability possible. +# +# chkconfig: 2345 99 01 +# description: Starts and stops the NVIDIA Persistence Daemon +# processname: nvidia-persistenced +# +### BEGIN INIT INFO +# Provides: nvidia-persistenced +# Required-Start: $ALL +# Required-Stop: $ALL +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: Starts and stops the NVIDIA Persistence Daemon +### END INIT INFO + + +NVPD=nvidia-persistenced +NVPD_BIN=/usr/bin/${NVPD} +NVPD_RUNTIME=/var/run/${NVPD} +NVPD_PIDFILE=${NVPD_RUNTIME}/${NVPD}.pid +NVPD_USER=__USER__ + +if [ -f ${NVPD_PIDFILE} ]; then + read -r NVPD_PID < "${NVPD_PIDFILE}" + # Remove stale runtime files + if [ "${NVPD_PID}" ] && [ ! -d /proc/${NVPD_PID} ]; then + unset NVPD_PID + rm -rf "${NVPD_RUNTIME}" + fi +fi + +case "${1}" in + start) + echo "Starting NVIDIA Persistence Daemon" + + # Execute the daemon as the intended user + ${NVPD_BIN} --user ${NVPD_USER} + ;; + stop) + echo "Stopping NVIDIA Persistence Daemon" + + # Stop the daemon - its PID should have been read in + [ ! -z "${NVPD_PID}" ] && kill ${NVPD_PID} &> /dev/null + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + *) echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/system/nvidia-legacy390-driver/slack-desc b/system/nvidia-legacy390-driver/slack-desc index af1addf510..4926763448 100644 --- a/system/nvidia-legacy390-driver/slack-desc +++ b/system/nvidia-legacy390-driver/slack-desc @@ -15,5 +15,5 @@ nvidia-legacy390-driver: nvidia-legacy390-driver: See /usr/doc/nvidia-legacy390-driver-PKGVERSION/README.Slackware nvidia-legacy390-driver: for more information. nvidia-legacy390-driver: -nvidia-legacy390-driver: +nvidia-legacy390-driver:@MULTILIB@ nvidia-legacy390-driver: |