linux 关于编译模块缺少config.h而…

linux 关于编译模块缺少config.h而产生错误的问题

分类: 基于类linux的开发 嵌入式系统的研究与开发 2009-08-02 22:48 3155人阅读

问题来源:
Compiling for /home/dsr-uu-0.2
make -C /lib/modules/2.6.18-1.2798.fc6/build SUBDIRS=/home/dsr-uu-0.2 modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
  CC [M]  /home/dsr-uu-0.2/dsr-module.o
/home/dsr-uu-0.2/dsr-module.c:16:26: 错误:linux/config.h:没有那个文件或目录
make[2]: *** [/home/dsr-uu-0.2/dsr-module.o] 错误 1
make[1]: *** [_module_/home/dsr-uu-0.2] 错误 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-1.2798.fc6-i686'
make: *** [dsr.ko] 错误 2
解决方法;
我看的方法是从网上看到的看到的。呵呵
1)先把我实验正确的方法贴出:The file include/linux/config.h has been removed from 2.6.18 kernel. So remember this if you build your favorite module against the new 2.6.19 kernel and you get an error。 Thats because there is no more include/linux/config.h file in 2.6.19. This is from the Changelog:

Quote:

Author: Dave Jones
Date: Mon Oct 9 19:13:51 2006 -0400

[HEADERS] Put linux/config.h out of its misery.

Signed-off-by: Dave Jones



Author: Paul Mundt
Date: Tue Oct 3 13:19:02 2006 +0900

sh: Kill off remaining config.h references.

A few of these managed to sneak back in, get rid of them once
and for all.

解决方法:
The reason I posted this is for people who have the kernel sources installed and are trying to build a module against the sources and are getting the error I mentioned. You wouldn't be trying to build a module for the 2.6.19 kernel unless you had the sources installed.

Actually there is not much to the file:

Code:
#ifndef _LINUX_CONFIG_H

#define _LINUX_CONFIG_H



#include



#endif



So if you have problems you could probably just add to code here to your module.c file.



我也就是和上面的一样,但是程序还是不认上面的补丁程序;所以,我亲自手动把所有包含config.h的源文件改成autoconf.h。这样就没有出错了。但是还有人说2.6.23后没有了autoconf.h了。那就需要再先看看下面的方法有用没?

2)well the .h files are not from the main kernel package ,they are from the devel package(unless you built it yourself)

if kernel-devel(or -source depending on distro) isn't installed there wouldn't be any useful includes

你可能感兴趣的:(基于类linux的开发)