tinyramfs/files/mdev.conf
2020-02-24 18:48:44 +03:00

97 lines
3.4 KiB
Plaintext

# Copyright (c) 2012-2019, Piotr Karbowski <piotr.karbowski@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list
# of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
# * Neither the name of the Piotr Karbowski nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE US
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# mdev-like-a-boss
# Syntax:
# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
#
# [-]: do not stop on this match, continue reading mdev.conf
# =: move, >: move and create a symlink
# !: do not create device node
# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
# support module loading on hotplug
$MODALIAS=.* 0:0 660 @modprobe -b "$MODALIAS"
# null may already exist; therefore ownership has to be changed with command
null 0:0 666 @chmod 666 $MDEV
zero 0:0 666
full 0:0 666
random 0:0 444
urandom 0:0 444
hwrandom 0:0 444
grsec 0:0 660
kmem 0:0 640
mem 0:0 640
port 0:0 640
# console may already exist; therefore ownership has to be changed with command
console 0:5 600 @chmod 600 $MDEV
ptmx 0:5 666
pty.* 0:5 660
# typical devices
tty 0:5 666
tty[0-9]* 0:5 660
vcsa*[0-9]* 0:5 660
ttyS[0-9]* 0:14 660
# block devices
ram([0-9]*) 0:9 660 >rd/%1
loop([0-9]+) 0:9 660 >loop/%1
sr[0-9]* 0:16 660 @ln -sf $MDEV cdrom
fd[0-9]* 0:8 660
SUBSYSTEM=block;.* 0:9 660 */lib/mdev/storage-device
# raid controllers
cciss!(.*) 0:9 660 =cciss/%1
ida!(.*) 0:9 660 =ida/%1
rd!(.*) 0:9 660 =rd/%1
# graphics
card[0-9] 0:13 660 =dri/
agpgart 0:0 660 >misc/
psaux 0:0 660 >misc/
rtc 0:0 664 >misc/
# input stuff
SUBSYSTEM=input;.* 0:25 660
# drm etc
dri/.* 0:13 660
# don't create old usbdev* devices.
usbdev[0-9].[0-9]* 0:0 660 !
# stop creating x:x:x:x which looks like /dev/dm-*
[0-9]+\:[0-9]+\:[0-9]+\:[0-9]+ 0:0 660 !
# /dev/cpu support.
microcode 0:0 600 =cpu/
cpu([0-9]+) 0:0 600 =cpu/%1/cpuid
msr([0-9]+) 0:0 600 =cpu/%1/msr