linux内核模块问题 insmod: error inserting './hello.ko': -1 Invalid module format
root@a123-virtual-machine:/mnt/hgfs/Win/device/04/hello# modinfo hello.ko
filename: hello.ko
alias: a simplest module
description: A simple Hello World Module
author: Song Baohua
license: Dual BSD/GPL
srcversion: AF31C8A811E72E11F852B3E
depends:
vermagic: 2.6.38-8-generic mod_unload modversions ARMv5
root@a123-virtual-machine:/mnt/hgfs/Win/device/04/hello# uname -r
2.6.38-8-generic
其中
vermagic: 2.6.38-8-generic mod_unload modversions ARMv5
是我根据网上找的方法改变2.6.30.4为2.6.30-8-generic 德到的,但是问题还是没有解决,网上还有说需要下载与内核同样的源码,但是我一直没找到2.6.38-8-generic内核源码,哪位大侠给个地址 或者发到邮箱635432187@qq.com。或者给个成功的解决办法
Makfile
obj-m :=hello.o
代码 :/*======================================================================
A simple kernel module: "hello world"
The initial developer of the original code is Baohua Song
<author@linuxdriver.cn>. All Rights Reserved.
======================================================================*/
#include
#include
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_INFO " Hello World enter\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_INFO " Hello World exit\n ");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_AUTHOR("Song Baohua");
MODULE_DESCRIPTION("A simple Hello World Module");
MODULE_ALIAS("a simplest module");
求解呀
于 2013-01-22 12:01:31发表:
最简单的方法你在哪个内核上运行,你就去哪个内核上编译代码,这个主要是确保模块里面的函数和运行的内核里面的函数一致 .