linux-kernel - 适用于 Linux 的 Nvidia 驱动程序找不到 kernel.h 文件

标签 linux-kernel

我知道我的 kernel.h 文件位于/usr/include/linux/中 但这个 Nvidia 程序找不到它 然后它要求我使用 --kernel-source-path 参数运行它 我确实给了它这条路,但它不起作用 它说找不到它,因为它不会走正确的路径 只需通过

即可运行

./nvidia.run

返回:

ERROR: Unable to find the kernel source tree for the currently running<br/> kernel. Please make sure you have installed the kernel source files<br/> for your kernel and that they are properly configured; on Red Hat<br/> Linux systems, for example, be sure you have the 'kernel-source' or<br/> 'kernel-devel' RPM installed. If you know the correct kernel source<br/> files are installed, you may specify the kernel source path with the<br/> '--kernel-source-path' command line option.

然后通过

运行它

./nvidia.run --kernel-source-path /usr/include/linux/

返回:

ERROR: The kernel header file '/usr/include/linux//include/linux/kernel.h'<br/> does not exist. The most likely reason for this is that the kernel<br/> source path '/usr/include/linux/' is incorrect. Please make sure you have installed the kernel source files for your kernel and that they<br/> are properly configured; on Red Hat Linux systems, for example, be<br/> sure you have the 'kernel-source' or 'kernel-devel' RPM installed.<br/> If you know the correct kernel source files are installed, you may<br/> specify the kernel source path with the '--kernel-source-path'<br/> command line option.

我的第一个想法是从地址中删除/include/linux/ 但告诉它去路径/usr/只是告诉我它是无效的。 kernel.h 文件确实位于/usr/include/linux/kernel.h 中 但我无法让它阅读。

ERROR: The kernel source path '/usr/' is invalid. Please make sure you have installed the kernel source files for your kernel and that they are<br/> properly configured; on Red Hat Linux systems, for example, be sure<br/> you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify<br/> the kernel source path with the '--kernel-source-path' command line<br/> option.

最佳答案

根据https://ubuntuforums.org/showthread.php?t=843914 ,你可以试试

sudo apt update
sudo apt install linux-headers-`uname -r`

关于linux-kernel - 适用于 Linux 的 Nvidia 驱动程序找不到 kernel.h 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51883133/

相关文章:

c - 如何找到哪个函数打印 printk 语句?

linux - 如何异步检查 ipv6 网络接口(interface)是否在 linux 中将状态从 tentative 更改为 "valid"?

c - 使用 alloc_pages 分配页面是否也分配结构?

linux - 内核如何理解哪个驱动模块函数处理读/写/等?

linux-kernel - Linux函数class_device_create改为?

linux - VmSize = 物理内存 + swap?

linux - 在 Linux 中允许或阻止访问端口

linux - 如何增加内核内部的进程能力?

linux - 如何在击键中断后初始化 tasklet?

linux - 如果 Netfilter Hook 都指定 NF_IP_PRI_LAST 或 NF_IP_PRI_FIRST,它们的顺序是什么?