手動編譯安裝 nvidia 390.x 驅動

其它Linux/Unix/BSD/OSX等发行版讨论
回复
头像
torachiyo
帖子: 80
注册时间: 2015-11-29 8:32
系统: Kali Linux
送出感谢: 0
接收感谢: 4 次

手動編譯安裝 nvidia 390.x 驅動

#1

帖子 torachiyo » 2018-03-19 19:37

NVIDIA Driver

代码: 全选

###########################################
### NVIDIA Driver 390.42 Install
###########################################
# Debian Depends:
sudo apt-get install dkms gcc make patch linux-headers-amd64

# openSUSE Depends:
sudo zypper install dkms gcc make patch binutils gtk3 kernel-default-devel libelf-devel

# Fedora Depends:
sudo dnf install dkms gcc make patch glibc-devel kernel-devel elfutils-libelf-devel pangox-compat selinux-policy-devel

# Arch Depends:
sudo pacman -S dkms gcc linux-headers

# Debian 32-bit Library Depends:
sudo dpkg --add-architecture i386
sudo apt-get install libglx-mesa0:i386

# openSUSE 32-bit Library Depends:
sudo zypper install Mesa-libGL1-32bit

# Fedora 32-bit Library Depends:
sudo dnf install mesa-libGL.i686

# Arch 32-bit Library Depends:
sudo pacman -S libglvnd lib32-libglvnd lib32-gcc-libs

# Debian
LIB=lib
LIB64=lib/x86_64-linux-gnu
LIB32=lib/i386-linux-gnu

# Fedora /openSUSE
LIB=lib64
LIB64=lib64
LIB32=lib

# ARCH
LIB=lib
LIB64=lib
LIB32=lib32

NV_NAME=NVIDIA-Linux-x86_64
NV_VER='390.42'

wget -c http://us.download.nvidia.com/XFree86/Linux-x86_64/$NV_VER/"$NV_NAME"-"$NV_VER".run

sh "$NV_NAME"-"$NV_VER".run -x

sudo /sbin/rmmod nvidia >/dev/null 2>&1

###########################################
### NVIDIA Driver 64-bit Library Install
###########################################
## Install library
cd "$NV_NAME"-"$NV_VER"

# X driver
sudo install -D -m755 nvidia_drv.so /usr/$LIB/xorg/modules/drivers/nvidia_drv.so

# GLX extension module for X
sudo install -D -m755 libglx.so.$NV_VER /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so.$NV_VER
sudo ln -sf libglx.so.$NV_VER /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so.1
sudo ln -sf libglx.so.1 /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so

# OpenGL library
sudo install -D -m755 libGL.so.$NV_VER /usr/$LIB64/nvidia/libGL.so.$NV_VER
sudo ln -sf libGL.so.$NV_VER /usr/$LIB64/nvidia/libGL.so.1
sudo ln -sf libGL.so.1 /usr/$LIB64/nvidia/libGL.so

# OpenGL core library
sudo install -D -m755 libnvidia-glcore.so.$NV_VER /usr/$LIB64/libnvidia-glcore.so.$NV_VER

# EGL API
sudo install -D -m755 libEGL.so.$NV_VER /usr/$LIB64/nvidia/libEGL.so.$NV_VER
sudo ln -sf libEGL.so.$NV_VER /usr/$LIB64/nvidia/libEGL.so.1
sudo ln -sf libEGL.so.1 /usr/$LIB64/nvidia/libEGL.so

# OpenGL|ES 1.x API
sudo install -D -m755 libGLESv1_CM.so.$NV_VER /usr/$LIB64/nvidia/libGLESv1_CM.so.$NV_VER
sudo ln -sf libGLESv1_CM.so.$NV_VER /usr/$LIB64/nvidia/libGLESv1_CM.so.1
sudo ln -sf libGLESv1_CM.so.1 /usr/$LIB64/nvidia/libGLESv1_CM.so

# OpenGL|ES 2.x API
sudo install -D -m755 libGLESv2.so.$NV_VER /usr/$LIB64/nvidia/libGLESv2.so.$NV_VER
sudo ln -sf libGLESv2.so.$NV_VER /usr/$LIB64/nvidia/libGLESv2.so.2
sudo ln -sf libGLESv2.so.2 /usr/$LIB64/nvidia/libGLESv2.so

# OpenGL|ES core library
sudo install -D -m755 libnvidia-eglcore.so.$NV_VER /usr/$LIB64/libnvidia-eglcore.so.$NV_VER

# NVENC Video Encoding
sudo install -D -m755 libnvidia-encode.so.$NV_VER /usr/$LIB64/libnvidia-encode.so.$NV_VER
sudo ln -sf libnvidia-encode.so.$NV_VER /usr/$LIB64/libnvidia-encode.so.1
sudo ln -sf libnvidia-encode.so.1 /usr/$LIB64/libnvidia-encode.so

# NVIDIA OpenGL-based Framebuffer Capture
sudo install -D -m755 libnvidia-fbc.so.$NV_VER /usr/$LIB64/libnvidia-fbc.so.$NV_VER

# NVIDIA OpenGL-based Inband Frame Readback
sudo install -D -m755 libnvidia-ifr.so.$NV_VER /usr/$LIB64/libnvidia-ifr.so.$NV_VER
sudo ln -sf libnvidia-ifr.so.$NV_VER /usr/$LIB64/libnvidia-ifr.so.so.1
sudo ln -sf libnvidia-ifr.so.so.1 /usr/$LIB64/libnvidia-ifr.so.so
sudo install -D -m755 libnvidia-glsi.so.$NV_VER /usr/$LIB64/libnvidia-glsi.so.$NV_VER

# VDPAU
sudo install -D -m755 libvdpau_nvidia.so.$NV_VER /usr/$LIB64/vdpau/libvdpau_nvidia.so.$NV_VER
sudo ln -sf libvdpau_nvidia.so.$NV_VER /usr/$LIB64/vdpau/libvdpau_nvidia.so.1
sudo ln -sf libvdpau_nvidia.so.1 /usr/$LIB64/vdpau/libvdpau_nvidia.so

# CUDA
sudo install -D -m755 libcuda.so.$NV_VER /usr/$LIB64/libcuda.so.$NV_VER
sudo ln -sf libcuda.so.$NV_VER /usr/$LIB64/libcuda.so
sudo install -D -m755 libnvcuvid.so.$NV_VER /usr/$LIB64/libnvcuvid.so.$NV_VER
sudo ln -sf libnvcuvid.so.$NV_VER /usr/$LIB64/libnvcuvid.so.1
sudo ln -sf libnvcuvid.so.1 /usr/$LIB64/libnvcuvid.so
sudo install -D -m755 libnvidia-ptxjitcompiler.so.$NV_VER /usr/$LIB64/libnvidia-ptxjitcompiler.so.$NV_VER

# nvidia-tls library
sudo install -D -m755 tls/libnvidia-tls.so.$NV_VER /usr/$LIB64/libnvidia-tls.so.$NV_VER
sudo install -D -m755 libnvidia-ml.so.$NV_VER /usr/$LIB64/libnvidia-ml.so.$NV_VER
sudo ln -sf libnvidia-ml.so.$NV_VER /usr/$LIB64/libnvidia-ml.so
sudo install -D -m755 libnvidia-cfg.so.$NV_VER /usr/$LIB64/libnvidia-cfg.so.$NV_VER
sudo ln -sf libnvidia-cfg.so.$NV_VER /usr/$LIB64/libnvidia-cfg.so.1
sudo ln -sf libnvidia-cfg.so.1 /usr/$LIB64/libnvidia-cfg.so

# OpenCL
sudo install -D -m755 libOpenCL.so.1.0.0 /usr/$LIB64/nvidia/libOpenCL.so.1.0.0
sudo ln -sf libOpenCL.so.1.0.0 /usr/$LIB64/nvidia/libOpenCL.so
sudo install -D -m755 libnvidia-compiler.so.$NV_VER /usr/$LIB64/libnvidia-compiler.so.$NV_VER
sudo ln -sf libnvidia-compiler.so.$NV_VER /usr/$LIB64/libnvidia-compiler.so.1
sudo ln -sf libnvidia-compiler.so.1 /usr/$LIB64/libnvidia-compiler.so
sudo install -D -m755 libnvidia-opencl.so.$NV_VER /usr/$LIB64/libnvidia-opencl.so.$NV_VER
sudo ln -sf libnvidia-opencl.so.$NV_VER "/usr/$LIB64/libnvidia-opencl.so"
sudo install -D -m644  nvidia.icd "/etc/OpenCL/vendors/nvidia.icd"

# nvidia-wfb
sudo install -D -m755 libnvidia-wfb.so.$NV_VER /usr/$LIB/libnvidia-wfb.so.$NV_VER
# Link to libwfb.so
sudo ln -sf /usr/$LIB/xorg/modules/libwfb.so /usr/$LIB/nvidia/xorg/modules/libwfb.so

# NVIDIA OpenGL/GLX/EGL/GLES libraries
sudo install -D -m755 libEGL_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libEGL_nvidia.so.$NV_VER
sudo ln -sf libEGL_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libEGL_nvidia.so.0
sudo install -D -m755 libEGL.so.1.1.0 /usr/$LIB64/nvidia/libEGL.so.1.1.0
sudo install -D -m755 libGLdispatch.so.0 /usr/$LIB64/nvidia/libGLdispatch.so.0
sudo install -D -m755 libGLESv1_CM_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLESv1_CM_nvidia.so.$NV_VER
sudo ln -sf libGLESv1_CM_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLESv1_CM_nvidia.so.1
sudo install -D -m755 libGLESv2_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLESv2_nvidia.so.$NV_VER
sudo ln -sf libGLESv2_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLESv2_nvidia.so.2
sudo install -D -m755 libGL.so.1.7.0 /usr/$LIB64/nvidia/libGL.so.1.7.0
sudo install -D -m755 libGLX_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLX_nvidia.so.$NV_VER
sudo ln -sf libGLX_nvidia.so.$NV_VER /usr/$LIB64/nvidia/libGLX_nvidia.so.0
sudo install -D -m755 libGLX.so.0 /usr/$LIB64/nvidia/libGLX.so.0
sudo install -D -m755 libOpenGL.so.0 /usr/$LIB64/nvidia/libOpenGL.so.0

sudo install -D -m755 libnvidia-egl-wayland.so.1.0.2 /usr/$LIB/libnvidia-egl-wayland.so.1.0.2

sudo install -D -m755 libnvidia-gtk2.so.$NV_VER /usr/$LIB/nvidia/libnvidia-gtk2.so.$NV_VER
sudo install -D -m755 libnvidia-gtk3.so.$NV_VER /usr/$LIB/nvidia/libnvidia-gtk3.so.$NV_VER

# NVIDIA FAT binary loader library
sudo install -D -m755 libnvidia-fatbinaryloader.so.$NV_VER /usr/$LIB64/libnvidia-fatbinaryloader.so.$NV_VER

# nvidia-settings
sudo install -D -m755 nvidia-settings /usr/bin/nvidia-settings
sudo install -D -m644 nvidia-settings.1.gz /usr/share/man/man1/nvidia-settings.1.gz
sudo install -D -m644 nvidia-settings.desktop /usr/share/applications/nvidia-settings.desktop
sudo install -D -m644 nvidia-settings.png /usr/share/pixmaps/nvidia-settings.png
sudo install -D -m644 nvidia-application-profiles-"$NV_VER"-key-documentation /usr/share/nvidia/nvidia-application-profiles-"$NV_VER"-key-documentation
sudo install -D -m644 nvidia-application-profiles-"$NV_VER"-rc /usr/share/nvidia/nvidia-application-profiles-"$NV_VER"-rc
sudo sed -e 's:__UTILS_PATH__:/usr/bin:' -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' -i "/usr/share/applications/nvidia-settings.desktop"

# nvidia-xconfig
sudo install -D -m755 nvidia-xconfig /usr/bin/nvidia-xconfig
sudo install -D -m644 nvidia-xconfig.1.gz /usr/share/man/man1/nvidia-xconfig.1.gz

# nvidia-smi
sudo install -D -m755 nvidia-smi /usr/bin/nvidia-smi
sudo install -D -m644 nvidia-smi.1.gz /usr/share/man/man1/nvidia-smi.1.gz

# nvidia-bug-report
sudo install -D -m755 nvidia-bug-report.sh /usr/bin/nvidia-bug-report.sh

# CUDA MPS
sudo install -D -m755 nvidia-cuda-mps-server /usr/bin/nvidia-cuda-mps-server
sudo install -D -m755 nvidia-cuda-mps-control /usr/bin/nvidia-cuda-mps-control
sudo install -D -m644 nvidia-cuda-mps-control.1.gz /usr/share/man/man1/nvidia-cuda-mps-control.1.gz

# kernel modules and create device nodes
sudo install -D -m755 nvidia-modprobe /usr/bin/nvidia-modprobe
sudo install -D -m644 nvidia-modprobe.1.gz /usr/share/man/man1/nvidia-modprobe.1.gz

# daemon to maintain persistent software state
sudo install -D -m755 nvidia-persistenced /usr/bin/nvidia-persistenced
sudo install -D -m644 nvidia-persistenced.1.gz /usr/share/man/man1/nvidia-persistenced.1.gz
sudo install -D -m644 nvidia-persistenced-init.tar.bz2 /usr/share/nvidia/nvidia-persistenced-init.tar.bz2

# nvidia-egl-common
sudo install -D -m644 10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json
sudo install -D -m644 10_nvidia_wayland.json /usr/share/egl/egl_external_platform.d/10_nvidia_wayland.json

# Documentation
sudo install -D -m644 LICENSE /usr/share/licenses/nvidia/LICENSE
sudo install -D -m644 README.txt /usr/share/doc/nvidia/README
sudo install -D -m644 NVIDIA_Changelog /usr/share/doc/nvidia/NVIDIA_Changelog

###########################################
### NVIDIA Driver 32-bit Library Install
###########################################
# OpenGL library
sudo install -D -m755 32/libGL.so.$NV_VER /usr/$LIB32/nvidia/libGL.so.$NV_VER
sudo ln -sf libGL.so.$NV_VER /usr/$LIB32/nvidia/libGL.so.1
sudo ln -sf libGL.so.1 /usr/$LIB32/nvidia/libGL.so

# OpenGL core library
sudo install -D -m755 32/libnvidia-glcore.so.$NV_VER /usr/$LIB32/libnvidia-glcore.so.$NV_VER

# EGL API
sudo install -D -m755 32/libEGL.so.$NV_VER /usr/$LIB32/nvidia/libEGL.so.$NV_VER
sudo ln -sf libEGL.so.$NV_VER /usr/$LIB32/nvidia/libEGL.so.1
sudo ln -sf libEGL.so.1 /usr/$LIB32/nvidia/libEGL.so

# OpenGL|ES 1.x API
sudo install -D -m755 32/libGLESv1_CM.so.$NV_VER /usr/$LIB32/nvidia/libGLESv1_CM.so.$NV_VER
sudo ln -sf libGLESv1_CM.so.$NV_VER /usr/$LIB32/nvidia/libGLESv1_CM.so.1
sudo ln -sf libGLESv1_CM.so.1 /usr/$LIB32/nvidia/libGLESv1_CM.so

# OpenGL|ES 2.x API
sudo install -D -m755 32/libGLESv2.so.$NV_VER /usr/$LIB32/nvidia/libGLESv2.so.$NV_VER
sudo ln -sf libGLESv2.so.$NV_VER /usr/$LIB32/nvidia/libGLESv2.so.2
sudo ln -sf libGLESv2.so.2 /usr/$LIB32/nvidia/libGLESv2.so

# OpenGL|ES core library
sudo install -D -m755 32/libnvidia-eglcore.so.$NV_VER /usr/$LIB32/libnvidia-eglcore.so.$NV_VER

# NVENC Video Encoding
sudo install -D -m755 32/libnvidia-encode.so.$NV_VER /usr/$LIB32/libnvidia-encode.so.$NV_VER
sudo ln -sf libnvidia-encode.so.$NV_VER /usr/$LIB32/libnvidia-encode.so.1
sudo ln -sf libnvidia-encode.so.1 /usr/$LIB32/libnvidia-encode.so

# NVIDIA OpenGL-based Framebuffer Capture
sudo install -D -m755 32/libnvidia-fbc.so.$NV_VER /usr/$LIB32/libnvidia-fbc.so.$NV_VER

# NVIDIA OpenGL-based Inband Frame Readback
sudo install -D -m755 32/libnvidia-ifr.so.$NV_VER /usr/$LIB32/libnvidia-ifr.so.$NV_VER
sudo ln -sf libnvidia-ifr.so.$NV_VER /usr/$LIB32/libnvidia-ifr.so.so.1
sudo ln -sf libnvidia-ifr.so.so.1 /usr/$LIB32/libnvidia-ifr.so.so
sudo install -D -m755 32/libnvidia-glsi.so.$NV_VER /usr/$LIB32/libnvidia-glsi.so.$NV_VER

# OpenCL
sudo install -D -m755 32/libOpenCL.so.1.0.0 /usr/$LIB32/nvidia/libOpenCL.so.1.0.0
sudo ln -sf libOpenCL.so.1.0.0 /usr/$LIB32/nvidia/libOpenCL.so
sudo install -D -m755 32/libnvidia-compiler.so.$NV_VER /usr/$LIB32/libnvidia-compiler.so.$NV_VER
sudo ln -sf libnvidia-compiler.so.$NV_VER /usr/$LIB32/libnvidia-compiler.so.1
sudo ln -sf libnvidia-compiler.so.1 /usr/$LIB32/libnvidia-compiler.so
sudo install -D -m755 32/libnvidia-opencl.so.$NV_VER /usr/$LIB32/libnvidia-opencl.so.$NV_VER
sudo ln -sf libnvidia-opencl.so.$NV_VER "/usr/$LIB32/libnvidia-opencl.so"

# CUDA
sudo install -D -m755 32/libcuda.so.$NV_VER /usr/$LIB32/libcuda.so.$NV_VER
sudo ln -sf libcuda.so.$NV_VER /usr/$LIB32/libcuda.so
sudo install -D -m755 32/libnvcuvid.so.$NV_VER /usr/$LIB32/libnvcuvid.so.$NV_VER
sudo ln -sf libnvcuvid.so.$NV_VER /usr/$LIB32/libnvcuvid.so.1
sudo ln -sf libnvcuvid.so.1 /usr/$LIB32/libnvcuvid.so
sudo install -D -m755 32/libnvidia-ptxjitcompiler.so.$NV_VER /usr/$LIB32/libnvidia-ptxjitcompiler.so.$NV_VER

# VDPAU
sudo install -D -m755 32/libvdpau_nvidia.so.$NV_VER /usr/$LIB32/vdpau/libvdpau_nvidia.so.$NV_VER
sudo ln -sf libvdpau_nvidia.so.$NV_VER /usr/$LIB32/vdpau/libvdpau_nvidia.so.1
sudo ln -sf libvdpau_nvidia.so.1 /usr/$LIB32/vdpau/libvdpau_nvidia.so

# nvidia-tls library
sudo install -D -m755 32/tls/libnvidia-tls.so.$NV_VER /usr/$LIB32/libnvidia-tls.so.$NV_VER
sudo install -D -m755 32/libnvidia-ml.so.$NV_VER /usr/$LIB32/libnvidia-ml.so.$NV_VER
sudo ln -sf libnvidia-ml.so.$NV_VER /usr/$LIB32/libnvidia-ml.so

# NVIDIA OpenGL/GLX/EGL/GLES libraries
sudo install -D -m755 32/libEGL_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libEGL_nvidia.so.$NV_VER
sudo ln -sf libEGL_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libEGL_nvidia.so.0
sudo install -D -m755 32/libEGL.so.1.1.0 /usr/$LIB32/nvidia/libEGL.so.1.1.0
sudo install -D -m755 32/libGLdispatch.so.0 /usr/$LIB32/nvidia/libGLdispatch.so.0
sudo install -D -m755 32/libGLESv1_CM_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLESv1_CM_nvidia.so.$NV_VER
sudo ln -sf libGLESv1_CM_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLESv1_CM_nvidia.so.1
sudo install -D -m755 32/libGLESv2_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLESv2_nvidia.so.$NV_VER
sudo ln -sf libGLESv2_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLESv2_nvidia.so.2
sudo install -D -m755 32/libGL.so.1.7.0 /usr/$LIB32/nvidia/libGL.so.1.7.0
sudo install -D -m755 32/libGLX_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLX_nvidia.so.$NV_VER
sudo ln -sf libGLX_nvidia.so.$NV_VER /usr/$LIB32/nvidia/libGLX_nvidia.so.0
sudo install -D -m755 32/libGLX.so.0 /usr/$LIB32/nvidia/libGLX.so.0
sudo install -D -m755 32/libOpenGL.so.0 /usr/$LIB32/nvidia/libOpenGL.so.0

# NVIDIA FAT binary loader library
sudo install -D -m755 32/libnvidia-fatbinaryloader.so.$NV_VER /usr/$LIB32/libnvidia-fatbinaryloader.so.$NV_VER

sudo /sbin/ldconfig

############################################
### Install dkms sources
############################################
# Remove dkms sources
sudo rm -rf /usr/src/nvidia-$NV_VER

# patch dkms sources
cp LICENSE kernel/
cp README.txt kernel/
echo "nvidia.ko external" > kernel/Module.supported

cat > kernel/dkms.conf << EOF
# DKMS
PACKAGE_NAME="nvidia"
PACKAGE_VERSION=$NV_VER
BUILT_MODULE_NAME[0]=nvidia
DEST_MODULE_LOCATION[0]="/updates"
MAKE[0]="unset ARCH; IGNORE_CC_MISMATCH=1 env NV_VERBOSE=1 make \${parallel_jobs+-j\$parallel_jobs} modules KERNEL_UNAME=\${kernelver}"
CLEAN="make KERNEL_UNAME=\${kernelver} clean"
AUTOINSTALL=yes
BUILT_MODULE_NAME[1]="nvidia-modeset"
DEST_MODULE_LOCATION[1]="/updates"
BUILT_MODULE_NAME[2]="nvidia-drm"
DEST_MODULE_LOCATION[2]="/updates"
BUILT_MODULE_NAME[3]="nvidia-uvm"
DEST_MODULE_LOCATION[3]="/updates"
EOF

# copy dkms sources
sudo cp -R kernel /usr/src/nvidia-"$NV_VER"

# Install Kernel Modules
sudo /usr/sbin/dkms remove -m nvidia -v "$NV_VER" --all
sudo /usr/sbin/dkms build -m nvidia -v $NV_VER -k $(uname -r)
sudo /usr/sbin/dkms install -m nvidia -v $NV_VER -k $(uname -r)

sudo sh -c 'echo "blacklist nouveau" > /etc/modprobe.d/50-blacklist.conf'

# Debian
sudo update-initramfs -u

# Fedora /openSUSE
sudo dracut -f -v

代码: 全选

###########################################
### NVIDIA Driver 390.42 Remove
###########################################
# Debian
LIB=lib
LIB64=lib/x86_64-linux-gnu
LIB32=lib/i386-linux-gnu

# Fedora /openSUSE
LIB=lib64
LIB64=lib64
LIB32=lib

NV_VER='390.42'

## Remove all 64-bit library
sudo rm -f /usr/$LIB/xorg/modules/drivers/nvidia_drv.so
sudo rm -f /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so.$NV_VER
sudo rm -f /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so.1
sudo rm -f /usr/$LIB/nvidia/xorg/modules/extensions/libglx.so
sudo rm -f /usr/$LIB64/nvidia/libGL.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGL.so.1
sudo rm -f /usr/$LIB64/nvidia/libGL.so
sudo rm -f /usr/$LIB64/libnvidia-glcore.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libEGL.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libEGL.so.1
sudo rm -f /usr/$LIB64/nvidia/libEGL.so
sudo rm -f /usr/$LIB64/nvidia/libGLESv1_CM.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGLESv1_CM.so.1
sudo rm -f /usr/$LIB64/nvidia/libGLESv1_CM.so
sudo rm -f /usr/$LIB64/nvidia/libGLESv2.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGLESv2.so.2
sudo rm -f /usr/$LIB64/nvidia/libGLESv2.so
sudo rm -f /usr/$LIB64/libnvidia-eglcore.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-encode.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-encode.so.1
sudo rm -f /usr/$LIB64/libnvidia-encode.so
sudo rm -f /usr/$LIB64/libnvidia-fbc.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-ifr.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-ifr.so.so.1
sudo rm -f /usr/$LIB64/libnvidia-ifr.so.so
sudo rm -f /usr/$LIB64/libnvidia-glsi.so.$NV_VER
sudo rm -f /usr/$LIB64/vdpau/libvdpau_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB64/vdpau/libvdpau_nvidia.so.1
sudo rm -f /usr/$LIB64/vdpau/libvdpau_nvidia.so
sudo rm -f /usr/$LIB64/libcuda.so.$NV_VER
sudo rm -f /usr/$LIB64/libcuda.so
sudo rm -f /usr/$LIB64/libnvcuvid.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvcuvid.so.1
sudo rm -f /usr/$LIB64/libnvcuvid.so
sudo rm -f /usr/$LIB64/libnvidia-tls.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-ml.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-ml.so
sudo rm -f /usr/$LIB64/libnvidia-cfg.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-cfg.so.1
sudo rm -f /usr/$LIB64/libnvidia-cfg.so
sudo rm -f /usr/$LIB64/nvidia/libOpenCL.so.1.0.0
sudo rm -f /usr/$LIB64/nvidia/libOpenCL.so
sudo rm -f /usr/$LIB64/libnvidia-compiler.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-compiler.so.1
sudo rm -f /usr/$LIB64/libnvidia-compiler.so
sudo rm -f /usr/$LIB64/libnvidia-opencl.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-opencl.so
sudo rm -f /usr/$LIB64/nvidia/libEGL_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libEGL_nvidia.so.0
sudo rm -f /usr/$LIB64/nvidia/libEGL.so.1.1.0
sudo rm -f /usr/$LIB64/nvidia/libGLdispatch.so.0
sudo rm -f /usr/$LIB64/nvidia/libGLESv1_CM_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGLESv1_CM_nvidia.so.1
sudo rm -f /usr/$LIB64/nvidia/libGLESv2_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGLESv2_nvidia.so.2
sudo rm -f /usr/$LIB64/nvidia/libGL.so.1.7.0
sudo rm -f /usr/$LIB64/nvidia/libGLX_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libGLX_nvidia.so.0
sudo rm -f /usr/$LIB64/nvidia/libGLX.so.0
sudo rm -f /usr/$LIB64/libnvidia-fatbinaryloader.so.$NV_VER
sudo rm -f /usr/$LIB64/libnvidia-ptxjitcompiler.so.$NV_VER
sudo rm -f /usr/$LIB64/nvidia/libOpenGL.so.0
sudo rm -f /usr/$LIB/libnvidia-egl-wayland.so.1.0.2
sudo rm -f /usr/$LIB/nvidia/libnvidia-gtk2.so.$NV_VER
sudo rm -f /usr/$LIB/nvidia/libnvidia-gtk3.so.$NV_VER
sudo rm -f /usr/$LIB/libnvidia-wfb.so.$NV_VER
sudo rm -f /usr/$LIB/nvidia/xorg/modules/libwfb.so
sudo rm -f /etc/OpenCL/vendors/nvidia.icd
sudo rm -f /usr/bin/nvidia-settings
sudo rm -f /usr/share/man/man1/nvidia-settings.1.gz
sudo rm -f /usr/share/applications/nvidia-settings.desktop
sudo rm -f /usr/share/pixmaps/nvidia-settings.png
sudo rm -f /usr/share/nvidia/nvidia-application-profiles-"$NV_VER"-key-documentation
sudo rm -f /usr/share/nvidia/nvidia-application-profiles-"$NV_VER"-rc
sudo rm -f /usr/bin/nvidia-xconfig
sudo rm -f /usr/share/man/man1/nvidia-xconfig.1.gz
sudo rm -f /usr/bin/nvidia-smi
sudo rm -f /usr/share/man/man1/nvidia-smi.1.gz
sudo rm -f /usr/bin/nvidia-bug-report.sh
sudo rm -f /usr/bin/nvidia-cuda-mps-server
sudo rm -f /usr/bin/nvidia-cuda-mps-control
sudo rm -f /usr/share/man/man1/nvidia-cuda-mps-control.1.gz
sudo rm -f /usr/bin/nvidia-modprobe
sudo rm -f /usr/share/man/man1/nvidia-modprobe.1.gz
sudo rm -f /usr/bin/nvidia-persistenced
sudo rm -f /usr/share/man/man1/nvidia-persistenced.1.gz
sudo rm -f /usr/share/nvidia/nvidia-persistenced-init.tar.bz2
sudo rm -f /usr/share/glvnd/egl_vendor.d/10_nvidia.json
sudo rm -f /usr/share/egl/egl_external_platform.d/10_nvidia_wayland.json
sudo rm -f /usr/share/licenses/nvidia/LICENSE
sudo rm -f /usr/share/doc/nvidia/README
sudo rm -f /usr/share/doc/nvidia/NVIDIA_Changelog

## Remove all 32-bit library
sudo rm -f /usr/$LIB32/nvidia/libGL.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGL.so.1
sudo rm -f /usr/$LIB32/nvidia/libGL.so
sudo rm -f /usr/$LIB32/libnvidia-glcore.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libEGL.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libEGL.so.1
sudo rm -f /usr/$LIB32/nvidia/libEGL.so
sudo rm -f /usr/$LIB32/nvidia/libGLESv1_CM.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGLESv1_CM.so.1
sudo rm -f /usr/$LIB32/nvidia/libGLESv1_CM.so
sudo rm -f /usr/$LIB32/nvidia/libGLESv2.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGLESv2.so.2
sudo rm -f /usr/$LIB32/nvidia/libGLESv2.so
sudo rm -f /usr/$LIB32/libnvidia-eglcore.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-encode.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-encode.so.1
sudo rm -f /usr/$LIB32/libnvidia-encode.so
sudo rm -f /usr/$LIB32/libnvidia-fbc.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-ifr.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-ifr.so.so.1
sudo rm -f /usr/$LIB32/libnvidia-ifr.so.so
sudo rm -f /usr/$LIB32/libnvidia-glsi.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libOpenCL.so.1.0.0
sudo rm -f /usr/$LIB32/nvidia/libOpenCL.so
sudo rm -f /usr/$LIB32/libnvidia-compiler.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-compiler.so.1
sudo rm -f /usr/$LIB32/libnvidia-compiler.so
sudo rm -f /usr/$LIB32/libnvidia-opencl.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-opencl.so
sudo rm -f /usr/$LIB32/libcuda.so.$NV_VER
sudo rm -f /usr/$LIB32/libcuda.so
sudo rm -f /usr/$LIB32/libnvcuvid.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvcuvid.so.1
sudo rm -f /usr/$LIB32/libnvcuvid.so
sudo rm -f /usr/$LIB32/vdpau/libvdpau_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB32/vdpau/libvdpau_nvidia.so.1
sudo rm -f /usr/$LIB32/vdpau/libvdpau_nvidia.so
sudo rm -f /usr/$LIB32/libnvidia-tls.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-ml.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-ml.so
sudo rm -f /usr/$LIB32/nvidia/libEGL_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libEGL_nvidia.so.0
sudo rm -f /usr/$LIB32/nvidia/libEGL.so.1.1.0
sudo rm -f /usr/$LIB32/nvidia/libGLdispatch.so.0
sudo rm -f /usr/$LIB32/nvidia/libGLESv1_CM_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGLESv1_CM_nvidia.so.1
sudo rm -f /usr/$LIB32/nvidia/libGLESv2_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGLESv2_nvidia.so.2
sudo rm -f /usr/$LIB32/nvidia/libGL.so.1.7.0
sudo rm -f /usr/$LIB32/nvidia/libGLX_nvidia.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libGLX_nvidia.so.0
sudo rm -f /usr/$LIB32/nvidia/libGLX.so.0
sudo rm -f /usr/$LIB32/libnvidia-fatbinaryloader.so.$NV_VER
sudo rm -f /usr/$LIB32/libnvidia-ptxjitcompiler.so.$NV_VER
sudo rm -f /usr/$LIB32/nvidia/libOpenGL.so.0

sudo rm -r /usr/$LIB/nvidia
sudo rm -r /usr/$LIB64/nvidia
sudo rm -r /usr/$LIB32/nvidia
sudo rm -r /usr/share/licenses/nvidia
sudo rm -r /usr/share/doc/nvidia

sudo /sbin/ldconfig

## Remove kms
sudo /usr/sbin/dkms remove -m nvidia -v "$NV_VER" --all
sudo rm -r /usr/src/nvidia-"$NV_VER"

sudo rm -f /etc/modprobe.d/50-blacklist.conf

# Debian
sudo update-initramfs -u

# Fedora /openSUSE
sudo dracut -f -v

上次由 torachiyo 在 2018-03-23 23:50,总共编辑 10 次。
头像
torachiyo
帖子: 80
注册时间: 2015-11-29 8:32
系统: Kali Linux
送出感谢: 0
接收感谢: 4 次

Re: 手動編譯安裝 nvidia 驅動 (openSUSE / Fedora)

#2

帖子 torachiyo » 2018-03-19 19:40

Bumblebee for opensSUSE

代码: 全选

##################################
### bbswitch
##################################
# Build Requires:
sudo zypper install gcc make patch m4 binutils dkms kernel-default-devel libelf-devel

git clone https://github.com/Bumblebee-Project/bbswitch

sudo mkdir -p /usr/src/bbswitch-0.8
sudo cp bbswitch/bbswitch.c /usr/src/bbswitch-0.8/
sudo cp bbswitch/Makefile /usr/src/bbswitch-0.8/
sudo cp bbswitch/dkms/dkms.conf /usr/src/bbswitch-0.8/

sudo /usr/sbin/dkms remove -m bbswitch -v 0.8 --all
sudo /usr/sbin/dkms build -m bbswitch -v 0.8 -k $(uname -r)
sudo /usr/sbin/dkms install -m bbswitch -v 0.8 -k $(uname -r)

sudo sh -c 'echo "bbswitch" >> /usr/lib/modules-load.d/bbswitch.conf'
sudo sh -c 'echo "options bbswitch load_state=0 unload_state=1" >> /etc/modprobe.d/50-bbswitch.conf'

##################################
### primus
##################################
# Build Requires:
sudo zypper install gcc gcc-c++ glibc-devel Mesa-libGL-devel libX11-devel libstdc++-devel
sudo zypper install gcc-32bit gcc-c++-32bit glibc-devel-32bit libX11-devel-32bit libstdc++-devel-32bit

# PKG Depends:
sudo zypper install Mesa-dri Mesa-libGL1 glibc libX11-6 libstdc++6
sudo zypper install Mesa-dri-32bit Mesa-libGL1-32bit glibc-32bit libX11-6-32bit libstdc++6-32bit

git clone https://github.com/amonakov/primus

# Patch for openSUSE :
sed -i 's/# export PRIMUS_SYNC/export PRIMUS_SYNC/g' primus/primusrun
sed -i 's/# export PRIMUS_VERBOSE/export PRIMUS_VERBOSE/g' primus/primusrun
sed -i 's/# export PRIMUS_UPLOAD/export PRIMUS_UPLOAD/g' primus/primusrun
sed -i 's/# export PRIMUS_SLEEP/export PRIMUS_SLEEP/g' primus/primusrun
sed -i 's/# export PRIMUS_DISPLAY/export PRIMUS_DISPLAY/g' primus/primusrun
sed -i 's/# export PRIMUS_libGLa/export PRIMUS_libGLa/g' primus/primusrun
sed -i 's/# export PRIMUS_libGLd/export PRIMUS_libGLd/g' primus/primusrun
sed -i 's/$(dirname.*/'"'\/usr\/\$LIB\/primus'"'}/g' primus/primusrun

cd primus

LIBDIR=lib64 make
sudo install -D -m755 "primusrun" "/usr/bin/primusrun"
sudo install -D -m755 "lib64/libGL.so.1" "/usr/lib64/primus/libGL.so.1"
make clean

export CC="gcc -m32"
export CXX="g++ -m32"
LIBDIR=lib make
sudo install -D -m755 "lib/libGL.so.1" "/usr/lib/primus/libGL.so.1"

##################################
### bumblebee
##################################
# Build Requires:
sudo zypper install glib2-devel help2man pciutils pkg-config pwdutils xorg-x11-libX11-devel automake autoconf

# PKG Depends:
sudo zypper install glibc libglib-2 libX11-6 pciutils pwdutils xorg-x11-libX11

git clone https://github.com/Bumblebee-Project/Bumblebee

# PATCH:
# decimal-pciid patch
sed -i 's/02x/02d/g' Bumblebee/src/bbsecondary.c

# nvidia-uvm-modeset drm support
wget https://raw.githubusercontent.com/Mint-Fans/linux-package/SUSE/nvidia-uvm-modeset-drm-support.patch
patch -p0 -i nvidia-uvm-modeset-drm-support.patch

cd Bumblebee
autoreconf -fi
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --without-pidfile \
  --with-udev-rules=/usr/lib/udev/rules.d/ \
  CONF_DRIVER_MODULE_NVIDIA=nvidia \
  CONF_LDPATH_NVIDIA=/usr/lib64/nvidia:/usr/lib/nvidia \
  CONF_MODPATH_NVIDIA=/usr/lib64/nvidia/xorg/,/usr/lib64/xorg/modules \
  CONF_PRIMUS_LD_PATH=/usr/lib64/primus:/usr/lib/primus

make
sudo make install

sudo install -D -m644 "scripts/systemd/bumblebeed.service" "/usr/lib/systemd/system/bumblebeed.service"
sudo ln -s /usr/sbin/service /usr/sbin/rcbumblebeed
sudo sed -i '3i After=dkms.service systemd-modules-load.service' /systemd/system/bumblebeed.service

sudo groupadd -r bumblebee
sudo gpasswd -a $USER bumblebee
sudo gpasswd -a $USER video

sudo sh -c 'echo "blacklist nouveau" > /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia" >> /etc/modprobe.d/50-blacklist.conf'

sudo sed -i 's/Exec=.*/Exec=sudo optirun -b none nvidia-settings -c :8/g' /usr/share/applications/nvidia-settings.desktop

sudo systemctl enable bumblebeed.service

sudo dracut -f -v

上次由 torachiyo 在 2018-03-19 20:26,总共编辑 3 次。
头像
torachiyo
帖子: 80
注册时间: 2015-11-29 8:32
系统: Kali Linux
送出感谢: 0
接收感谢: 4 次

Re: 手動編譯安裝 nvidia 驅動 (openSUSE / Fedora)

#3

帖子 torachiyo » 2018-03-19 19:41

Bumblebee for Fedora

代码: 全选

##################################
### bbswitch
##################################
# Build Requires:
sudo dnf install gcc make patch m4 kernel-devel
git clone https://github.com/Bumblebee-Project/bbswitch

Patch for Linux 4.13:
sed -i 's/asm/linux/g' bbswitch/bbswitch.c

sudo mkdir -p /usr/src/bbswitch-0.8
sudo cp bbswitch/bbswitch.c /usr/src/bbswitch-0.8/
sudo cp bbswitch/Makefile /usr/src/bbswitch-0.8/
sudo cp bbswitch/dkms/dkms.conf /usr/src/bbswitch-0.8/

sudo /usr/sbin/dkms remove -m bbswitch -v 0.8 --all
sudo /usr/sbin/dkms build -m bbswitch -v 0.8 -k $(uname -r)
sudo /usr/sbin/dkms install -m bbswitch -v 0.8 -k $(uname -r)

sudo sh -c 'echo "bbswitch" >> /usr/lib/modules-load.d/bbswitch.conf'
sudo sh -c 'echo "options bbswitch load_state=0 unload_state=1" >> /etc/modprobe.d/50-bbswitch.conf'

##################################
### primus
##################################
# Build Requires:
sudo dnf install mesa-libGL-devel gcc gcc-c++ glibc-devel libX11-devel libstdc++-devel
sudo dnf install glibc-devel.i686 libX11-devel.i686 libstdc++-devel.i686

# PKG Depends: 
sudo dnf install mesa-dri-drivers mesa-libGL libX11 glibc libstdc++
sudo dnf install mesa-dri-drivers.i686 mesa-libGL.i686 libX11.i686 glibc.i686 libstdc++.i686

git clone https://github.com/amonakov/primus

# Patch for Fedora
sed -i 's/^PRIMUS_libGL=.*/PRIMUS_libGL='"'\/usr\/\$LIB\/primus'"'/g' primus/primusrun
sed -i '/^# PRIMUS_libGL/a export __GLVND_DISALLOW_PATCHING=1' primus/primusrun

cd primus

LIBDIR=lib64 make
sudo install -D -m755 "primusrun" "/usr/bin/primusrun"
sudo install -D -m755 "lib64/libGL.so.1" "/usr/lib64/primus/libGL.so.1"
make clean

export CC="gcc -m32"
export CXX="g++ -m32"
LIBDIR=lib make
sudo install -D -m755 "lib/libGL.so.1" "/usr/lib/primus/libGL.so.1"

##################################
### bumblebee
##################################
# Build Requires:
sudo dnf install autoconf automake libbsd-devel glib2-devel libX11-devel help2man
# PKG Depends:
sudo dnf install libbsd glib2 glibc libX11

git clone https://github.com/Bumblebee-Project/Bumblebee

# Patch for Fedora
# xorg.nvidia fix
cat >> Bumblebee/conf/xorg.conf.nvidia << EOF

Section "ServerFlags"
 Option "IgnoreABI" "1" 
EndSection
EOF

# libglvnd fix
sed -i '/BUMBLEBEE_SOCKET/a +  setenv("__GLVND_DISALLOW_PATCHING", "1", 0);' Bumblebee/src/optirun.c
sed -i 's/+  setenv/  setenv/g' Bumblebee/src/optirun.c

# xorg wrap fix
sed -i 's/"Xorg"/"\/usr\/libexec\/Xorg.wrap"/g' Bumblebee/src/bbsecondary.h

# modprobe fix
wget https://raw.githubusercontent.com/Mint-Fans/linux-package/fedora/bumblebee-modprobefix.patch
patch -p0 -i bumblebee-modprobefix.patch

cd Bumblebee
autoreconf -fi
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --without-pidfile \
  --with-udev-rules=/usr/lib/udev/rules.d/ \
  CONF_DRIVER_MODULE_NVIDIA=nvidia \
  CONF_LDPATH_NVIDIA=/usr/lib64/nvidia:/usr/lib/nvidia \
  CONF_MODPATH_NVIDIA=/usr/lib64/nvidia/xorg/,/usr/lib64/xorg/modules \
  CONF_PRIMUS_LD_PATH=/usr/lib64/primus:/usr/lib/primus

make
sudo make install

sudo install -D -m644 "scripts/systemd/bumblebeed.service" "/usr/lib/systemd/system/bumblebeed.service"

sudo groupadd -r bumblebee
sudo gpasswd -a $USER bumblebee
sudo gpasswd -a $USER video

sudo sh -c 'echo "blacklist nouveau" > /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia" >> /etc/modprobe.d/50-blacklist.conf'

sudo sed -i 's/Exec=.*/Exec=sudo optirun -b none nvidia-settings -c :8/g' /usr/share/applications/nvidia-settings.desktop

sudo systemctl enable bumblebeed.service

sudo dracut -f -v

上次由 torachiyo 在 2018-03-23 9:04,总共编辑 1 次。
头像
torachiyo
帖子: 80
注册时间: 2015-11-29 8:32
系统: Kali Linux
送出感谢: 0
接收感谢: 4 次

Re: 手動編譯安裝 nvidia 驅動

#4

帖子 torachiyo » 2018-03-23 6:47

Bumblebee for Debian

代码: 全选

##################################
### bbswitch
##################################
# Build Requires:
sudo apt-get install gcc make patch linux-headers-amd64

git clone https://github.com/Bumblebee-Project/bbswitch

Patch for Debian:
sed -i 's/asm/linux/g' bbswitch/bbswitch.c
sed -i 's/#MODULE_VERSION#/0.8/g' bbswitch/dkms/dkms.conf

sudo mkdir -p /usr/src/bbswitch-0.8
sudo cp bbswitch/bbswitch.c /usr/src/bbswitch-0.8/
sudo cp bbswitch/Makefile /usr/src/bbswitch-0.8/
sudo cp bbswitch/dkms/dkms.conf /usr/src/bbswitch-0.8/

sudo /usr/sbin/dkms remove -m bbswitch -v 0.8 --all
sudo /usr/sbin/dkms build -m bbswitch -v 0.8 -k $(uname -r)
sudo /usr/sbin/dkms install -m bbswitch -v 0.8 -k $(uname -r)

sudo sh -c 'echo "options bbswitch load_state=0 unload_state=1" > /etc/modprobe.d/50-bbswitch.conf'

##################################
### primus
##################################
# Build Requires:
sudo apt-get install gcc-multilib g++-multilib mesa-common-dev libx11-dev libx11-dev:i386

# PKG Depends:
sudo apt-get install socat xserver-xorg-core libgl1-mesa-dri libc6 libgcc1 libgl1-mesa-glx libstdc++6 libx11-6
sudo apt-get install libgl1-mesa-dri:i386 libc6-i386 libgcc1:i386 libgl1-mesa-glx:i386 libstdc++6:i386 libx11-6:i386

git clone https://github.com/amonakov/primus

# Patch for Debian
sed -i 's/$(dirname.*/'"'\/usr\/\$LIB\/primus'"'}/g' primus/primusrun
sed -i '/LD_LIBRARY_PATH/d' primus/primusrun
sed -i '/exec/d' primus/primusrun
echo 'bblibs=$(echo -ne '"'Q LibraryPath\0'"' | \' >> primus/primusrun
echo '  socat - UNIX-CONNECT:/var/run/bumblebee.socket | sed '"'s/^Value: \\(.*\\)/\1/'"')' >> primus/primusrun
echo 'PRIMUS_libGL=${PRIMUS_libGL}${bblibs:+:$bblibs}' >> primus/primusrun
echo 'export LD_LIBRARY_PATH=${PRIMUS_libGL}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}' >> primus/primusrun
echo 'exec "$@"' >> primus/primusrun
sed -i 's/-lX11/$(LDFLAGS) -lX11/g' primus/Makefile

cd primus

LIBDIR=lib64 make
sudo install -D -m755 "primusrun" "/usr/bin/primusrun"
sudo install -D -m755 "lib64/libGL.so.1" "/usr/lib/x86_64-linux-gnu/primus/libGL.so.1"

# Build 32-bit Library
export CC="gcc -m32"
export CXX="g++ -m32"
LIBDIR=lib32 make

sudo install -D -m755 "lib32/libGL.so.1" "/usr/lib/i386-linux-gnu/primus/libGL.so.1"

##################################
### bumblebee
##################################
# Build Requires:
sudo apt-get install automake libbsd-dev libglib2.0-dev libc6-dev libx11-dev help2man pkg-config libkmod-dev

# PKG Depends:
sudo apt-get install xserver-xorg-core libbsd0 libglib2.0-0 libc6 libx11-6 libkmod2

git clone https://github.com/Bumblebee-Project/Bumblebee

# Patch for Debian:
wget https://raw.githubusercontent.com/Mint-Fans/linux-package/debian/bumblebee-debian.patch
patch -p0 -i bumblebee-debian.patch

cd Bumblebee
autoreconf -fi
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --without-pidfile \
  --with-udev-rules=/lib/udev/rules.d/ \
  CONF_DRIVER_MODULE_NVIDIA=nvidia \
  CONF_LDPATH_NVIDIA=/usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/i386-linux-gnu/nvidia:/usr/lib/nvidia \
  CONF_MODPATH_NVIDIA=/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules \
  CONF_PRIMUS_LD_PATH=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/primus:/usr/lib32/primus \
  CONF_XORG_BINARY=/usr/lib/xorg/Xorg

make
sudo make install

sudo install -D -m644 "scripts/systemd/bumblebeed.service" "/lib/systemd/system/bumblebeed.service"

sudo groupadd --system bumblebee
sudo gpasswd -a $USER bumblebee
sudo gpasswd -a $USER video

sudo sh -c 'echo "blacklist nouveau" > /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia" >> /etc/modprobe.d/50-blacklist.conf'

sudo sed -i 's/Exec=.*/Exec=sudo optirun -b none nvidia-settings -c :8/g' /usr/share/applications/nvidia-settings.desktop

sudo systemctl enable bumblebeed.service

sudo update-initramfs -u

头像
torachiyo
帖子: 80
注册时间: 2015-11-29 8:32
系统: Kali Linux
送出感谢: 0
接收感谢: 4 次

Re: 手動編譯安裝 nvidia 390.x 驅動

#5

帖子 torachiyo » 2018-03-23 23:49

Bumblebee for Arch Linux

代码: 全选

##################################
### bbswitch
##################################
# Requires:
sudo pacman -S dkms gcc make patch linux-headers

git clone https://github.com/Bumblebee-Project/bbswitch

# Patch for Linux 4.13:
# sed -i 's/asm/linux/g' bbswitch/bbswitch.c
# Patch for dkms:
# sed -i 's/#MODULE_VERSION#/0.8/g' bbswitch/dkms/dkms.conf

sudo mkdir -p /usr/src/bbswitch-0.8
sudo cp bbswitch/bbswitch.c /usr/src/bbswitch-0.8/
sudo cp bbswitch/Makefile /usr/src/bbswitch-0.8/
sudo cp bbswitch/dkms/dkms.conf /usr/src/bbswitch-0.8/

sudo /usr/sbin/dkms remove -m bbswitch -v 0.8 --all
sudo /usr/sbin/dkms build -m bbswitch -v 0.8 -k $(uname -r)
sudo /usr/sbin/dkms install -m bbswitch -v 0.8 -k $(uname -r)

sudo sh -c 'echo "options bbswitch load_state=0 unload_state=1" > /etc/modprobe.d/50-bbswitch.conf'

##################################
### primus
##################################
# Requires:
sudo pacman -S gcc-multilib lib32-gcc-libs glibc libx11 mesa lib32-mesa

git clone https://github.com/amonakov/primus

# Patch for Arch:
wget https://raw.githubusercontent.com/Mint-Fans/linux-package/NVIDIA/primus-register_cleanup-arch.patch
patch -p0 -i primus-register_cleanup-arch.patch
sed -i -e '/^PRIMUS_libGL=/cPRIMUS_libGL=/usr/\\$LIB/primus' \
    -e '/^exec/iexport __GLVND_DISALLOW_PATCHING=1' primus/primusrun

cd primus

LIBDIR=lib64 make
sudo install -D -m755 "primusrun" "/usr/bin/primusrun"
sudo install -D -m755 "lib64/libGL.so.1" "/usr/lib/primus/libGL.so.1"

# Build 32-bit Library
export CC="gcc -m32"
export CXX="g++ -m32"
LIBDIR=lib32 make

sudo install -D -m755 "lib32/libGL.so.1" "/usr/lib32/primus/libGL.so.1"

##################################
### bumblebee
##################################
# Build Requires:
sudo pacman -S automake libbsd glib2 glibc libx11 help2man pkg-config kmod

# PKG Depends:
sudo pacman -S libbsd glib2 glibc libx11 kmod

git clone https://github.com/Bumblebee-Project/Bumblebee

# Patch for Arch:
wget https://raw.githubusercontent.com/Mint-Fans/linux-package/NVIDIA/bumblebee-arch.patch
patch -p0 -i bumblebee-arch.patch

cd Bumblebee
autoreconf -fi
./configure \
  --prefix=/usr \
  --sbindir=/usr/bin \
  --sysconfdir=/etc \
  --without-pidfile \
  --with-udev-rules=/usr/lib/udev/rules.d \
  CONF_DRIVER_MODULE_NVIDIA=nvidia \
  CONF_LDPATH_NVIDIA=/usr/lib/nvidia:/usr/lib32/nvidia:/usr/lib:/usr/lib32 \
  CONF_MODPATH_NVIDIA=/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules \
  CONF_PRIMUS_LD_PATH=/usr/lib/primus:/usr/lib32/primus

make
sudo make install

sudo install -D -m644 "scripts/systemd/bumblebeed.service" "/usr/lib/systemd/system/bumblebeed.service"

sudo groupadd --system bumblebee
sudo gpasswd -a $USER bumblebee
sudo gpasswd -a $USER video

sudo sh -c 'echo "blacklist nouveau" > /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia" >> /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia-drm" >> /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia-modeset" >> /etc/modprobe.d/50-blacklist.conf'
sudo sh -c 'echo "blacklist nvidia-uvm" >> /etc/modprobe.d/50-blacklist.conf'

sudo sed -i 's/Exec=.*/Exec=sudo optirun -b none nvidia-settings -c :8/g' /usr/share/applications/nvidia-settings.desktop

sudo systemctl enable bumblebeed.service

sudo mkinitcpio -p linux

回复

回到 “其它类Unix OS发行版”