archim
驱动牛犊
驱动牛犊
  • 注册日期2001-08-18
  • 最后登录2006-03-17
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望1点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
阅读:1213回复:3

关于运行kernel module的问题!!

楼主#
更多 发布于:2003-04-17 12:19
下面一段话摘自Linux Device Driver:

The source file shown earlier can be loaded and unloaded as shown only if the
running kernel has module version support disabled; however, most distributions
preinstall versioned kernels (versioning is discussed in “Version Control in Mod-
ules” in Chapter 11). Although older modutils allowed loading nonversioned mod-
ules to versioned kernels, this is no longer possible. To solve the problem with
hello.c, the source in the misc-modules directory of the sample code includes a
few more lines to be able to run both under versioned and nonversioned kernels.
However, we strongly suggest you compile and run your own kernel (without ver-
sion support) before you run the sample code.

但是我搜遍了所有的目录都没有找到叫\"misc-module\"的目录,自然就看不到里面的例子了。
那么哪位大侠可以贴出一些让kernel module可以同时在versioned and nonversioned kernels下运行的代码呢?
谢谢啦!!
archim
hometown
驱动大牛
驱动大牛
  • 注册日期2002-10-24
  • 最后登录2004-05-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-04-17 19:23
你的问题是:
你不应该搜索LINUX SOURCE CODE目录, 因为那里面的确没有 :)
你应该搜索的地方是你的书配套的光盘什么的(我猜想的话)。2。4的内核我没有分析过, 从你那段引用来看, 应该是高于2。2的内核的。 至于版本的问题, 应该不难解决, 你只要看看LINUX SOURCE CODE下两中不同的版本中DRIVER的写法就可以了。 另外这段引用里说的很清楚, 你重新编译内核, 让其不要版本支持就可以了。 编译内核很简单, 而且网上有很多建议。  ;)
How fair and how pleasant art thou, O love, for delights!This thy stature is like to a palm tree, and thy breasts to clusters of grapes.I said, I will go up to the palm tree, I will take hold of the boughs thereof: now also thy breasts shall be as clusters of the vine, and the smell of thy nose like apples;And the roof of thy mouth like the best wine for my beloved, that goeth down sweetly, causing the lips of those that are asleep to speak.
archim
驱动牛犊
驱动牛犊
  • 注册日期2001-08-18
  • 最后登录2006-03-17
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望1点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-04-18 10:37
LINUXSOURCECODE下面的确有很多源码,但是我怎么区分一个文件对应的是versioned kernek还是nonversioned kernel呢?

还有,我今天又重新编译了那个程序,编译参数用的是
-D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O -Wall -g
-c

然后用insmod加载,居然成功了,想不明白是怎么回事!

希望hometown老大多多赐教.
archim
hometown
驱动大牛
驱动大牛
  • 注册日期2002-10-24
  • 最后登录2004-05-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-04-22 19:23
这个偶一时说不清, 不过可以给个建议:
你在-O选项中最好用-O8,(8不是必须的,只要大于3就可以了, 8听说是个吉利数字 :))
How fair and how pleasant art thou, O love, for delights!This thy stature is like to a palm tree, and thy breasts to clusters of grapes.I said, I will go up to the palm tree, I will take hold of the boughs thereof: now also thy breasts shall be as clusters of the vine, and the smell of thy nose like apples;And the roof of thy mouth like the best wine for my beloved, that goeth down sweetly, causing the lips of those that are asleep to speak.
游客

返回顶部