使用mdev在/dev/下创建子目录放置设备节点
使用mdev在/dev/下创建子目录放置设备节点
最近在嵌入式Linux板子上调试USB声卡,使用mdev创建设备节点时默认直接在 /dev/目录下创建, 如- controlC0 pcmC0D0c seq sequencer2
- mixer pcmC0D0p sequencer timer
在busybox源代码的 doc/mdev.txt 文档里面找到以下说明:
- You can rename/move device nodes by using the next optional field.
- <device regex> <uid>:<gid> <permissions> [=path]
- So if you want to place the device node into a subdirectory, make sure the path
- has a trailing /. If you want to rename the device node, just place the name.
- hda 0:3 660 =drives/
- This will move "hda" into the drives/ subdirectory.
- hdb 0:3 660 =cdrom
- This will rename "hdb" to "cdrom".
-
- Similarly, ">path" renames/moves the device but it also creates
- a direct symlink /dev/DEVNAME to the renamed/moved device.
- controlC[0-9] 0:0 0660 =snd/
- pcm.* 0:0 0660 =snd/
- seq.* 0:0 0660 =snd/
- mix.* 0:0 0660 =snd/
- timer 0:0 0660 =snd/
后记: 内核里面 struct class 里面的 devnode 项跟设备节点所在目录好像也有关系, 有空再研究一下。
评论暂时关闭