阅读:672回复:0
大家帮帮忙!
小弟刚开始学习编写linux设备驱动,下面代码在redhat 9.0下编译无法通过,错误+警告很多,实在是打击信心,请各位帮我看看问题出在那儿?
编译命令为:gcc -D__kernel__ -DMODULE -Wall -O2 -c module.c -o module.o //module.c #include <linux/fs.h> #include<linux/module.h> #if defined(CONFIG_SMP) #define __SMP__ #endif #if defined(CONFIG_MODVERSTONS) #define MODVERSIONS #include<linux/modversions.h> #endif #include<linux/kernel.h> static struct file_operations test_fops = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; int init_module(void) { register_chrdev(42,\"test\",&test_fops); return 0; } void cleanup_module(void) { unregister_chrdev(42, \"test\"); } |
|