免费注册 查看新帖 |

Chinaunix

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

内核编程的内核版本问题。。。 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-01-14 16:38 |只看该作者 |倒序浏览
读了davidxueer Linux内核编程(前言)zt  
照猫画虎的写了程序和Makefile
#include <linux/kernel.h>;
#include <linux/module.h>;

#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>;
#endif

int init_module()
{
        printk("Hello, world -- This is the KERNEL speaking ... \n";
        return 0;
}

void cleanup_module()
{
        printk("Short is the life of a kernel module\n";
}

Makefile
CC=gcc
MODCFLAGS := -Wall -DMODULE -D__KERNEL__ -DLINUX

hello.o: hello.c /usr/include/linux/version.h
$(CC) $(MODCFLAGS) -c hello.c
echo insmod hello.o to turn it on
echo rmmod hello to turn if off
echo
echo X and kernel programming do not mix.
echo Do the insmod and rmmod from outside

make 后

intmod hello.o

系统给出如下错误:
hello.o: kernel-module version mismatch
        hello.o was compiled for kernel version 2.4.9-9
        while this kernel is version 2.4.18-3.
我的系统
Linux version 2.4.18-3  (gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110))

what should i do?

论坛徽章:
0
2 [报告]
发表于 2005-01-14 19:50 |只看该作者

内核编程的内核版本问题。。。

强行insmod, 如果你要搞内核编程最好自己编译一个内核。

论坛徽章:
0
3 [报告]
发表于 2005-01-17 02:33 |只看该作者

内核编程的内核版本问题。。。

具体怎么解决这个问题啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP