Linux的版本Linux3.0.8
1、在driver目录下创建一个新的目录:mkdir drivers/test1
2、新建一个源文件:vim drivers/test1/test1.c
void test1() 2 { 3 /*根据自己的需要编写*/ 4 }
3、新建一个Makefile:vim driver/test1/test1.c
1 obj-$(CONFIG_TEST1) += test1.o
4、新建Kconfig文件产生make menuconfig的图形界面:
1 menu "test1 driver here" 2 config TEST1 3 bool "xiaobai test1 driver" 4 help 5 This is test1 6 endmenu
5、修改driver目录下的kconfig使之包含test1目录的kconfig文件
vim drivers/Kconfig 在最后添加
source "drivers/test1/Kconfig"
6、make menuconfig查看是否成功添加
7、make -j4 编译进内核。