由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - 问个kernel module的编译问题
相关主题
ubuntu怎么自动加载网卡?新手上路
[求助] 寻找特定版本的kernel source 来build .ko 文件Makefile question: cannot find the right path for gcc ?
[help] insmod error message: no symbol version for module_layout要用新的kernel是不是必须得restart
android 内核编译kexec有人用过没
有人玩树梅么? Raspery pi想修改buffer cache的内核代码?请问从哪开始
module load problem on androidLinux下如何提取驱动程序,然后复制到另一台电脑?
howto install vboxguestadditions on CentOS.装windows文件的硬盘
how to begin kernel development step by step?Google是当之无愧的Linux最大用户[zz]
相关话题的讨论汇总
话题: kernel话题: source话题: module话题: xenomai话题: linux
进入Linux版参与讨论
1 (共1页)
d*******o
发帖数: 5897
1
刚学内核模块编程不久,照着网上的Linux Kernel Module Programming学的。现在有
个问题,如果我的kernel source code要调用非linux kernel source的函数,应该怎
么做呢?比如我现在的目录结构是:
/usr/src/linux 放的是linux kernel source
/usr/src/xenomai 放的是一个第三方的kernel patch和source,上面的linux kernel
source已经被这个目录下的source patch过,

我自己要写的kernel module放在
/home/pcuser/mymodule下,就一个文件,mymod.c,init函数里调用了/usr/src/
xenomai的kernel space API。

通过加-I -L选项,我能编译mymod.c,得到mymod.ko。但是insmod mymod.ko时,报错
,说有Undefined symbol,就是这个第三方的函数。这个第三方的source code有自己
的Makefile,在它的顶层目录里make是可以make出给用户用的libraries的。可是在我
自己的module source目录里,我怎么能和这个第三方的source联系起来呢?
x****s
发帖数: 921
2
insmod 是安装。你当前运行的kernel是patch的?

kernel

【在 d*******o 的大作中提到】
: 刚学内核模块编程不久,照着网上的Linux Kernel Module Programming学的。现在有
: 个问题,如果我的kernel source code要调用非linux kernel source的函数,应该怎
: 么做呢?比如我现在的目录结构是:
: /usr/src/linux 放的是linux kernel source
: /usr/src/xenomai 放的是一个第三方的kernel patch和source,上面的linux kernel
: source已经被这个目录下的source patch过,
:
: 我自己要写的kernel module放在
: /home/pcuser/mymodule下,就一个文件,mymod.c,init函数里调用了/usr/src/
: xenomai的kernel space API。

d*******o
发帖数: 5897
3
对的,我已经编译了patch过的内核,现在系统运行的就是这个新内核。

【在 x****s 的大作中提到】
: insmod 是安装。你当前运行的kernel是patch的?
:
: kernel

x****s
发帖数: 921
4
then if the kernel not stripped, you can double check your running kernel
indeed has the new method by grep name on the kernnel image
after this, i don,t have too much ideas, try google

【在 d*******o 的大作中提到】
: 对的,我已经编译了patch过的内核,现在系统运行的就是这个新内核。
x****o
发帖数: 21566
5
static library?
If so, make sure they all appear in Makefile
e.g, in Makefile
...
obj-m := foo.o
foo-objs := yourcode.o xenomai.a
...
google "kernel module static library" or something similar maybe
S*A
发帖数: 7142
6
You need to make sure your module is using the
the xenomai kernel as the Kbuild source kernel.
Also you need to make sure the symbol you used in
the xenomai kernel is exported as kernel symbols.
You can try to locate the symbol in /proc/kallsyms.
If it is not in there, then you need to export those symbol
in the kernel first before they can be used in the module.
b*****n
发帖数: 482
7
嗯,看着象是没有export symbol的样子

【在 S*A 的大作中提到】
: You need to make sure your module is using the
: the xenomai kernel as the Kbuild source kernel.
: Also you need to make sure the symbol you used in
: the xenomai kernel is exported as kernel symbols.
: You can try to locate the symbol in /proc/kallsyms.
: If it is not in there, then you need to export those symbol
: in the kernel first before they can be used in the module.

g*****n
发帖数: 44
8
用nm查看一下哪些symbols没有undefined, 然后看看内核export没有。

kernel

【在 d*******o 的大作中提到】
: 刚学内核模块编程不久,照着网上的Linux Kernel Module Programming学的。现在有
: 个问题,如果我的kernel source code要调用非linux kernel source的函数,应该怎
: 么做呢?比如我现在的目录结构是:
: /usr/src/linux 放的是linux kernel source
: /usr/src/xenomai 放的是一个第三方的kernel patch和source,上面的linux kernel
: source已经被这个目录下的source patch过,
:
: 我自己要写的kernel module放在
: /home/pcuser/mymodule下,就一个文件,mymod.c,init函数里调用了/usr/src/
: xenomai的kernel space API。

1 (共1页)
进入Linux版参与讨论
相关主题
Google是当之无愧的Linux最大用户[zz]有人玩树梅么? Raspery pi
现在怎么流行一个kernel就是一个新的distro版本?module load problem on android
Catalyst driver 用不了了howto install vboxguestadditions on CentOS.
请教一个libc.so.0的问题how to begin kernel development step by step?
ubuntu怎么自动加载网卡?新手上路
[求助] 寻找特定版本的kernel source 来build .ko 文件Makefile question: cannot find the right path for gcc ?
[help] insmod error message: no symbol version for module_layout要用新的kernel是不是必须得restart
android 内核编译kexec有人用过没
相关话题的讨论汇总
话题: kernel话题: source话题: module话题: xenomai话题: linux