我正在构建一个使用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,mode);
}
EXPORT_SYMBOL_GPL(hrtimer_init);
cat / proc / kallsyms | grep< func>对于这三个函数导致:
0000000000000000 T hrtimer_init
0000000000000000 T hrtimer_cancel
0000000000000000 T hrtimer_start
任何人都可以帮我弄清楚发生了什么事吗?在我看来,所有的功能都是导出的,应该可以找到它们,但由于某些原因它们不是.我做了些蠢事吗?
最佳答案