编译最简单的 hello world 模块出错,郁闷了,大家帮我来看看吧
刚自学linux驱动,对照着linux设备驱动程序(第三版)写了个hello world 就出错~~严重打击啊~各位大虾帮我看下 ~~谢谢了
内核版本:2.6.15
用的系统是ubuntu的
hello world代码是
#include <linux/module.h>
#include < linux/config.h>
#include <linux/init.h>
MODULE_LICENSE( "GPL ");// 新,否则有 waring, 去掉了 #define MODULE, 自动定义
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n ");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n ");
}
module_init(hello_init);// 必须!!
module_exit(hello_exit); // 必须!!
Makefile里面就一句
obj-m := hello.o
#make -C /usr/src/linux-source-2.6.15 SUBDIRS=$PWD modules
然后就出现一大堆错误~~
出现的错误太多了 ~~COPY了前面几行和后面几行,太多了显示不下~中没有全部COPY下来,大家帮我看下吧~~谢谢了
/******************************************************************************************/
make: Entering directory `/usr/src/linux-source-2.6.15 '
Makefile:490: .config: No such file or directory
WARNING: Symbol version dump /usr/src/linux-source-2.6.15/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/wyc/drivers/hello.o
cc1: error: include/linux/autoconf.h: No such file or directory
In file included from include/linux/module.h:9,
from /home/wyc/drivers/hello.c:1:
include/linux/config.h:6:28: error: linux/autoconf.h: No such file or directory
In file included from include/linux/module.h:10,
from /home/wyc/drivers/hello.c:1:
include/linux/sched.h:4:36: error: asm/param.h: No such file or directory
In file included from include/linux/posix_types.h:47,
from include/linux/types.h:14,
from include/linux/capability.h:16,
from include/linux/sched.h:7,
from include/linux/module.h:10,
from /home/wyc/drivers/hello.c:1:
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h:13:22: error: features.h: No such file or director