有关驱动程序的编写规,请参考课程教材,本实验只在编写简单的驱动(核)程序并加入
到 Linux 核目录树中,使用户熟悉编译核的过程。该驱动程序是向终端输出相关程序信息。
编写好 helloworld.c 后将其拷贝到核源码树的 drivers/char/目录下。
(2)、进入实验核源码目录修改 driver/char/目录下的 Kconfig 文件,按照 Kconfig 语法添加
helloworld 程序的菜单支持
[rootlocalhost linux-2.6.35.7]# vi drivers/char/Kconfig
例如:在 Kconfig 文件中的 source“driver/char/hw_random/Kconfig”下面添加如下:
source“driver/char/hw_random/Kconfig”
config HELLO_MODULE
bool "Hello World Test"
depends on CPU_S5PV210
help
This is a demo to test kernel experiment On UP-Magic210.
(3)、进入实验核源码目录修改 driver/char/目录下的 Makefile 文件,按照核中 Makefile
语法添加 helloworld 程序的编译支持
[rootlocalhost linux-2.6.35.7]# vi drivers/char/Makefile
在 Makefile 中(大约在 91 行)添加如下一行
obj-$(CONFIG_TOSHIBA) += toshiba.o
obj-$(CONFIG_I8K) += i8k.o