移植环境(红色粗字体字为修改后内容,蓝色粗体字为特别注意内容)
1,开发板:韦东山JZ2440。
2,linux 版本:linux-3.4.2
3,参考文献:http://blog.csdn.net/yi412/article/details/20846291
最近打算使用文件操作的方式控制gpio,发现没有/sys/class/gpio/... (sysfs interface)这个选项,无奈,查了很多资料,还是没有这个选项,于是根据参考文献,进入/linux3.4.2/drivers/gpio/ 查看Kconfig发现如下的描述:
config GPIO_SYSFS bool "/sys/class/gpio/... (sysfs interface)"
depends on SYSFS && EXPERIMENTAL
help
Say Y here to add a sysfs interface for GPIOs.
This is mostly useful to work around omissions in a system's
kernel support. Those are common in custom and semicustom
hardware assembled using standard kernels with a minimum of
custom patches. In those cases, userspace code may import
a given GPIO from the kernel, if no kernel driver requested it.
Kernel drivers may also request that a particular GPIO be
exported to userspace; this can be useful when debugging.
怀疑是不是依赖的配置没有打开,即EXPERIMENTAL项目没有打开,于是make menuconfig进入配置界面,键盘输入"/"搜索配置项目输入"EXPERIMENTAL",发现配置项目如下:
于是把Prompt for ...选项打开即可看到/sys/class/gpio/... (sysfs interface)选项。