我正在构建一个使用 hrtimer 接口的内核模块。我已成功编译模块,并且已MODULE_LICENSE("GPL")
设置:
make -C /lib/modules/3.0.0-23-server/build SUBDIRS=/home/projects/net-modeler modules
make[1]: Entering directory `/usr/src/linux-headers-3.0.0-23-server'
CC [M] /home/projects/net-modeler/nm_injector.o
CC [M] /home/projects/net-modeler/nm_scheduler.o
LD [M] /home/projects/net-modeler/net-modeler.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/projects/net-modeler/net-modeler.mod.o
LD [M] /home/projects/net-modeler/net-modeler.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.0.0-23-server'
...但是当我尝试insmod
它时, dmesg 输出
[111853.094925] Unknown symbol hrtimer_init (err 0)
[111853.094931] Unknown symbol hrtimer_start (err 0)
[111853.094942] Unknown symbol hrtimer_cancel (err 0)
这些函数在 内外部<linux/hrtimer.h>
,并在 kernel/hrtimer.c 中导出,如下所示:
/**
* hrtimer_init - initialize a timer to the given clock
* @timer: the timer to be initialized
* @clock_id: the clock to be used
* @mode: timer mode abs/rel
*/
void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
enum hrtimer_mode mode)
{
debug_init(timer, clock_id, mode);
__hrtimer_init(timer, clock_id, mode);
}
EXPORT_SYMBOL_GPL(hrtimer_init);
cat /proc/kallsyms | grep <func>
这三个函数的结果是:
0000000000000000 T hrtimer_init
0000000000000000 T hrtimer_cancel
0000000000000000 T hrtimer_start
谁能帮我弄清楚发生了什么?在我看来,所有功能都已导出,应该可以找到它们,但由于某种原因,它们不是。我在做傻事吗?