Fedora 更新内核后自动编译Nvidia驱动

13 7 月

1、下载Nvidia驱动并解压,使用-x参数即可解压

2、解压后的目录复制到/usr/src/nvidia-driver目录

3、创建/etc/kernel/postinst.d/99-update-nvidia.sh文件,输入以下内容

#!/bin/bash
DRIVER=/usr/src/nvidia-driver/nvidia-installer
if [ -e /lib/modules/$1/kernel/drivers/video/nvidia.ko ]; then
	echo "Nvidia driver already exists for this kernel." >&2
else
	echo "Building Nvidia driver for kernel $1" >&2
	$DRIVER -s --install-libglvnd -K -k $1 >1 > /dev/null
	if [ -e /lib/modules/$1/kernel/drivers/video/nvidia.ko ]; then
		echo " SUCCESS: Driver installed for kernel $1" >&2
	else
		echo " FAILURE: See /var/log/nvidia-installer.log" >&2
	fi
fi
exit 0

4、赋予/etc/kernel/postinst.d/99-update-nvidia.sh执行权限即可。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注