免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2345 | 回复: 2
打印 上一主题 下一主题

problem about insmod [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-04 01:59 |只看该作者 |倒序浏览
hello all
I am just beginning to play with linux kernel,but  I got blocked while insertings my first simple module which just log some message in the init and exit function.when I invoke insmod hello.ko,a segmentation fault arised,how can I fix this problem.
here is my code:
/*
*helloworld.c  Hello World! As a kernel Module
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

/*
*hello_init : the init function
*/
static int hello_init(void)
{
    //printk(KERN_ALERT "hello world startup.\n");
        return 0;
}

/*
*hello_exit : the exit function
*/
static void hello_exit(void)
{
    //printk(KERN_ALERT "hello world exit.\n");
}

module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("alex");

论坛徽章:
0
2 [报告]
发表于 2008-06-04 11:00 |只看该作者
what log?

论坛徽章:
0
3 [报告]
发表于 2008-06-15 19:24 |只看该作者
ok,I had just made a foolish mistake that the kernel running in the system was not exactly the one I bulilt my module,although the versions are the same.Maybe the segmentation fault was caused by the mismatch of the System.map.Any ideas??
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP