但是make是可以成功的 加载模块时再次出现错误 仍然是open_softirq为不能识别的符号
刚开始我以为是fc6自带的源码包只有.h文件 没有.c文件才会这样 于是下载了2.6.18.1源码包 在fc6下编译 再make 加载模块 仍然出现同样的问题
但是在2.6.15.5内核环境下是可以通过编译的 也可以正常加载 还可以看到打印输出hello,world!!
想请教大家究竟是怎么回事呢
#include
#include
#include
#include
MODULE_DESCRIPTION("My kernel module");
MODULE_AUTHOR("root (root@localhost.localdomain)");
MODULE_LICENSE("$LICENSE$");
static void timer_func(struct softirq_action *h)
{
printk(KERN_ALERT "hello,world!!\n");
}
void fastcall raise_softirq(unsigned int nr)
{
unsigned long flags;
local_irq_save(flags);
raise_softirq_irqoff(nr);
local_irq_restore(flags);
}
static int test1_init_module(void)
{
printk( KERN_DEBUG "Module test1 init\n" );
open_softirq(TIMER_SOFTIRQ,timer_func,NULL);
raise_softirq(TIMER_SOFTIRQ);
return 0;
}
static void test1_exit_module(void)
{
printk( KERN_DEBUG "Module test1 exit\n" );
}
module_init(test1_init_module);
module_exit(test1_exit_module);
salvage 于 2008-08-01 02:30:20发表:
除了在内核源代码中修改 加入EXPORT_SYMBOL 之外 还有其他的办法吗
salvage 于 2008-08-01 02:07:34发表:
刚才又看了一下 原来是open_softirq在15中是通过EXPORT_SYMBOL在softirq.c中声明的 在18中却不是这样
但是 18的interrupt.h也通过
extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
声明了open_softirq 引用了interrupt.h之后 为何还是不能使用open_softirq呢