problem about insmod
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");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
what log?
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??