- 论坛徽章:
- 0
|
[root@local doc]# cat /var/log/messages
..........
Aug 6 16:51:04 local kernel: d: version magic '2.6.23.1-42.fc8 SMP mod_unload 686 4KSTACKS ' should be '2.6.25.11-60.fc8 SMP mod_unload 686 4KSTACKS '
[root@local doc]# uname -r
2.6.25.11-60.fc8 |
编写下面的代码总是显示insmod: error inserting './d.ko': -1 Invalid module format
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_ALERT */
#include <linux/init.h> /* Needed for the macros */
MODULES_LICENSE("GPL");
static int hello3_data __initdata = 3;
static int __init hello_3_init(void)
{
printk(KERN_ALERT "Hello, world %d\n", hello3_data);
return 0;
}
static void __exit hello_3_exit(void)
{
printk(KERN_ALERT "Goodbye, world 3\n");
}
module_init(hello_3_init);
module_exit(hello_3_exit); |
|
|