内核编译错误fatal error: linux/config.h: No such file or

进行内核模块的编译时,因为包含了#include <linux/config.h>,出现include的linux下没有config.h这个文件错误提示:

fatal error: linux/config.h: No such file or directory

原因与解决方法:

现在较新的内核已经弃用了config.h,把这个文件新建上去即可。执行命令(注意路径的不同):

$sudo vim /usr/src/linux-source-2.6.38/include/linux/config.h

输入如下内容:

 #ifndef _LINUX_CONFIG_H
 #define _LINUX_CONFIG_H
 #endif

保存后退出重新编译,OK!