主要以自己写的leds-s5pv210.c为例:
具体步骤:
1、将leds-s5pv210.c加入到driver/leds中,但是直接放进去并不会进行编译。
2、在driver/leds中的Makefile中添加相应的依赖:
obj-$(CONFIG_LEDS_S5PV210) += leds-s5pv210.o
3、在Kconfig中添加配置项:
if NEW_LEDS
config LEDS_S5PV210
tristate "LED Class for S5PV210"
help
This option is S5PV 210
tristate表示三态,表示可以y,m,n三种情况加载这个驱动
原本应该有depends on但是我们这个例子没有依赖所以就去掉
help是帮助信息
4、make menuconfig 进入到Devices driver/LED support/就会看到LED Class for S5PV210() 配置成Y就可以
5、重新编译,再把zImage放入到tftpboot中去,启动开发板在、sys/class/leds/下面就可以看到我们配置的驱动
如果出现:
是因为在make menuconfig中Devices driver/LED support未打开 LED Class Support 这个选项。