[英]Cannot find the kernel-headers although installed
I have written a test module for linux kernel. 我已经为Linux内核编写了一个测试模块。 This module needs headers
<linux/config.h>
and <asm/system.h>
. 该模块需要标头
<linux/config.h>
和<asm/system.h>
。 When I issued make
, it gave me error fatal error: linux/config.h: No such file or directory
and in the same way if I comment config.h
header then it says asm/system.h: No such file or directory
. 当我发出
make
,它给了我fatal error: linux/config.h: No such file or directory
,如果我注释config.h
标头, asm/system.h: No such file or directory
同样的方式显示asm/system.h: No such file or directory
。 I tried searching for the problem and came across solution that these headers belong ti kernel-headers
package. 我尝试搜索该问题,并遇到了这些标头属于ti
kernel-headers
软件包的解决方案。 I installed this package (although it was already installed on my system). 我安装了此软件包(尽管它已经安装在我的系统上)。 But then to it cannot find these two headers.
但是到时找不到这两个标头。 I found solution of soft-linking
autoconf.h
from /usr/src/
path, but unfortunately I could not find any headers folder installed on this path. 我从
/usr/src/
路径中找到了autoconf.h
链接autoconf.h
解决方案,但是不幸的是,我找不到在该路径上安装的任何头文件文件夹。 Can anyone tell me where is the problem with my code? 谁能告诉我代码的问题在哪里? I am using F20 operating system and kernel version is 3.12.9-301.fc20.x86_64.
我正在使用F20操作系统,内核版本为3.12.9-301.fc20.x86_64。
It seems that your Makefile don't know where to search for kernel headers. 您的Makefile似乎不知道在哪里搜索内核标头。 Can you try with this Makefile : just type
make
and it should build using kernel-headers of your current running kernel. 您可以尝试使用此Makefile吗:只需键入
make
,它就应该使用当前正在运行的内核的内核标头进行构建。
# Run this Makefile as follows:
# (MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
#
KDIR= /lib/modules/$(shell uname -r)/build
obj-m := test.o
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
install:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules_install
depmod -a
clean:
rm -f *~
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
The file include/linux/config.h has been removed from 2.6.19 kernel.
文件include / linux / config.h已从2.6.19内核中删除。 So remember this if you build your favorite module against the new 2.6.19 kernel and you get an error similar to this:
因此,如果您针对新的2.6.19内核构建自己喜欢的模块,并且遇到类似以下错误,请记住这一点:
fatal error: linux/config.h: No such file or directory
#include <linux/config.h>
src: src:
http://www.linuxquestions.org/questions/linux-kernel-70/removal-of-include-linux-config-h-file-in-2-6-19-kernel-506363/ http://www.linuxquestions.org/questions/linux-kernel-70/removal-of-include-linux-config-h-file-in-2-6-19-kernel-506363/
您可以尝试仅触摸linux / config.h文件并尝试制作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.