日志文章

2007年08月15日 18:19:25

将自己的模块编入2.6内核的方法

举个例子:
你自己编写了个网卡驱动,源文件为realtek123.c ,你可以将这个文件拷贝到/usr/src/linux-2.6.11/drivers/net 目录中,并打开/usr/src/linux-2.6.11/drivers/net/Kconfig文件,里面有如下的内容:
config NETDEVICES
depends on NET
bool "Net work device support"
-------help----------
You can sya N here if you don't intend to connect your Linux box to any other conputer at all.
....................................

其中depends on是指只有选择了NET,才可以选择该模块,你可以增加一段文本,如下(两行#之间的部分)
###########################################
config REALTEK123
depends on NET
bool "realtek123's driver"
-------help----------
You can sya N here if you don't intend to connect your Linux box to any other conputer at all.
....................................
##############################################

然后在/usr/src/linux-2.6.11/drivers/net/Makefile中加入一行
obj-$(CONFIG_REALTEK123) += realtek123.o

重新编译内核便能看到make menuconfig 步骤中的Device Drivers------>Networking support 中有对应的选项了.

Tags: 内核   模块  

类别: 技术文章 |  评论(0) |  浏览(2841) |  收藏
发表评论
看不清楚,换一张