阅读:1857回复:9
将一个驱动程序编入内核之后,应该怎么样启动它呢?
希望各位指教!
|
|
|
沙发#
发布于:2003-06-18 17:28
不需要你手动,在核心启动的时候就自动启动了!
|
|
板凳#
发布于:2003-06-20 16:33
前提条件是你的Driver是可以正常工作的,如果你的系统中有这个设备,你的Driver就可以probe到,然后注册到系统中,如果没有这个设备,你的Driver就不会工作。
|
|
|
地板#
发布于:2003-06-20 16:40
如果这个驱动是象linux device driver一书中的snull那样的虚拟的设备驱动程序,不与任何硬件设备相关,那怎么probe呢?
驱动程序我测试过了,如果编译成module的形式,用insmod启动是没有问题的。 |
|
|
地下室#
发布于:2003-06-21 11:21
驱动程序在不使用的时候,不一定启动,只有使用的时候会启动。
|
|
5楼#
发布于:2003-06-24 22:11
可以在某个C文件(我记不清了)中加入你的初始化函数(**_init( ))即可。可以看一下linux源码下drivers/char下的例子,看它们的(**_init() )放在那里调用的。仿造调用即可。
|
|
6楼#
发布于:2003-06-26 09:43
You just need add the following codes in you driver:
#include <linux/module.h> module_init (your_modinit); module_exit (your_modexit); And your driver module will be initialized in start_kernel: #ifdef CONFIG_MODULES init_modules(); #endif |
|
7楼#
发布于:2003-06-26 11:48
这段话加到什么地方,是我自己的驱动程序里面吗? |
|
|
8楼#
发布于:2003-06-26 13:56
Add the following codes in your driver codes.
\"#include <linux/module.h> static int __init your_modinit(void) static void __exit your_modexit(void) module_init (your_modinit); module_exit (your_modexit);\" And check the following codes in Start_kernel( ) in init/main.c file: \"#ifdef CONFIG_MODULES init_modules(); #endif\" |
|
9楼#
发布于:2003-07-23 03:24
Levis75说得很对,呵呵
|
|