hit007 发表于 2003-4-11 23:26:54

good suggestion,
but i don'tthat's necessary,and the kernel compiling sounds not so difficult
i will compile the kernel
but the os i have installed need to be compiled again?i doubt

Dragonfly 发表于 2003-4-11 23:32:43

anyway u need run make dep.

hit007 发表于 2003-4-14 10:00:52

我试过了,还是不行
究竟怎么回事?

llc 发表于 2003-4-14 14:19:23

莫非见鬼 :twisted:

Dragonfly 发表于 2003-4-14 21:29:35

can u use another vanilla kernel? and post u makefile, pls.

wxp95 发表于 2003-4-14 22:15:40

my problem:hello.o was compiled for kernel version 2.4.20 while this kernel version is 2.4.20-18

Dragonfly 发表于 2003-4-14 22:31:07

can u check the value in include/linux/version.h?

wxp95 发表于 2003-4-14 22:34:21

#define UTS_RELEASE "2.4.20-18"
#define LINUX_VERSION_CODE 132116
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

Dragonfly 发表于 2003-4-14 22:48:28

very strange, usually if u include module.h and point to correct kernel source code, u can get correct version. i know there are some strange when people use redhat hacked kernel. but i never meet them. a suggestion is to use a vanilla kernel. can anybody try a vanilla kernel if u meet version problem?

hit007 发表于 2003-4-16 13:04:19

what is vanilla version?
正版?还是什么意思?

Dragonfly 发表于 2003-4-16 21:46:46

vanilla kernel means the standard kernel released by linus, which can be downloaded from kernel.org. any kernel that has one or more patch can not be a vanilla kernel. like --acx, --ds, --rmk, these are patched by some people for some purpose. they are hacked ones.

hit007 发表于 2003-4-20 12:43:03

但是我用的是redhat8.0的安装盘,难道不行吗?;应该是正版的

Dragonfly 发表于 2003-4-20 22:23:59

can u try following steps?
1) use a vanilla or redhat linux kernel. and recompile it.
2) boot with u new kernel
3) make sure that u module makefile has correct INCLUDE=/usr/src/linux-xxx/include.
4) compile u module and try again.

keenor 发表于 2003-4-22 02:06:00

哈哈,这么久了还没解决吗?我说说我的看法:
(1)说明一点,写linux用户程序所用的头文件和写kernel module用的头文件是不一样的。用户程序一般使用/usr/include目录下的文件,这些文件其实是你的发行版编译glibc时用的和产生的文件(这点做过 linux from scratch的人能猜出来)。就是说你使用的linux的发行商(redhat公司)的发行版本(redhat8)编译glibc时用的内核头文件是kernel 2.4.9的。gcc默认情况下使用/usr/include下的文件,所以你编译出来的东西版本会不对。我这样说可能有点绕。而编译kernel module 用的文件必须与你的内核编译的时候用的是一致的,所以应该是/usr/src/linux-2.4.18-14/include下面的文件
(2)下面说你那个模块怎么编译:你其实可以简单得用下面的命令:
gcc -c -DMODULE -D__KERNEL__ -DLINUX -I/usr/src/linux-2.4.18-14/include helloworld.c
这条命令指定你使用/usr/src/linux-2.4.18-14/include目录下的头文件。cheungming的那个makefile没有问题,问题在于你的系统中并不存在/usr/src/linux/这样一个目录或连接,这样INCLUDEDIR = /usr/src/linux/include这句话其实并没有用。按照习惯,你应该在/usr/src下做个连接指向/usr/src/linux-2.4.18-14/:
cd /usr/src
ln -s linux-2.4.18-14 linux
我相信这样那个makefile可以很完美得工作。
(3)在redhat上用vanilla version 的kernel source编译内核会是一件很痛苦的事情。你会发现很多daemon无法正常启动或终止。建议你要是想真正做几个module那还是用debian或gentoo,或者干脆lfs!
(4)hacked kernel是指redhat公司自做主张得对原本的kernel source做了修改或优化,跟正版盗版可没关系。

Dragonfly 发表于 2003-4-22 02:11:05

thx a lot for u explanation. u make things clear.
but
3) i use vanilla kernel on my rh7.3 and works fine.
5) i can not input chinese. sorry.
页: 1 [2] 3
查看完整版本: 内核模块编译,加载时说版本不对的问题