关于最简单的驱动编译hello的问题,好纠结啊,有懂得大侠吗
嵌入式技术吧
全部回复
仅看楼主
level 4
Austin丁 楼主
这是原码
#include
#if defined(CONFIG_SMP)
#define _SMP_#
endif
#if defined(CONFIG_MODVERSIONS)#define MODVERSIONS#include #endif
#include
static _init int init_module(void){ printk(KERN_DEBUG "HELLO,KERNEL!\"); return 0;}
static _exit void cleanup_module(void){ printk(KERN_DEBUG "GOOD-BYE,kernel!\n");}
这是编译语句
gcc -D_KERNEL_ -I/usr/src/linux/include -DMODULE -Wall -O2 -c hello_kernel.c -o hello_kernel.o
出错的提示
hello_kernel.c:1:25: fatal error: linux/module.h: No such file or directorycompilation terminated.
2013年05月20日 14点05分 1
level 4
根据编译器的提示,应该是什么找到头文件,楼主用的是vim么?建议先用eclipse开发环境。
2013年05月22日 04点05分 2
我用的是VIM编译器,eclipse可以开发驱动吗
2013年05月23日 13点05分
level 9
楼主你用locate命令查查module.h在你电脑的哪里,再改编译选项试试。
2013年05月24日 12点05分 3
试过了,可还是不行
2013年05月24日 13点05分
1