首先是hello.c 文件:

11.把helloworld字符驱动模块编译进内核

Hello.c:

11.把helloworld字符驱动模块编译进内核

接着是修改driver/char/Kconfig:

11.把helloworld字符驱动模块编译进内核

添加:

11.把helloworld字符驱动模块编译进内核

 

修改字符设备驱动里的Makefile:

11.把helloworld字符驱动模块编译进内核

打开Makefile:

obj-$(CONFIG_HELLO_WORLD) += hello.o

11.把helloworld字符驱动模块编译进内核

 

 

 

进入配置界面:

11.把helloworld字符驱动模块编译进内核

11.把helloworld字符驱动模块编译进内核

选择Device driver:进入:

11.把helloworld字符驱动模块编译进内核

11.把helloworld字符驱动模块编译进内核

选择Character devices:

11.把helloworld字符驱动模块编译进内核

进入:

11.把helloworld字符驱动模块编译进内核

找到我们的helloworld,并选中:

11.把helloworld字符驱动模块编译进内核

一直保存退出:

编译:

11.把helloworld字符驱动模块编译进内核

编译完成:

11.把helloworld字符驱动模块编译进内核

11.把helloworld字符驱动模块编译进内核

11.把helloworld字符驱动模块编译进内核

Tftp烧写:

11.把helloworld字符驱动模块编译进内核

启动看到我们驱动代码打印出来的:

11.把helloworld字符驱动模块编译进内核

说明我们的内核模块成功加入内核了。启动成功。

相关文章: