diff options
Diffstat (limited to 'meta/recipes-core/udev/eudev')
-rw-r--r-- | meta/recipes-core/udev/eudev/devfs-udev.rules | 108 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/init | 142 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/links.conf | 21 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/local.rules | 19 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/permissions.rules | 131 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/run.rules | 14 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/udev-cache | 75 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/udev-cache.default | 5 | ||||
-rw-r--r-- | meta/recipes-core/udev/eudev/udev.rules | 116 |
9 files changed, 631 insertions, 0 deletions
diff --git a/meta/recipes-core/udev/eudev/devfs-udev.rules b/meta/recipes-core/udev/eudev/devfs-udev.rules new file mode 100644 index 0000000000..0ba1ad4e7f --- /dev/null +++ b/meta/recipes-core/udev/eudev/devfs-udev.rules | |||
@@ -0,0 +1,108 @@ | |||
1 | # The use of these rules is not recommended or supported. | ||
2 | # In a world where devices can come and go at any time, the devfs scheme | ||
3 | # of simple device enumeration does not help _anything_. Just forget about | ||
4 | # it. Use custom rules to name your device or look at the persistent device | ||
5 | # naming scheme, which is implemented for disks and add your subsystem. | ||
6 | |||
7 | # ide block devices | ||
8 | BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" | ||
9 | |||
10 | # md block devices | ||
11 | KERNEL="md[0-9]*", NAME="md/%n" | ||
12 | |||
13 | # floppy devices | ||
14 | KERNEL="fd[0-9]*", NAME="floppy/%n" | ||
15 | |||
16 | # tty devices | ||
17 | KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" | ||
18 | KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" | ||
19 | KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" | ||
20 | |||
21 | # vc devices | ||
22 | KERNEL="vcs", NAME="vcc/0" | ||
23 | KERNEL="vcs[0-9]*", NAME="vcc/%n" | ||
24 | KERNEL="vcsa", NAME="vcc/a0" | ||
25 | KERNEL="vcsa[0-9]*", NAME="vcc/a%n" | ||
26 | |||
27 | # v4l devices | ||
28 | KERNEL="video[0-9]*", NAME="v4l/video%n" | ||
29 | KERNEL="radio[0-9]*", NAME="v4l/radio%n" | ||
30 | KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" | ||
31 | KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" | ||
32 | |||
33 | # dm devices (ignore them) | ||
34 | KERNEL="dm-[0-9]*", NAME="" | ||
35 | |||
36 | # i2c devices | ||
37 | KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" | ||
38 | |||
39 | # loop devices | ||
40 | KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" | ||
41 | |||
42 | # ramdisks | ||
43 | KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" | ||
44 | |||
45 | # framebuffer devices | ||
46 | KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" | ||
47 | |||
48 | # misc | ||
49 | KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" | ||
50 | KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" | ||
51 | KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" | ||
52 | KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" | ||
53 | KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" | ||
54 | KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" | ||
55 | |||
56 | # alsa devices | ||
57 | KERNEL="controlC[0-9]*", NAME="snd/%k" | ||
58 | KERNEL="hw[CD0-9]*", NAME="snd/%k" | ||
59 | KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" | ||
60 | KERNEL="midi[CD0-9]*", NAME="snd/%k" | ||
61 | KERNEL="timer", NAME="snd/%k" | ||
62 | KERNEL="seq", NAME="snd/%k" | ||
63 | |||
64 | # oss devices | ||
65 | KERNEL="audio*", NAME="sound/%k", SYMLINK="%k" | ||
66 | KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k" | ||
67 | KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k" | ||
68 | KERNEL="midi*", NAME="sound/%k", SYMLINK="%k" | ||
69 | KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k" | ||
70 | KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k" | ||
71 | |||
72 | # input devices | ||
73 | KERNEL="mice", NAME="input/%k" | ||
74 | KERNEL="mouse*", NAME="input/%k" | ||
75 | KERNEL="event*", NAME="input/%k" | ||
76 | KERNEL="js*", NAME="input/%k" | ||
77 | KERNEL="ts*", NAME="input/%k" | ||
78 | |||
79 | # USB devices | ||
80 | KERNEL="hiddev*", NAME="usb/%k" | ||
81 | KERNEL="auer*", NAME="usb/%k" | ||
82 | KERNEL="legousbtower*", NAME="usb/%k" | ||
83 | KERNEL="dabusb*", NAME="usb/%k" | ||
84 | BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" | ||
85 | |||
86 | # netlink devices | ||
87 | KERNEL="route", NAME="netlink/%k" | ||
88 | KERNEL="skip", NAME="netlink/%k" | ||
89 | KERNEL="usersock", NAME="netlink/%k" | ||
90 | KERNEL="fwmonitor", NAME="netlink/%k" | ||
91 | KERNEL="tcpdiag", NAME="netlink/%k" | ||
92 | KERNEL="nflog", NAME="netlink/%k" | ||
93 | KERNEL="xfrm", NAME="netlink/%k" | ||
94 | KERNEL="arpd", NAME="netlink/%k" | ||
95 | KERNEL="route6", NAME="netlink/%k" | ||
96 | KERNEL="ip6_fw", NAME="netlink/%k" | ||
97 | KERNEL="dnrtmsg", NAME="netlink/%k" | ||
98 | KERNEL="tap*", NAME="netlink/%k" | ||
99 | |||
100 | # CAPI devices | ||
101 | KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" | ||
102 | KERNEL="capi*", NAME="capi/%n" | ||
103 | |||
104 | # Network devices | ||
105 | KERNEL="tun", NAME="net/%k" | ||
106 | |||
107 | # raw devices | ||
108 | KERNEL="raw[0-9]*", NAME="raw/%k" | ||
diff --git a/meta/recipes-core/udev/eudev/init b/meta/recipes-core/udev/eudev/init new file mode 100644 index 0000000000..0ab028b391 --- /dev/null +++ b/meta/recipes-core/udev/eudev/init | |||
@@ -0,0 +1,142 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: udev | ||
5 | # Required-Start: mountvirtfs | ||
6 | # Required-Stop: | ||
7 | # Default-Start: S | ||
8 | # Default-Stop: | ||
9 | # Short-Description: Start udevd, populate /dev and load drivers. | ||
10 | ### END INIT INFO | ||
11 | |||
12 | export TZ=/etc/localtime | ||
13 | |||
14 | [ -d /sys/class ] || exit 1 | ||
15 | [ -r /proc/mounts ] || exit 1 | ||
16 | [ -x @UDEVD@ ] || exit 1 | ||
17 | SYSCONF_CACHED="/etc/udev/cache.data" | ||
18 | SYSCONF_TMP="/dev/shm/udev.cache" | ||
19 | DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen | ||
20 | |||
21 | # A list of files which are used as a criteria to judge whether the udev cache could be reused. | ||
22 | CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices" | ||
23 | [ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags" | ||
24 | |||
25 | # List of files whose metadata (size/mtime/name) will be included in cached | ||
26 | # system state. | ||
27 | META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*" | ||
28 | |||
29 | # Command to compute system configuration. | ||
30 | sysconf_cmd () { | ||
31 | cat -- $CMP_FILE_LIST | ||
32 | stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}' | ||
33 | } | ||
34 | |||
35 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache | ||
36 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf | ||
37 | [ -f /etc/default/rcS ] && . /etc/default/rcS | ||
38 | |||
39 | kill_udevd () { | ||
40 | pid=`pidof -x udevd` | ||
41 | [ -n "$pid" ] && kill $pid | ||
42 | } | ||
43 | |||
44 | case "$1" in | ||
45 | start) | ||
46 | export ACTION=add | ||
47 | # propagate /dev from /sys | ||
48 | echo "Starting udev" | ||
49 | |||
50 | # Check for requireed devtmpfs before trying to start udev and | ||
51 | # mount a no-existant fs. | ||
52 | if ! grep -q devtmpfs /proc/filesystems | ||
53 | then | ||
54 | echo "Missing devtmpfs, which is required for udev to run"; | ||
55 | echo "Halting..." | ||
56 | halt | ||
57 | fi | ||
58 | # mount the devtmpfs on /dev, if not already done | ||
59 | LANG=C awk '$2 == "/dev" && ($3 == "devtmpfs") { exit 1 }' /proc/mounts && { | ||
60 | mount -n -o mode=0755 -t devtmpfs none "/dev" | ||
61 | } | ||
62 | [ -e /dev/pts ] || mkdir -m 0755 /dev/pts | ||
63 | [ -e /dev/shm ] || mkdir -m 1777 /dev/shm | ||
64 | # the automount rule for udev needs /tmp directory available, as /tmp is a symlink | ||
65 | # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure | ||
66 | # /var/volatile/tmp directory to be available. | ||
67 | mkdir -m 1777 -p /var/volatile/tmp | ||
68 | |||
69 | # Cache handling. | ||
70 | if [ "$DEVCACHE" != "" ]; then | ||
71 | if [ -e $DEVCACHE ]; then | ||
72 | sysconf_cmd > "$SYSCONF_TMP" | ||
73 | if cmp $SYSCONF_CACHED $SYSCONF_TMP >/dev/null; then | ||
74 | tar xmf $DEVCACHE -C / -m | ||
75 | not_first_boot=1 | ||
76 | [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE" | ||
77 | [ -e $SYSCONF_TMP ] && rm -f "$SYSCONF_TMP" | ||
78 | [ -e "$DEVCACHE_REGEN" ] && rm -f "$DEVCACHE_REGEN" | ||
79 | else | ||
80 | # Output detailed reason why the cached /dev is not used | ||
81 | cat <<EOF | ||
82 | udev: Not using udev cache because of changes detected in the following files: | ||
83 | udev: $CMP_FILE_LIST | ||
84 | udev: $META_FILE_LIST | ||
85 | udev: The udev cache will be regenerated. To identify the detected changes, | ||
86 | udev: compare the cached sysconf at $SYSCONF_CACHED | ||
87 | udev: against the current sysconf at $SYSCONF_TMP | ||
88 | EOF | ||
89 | touch "$DEVCACHE_REGEN" | ||
90 | fi | ||
91 | else | ||
92 | if [ "$ROOTFS_READ_ONLY" != "yes" ]; then | ||
93 | # If rootfs is not read-only, it's possible that a new udev cache would be generated; | ||
94 | # otherwise, we do not bother to read files. | ||
95 | touch "$DEVCACHE_REGEN" | ||
96 | fi | ||
97 | fi | ||
98 | fi | ||
99 | |||
100 | # make_extra_nodes | ||
101 | kill_udevd > "/dev/null" 2>&1 | ||
102 | |||
103 | # trigger the sorted events | ||
104 | [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug | ||
105 | @UDEVD@ -d | ||
106 | |||
107 | udevadm control --env=STARTUP=1 | ||
108 | if [ "$not_first_boot" != "" ];then | ||
109 | if [ "$PROBE_PLATFORM_BUS" != "yes" ]; then | ||
110 | PLATFORM_BUS_NOMATCH="--subsystem-nomatch=platform" | ||
111 | else | ||
112 | PLATFORM_BUS_NOMATCH="" | ||
113 | fi | ||
114 | udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux $PLATFORM_BUS_NOMATCH | ||
115 | (udevadm settle --timeout=3; udevadm control --env=STARTUP=)& | ||
116 | else | ||
117 | udevadm trigger --action=add | ||
118 | udevadm settle | ||
119 | fi | ||
120 | ;; | ||
121 | stop) | ||
122 | echo "Stopping udevd" | ||
123 | start-stop-daemon --stop --name udevd --quiet | ||
124 | ;; | ||
125 | restart) | ||
126 | $0 stop | ||
127 | sleep 1 | ||
128 | $0 start | ||
129 | ;; | ||
130 | status) | ||
131 | pid=`pidof -x udevd` | ||
132 | if [ -n "$pid" ]; then | ||
133 | echo "udevd (pid $pid) is running ..." | ||
134 | else | ||
135 | echo "udevd is stopped" | ||
136 | fi | ||
137 | ;; | ||
138 | *) | ||
139 | echo "Usage: $0 {start|stop|status|restart}" | ||
140 | exit 1 | ||
141 | esac | ||
142 | exit 0 | ||
diff --git a/meta/recipes-core/udev/eudev/links.conf b/meta/recipes-core/udev/eudev/links.conf new file mode 100644 index 0000000000..8fff922db6 --- /dev/null +++ b/meta/recipes-core/udev/eudev/links.conf | |||
@@ -0,0 +1,21 @@ | |||
1 | # This file does not exist. Please do not ask the debian maintainer about it. | ||
2 | # You may use it to do strange and wonderful things, at your risk. | ||
3 | |||
4 | L fd /proc/self/fd | ||
5 | L stdin /proc/self/fd/0 | ||
6 | L stdout /proc/self/fd/1 | ||
7 | L stderr /proc/self/fd/2 | ||
8 | L core /proc/kcore | ||
9 | L sndstat /proc/asound/oss/sndstat | ||
10 | L MAKEDEV /sbin/MAKEDEV | ||
11 | |||
12 | D pts | ||
13 | D shm | ||
14 | |||
15 | # Hic sunt leones. | ||
16 | M ppp c 108 0 | ||
17 | D loop | ||
18 | M loop/0 b 7 0 | ||
19 | D net | ||
20 | M net/tun c 10 200 | ||
21 | |||
diff --git a/meta/recipes-core/udev/eudev/local.rules b/meta/recipes-core/udev/eudev/local.rules new file mode 100644 index 0000000000..d502cdd6ba --- /dev/null +++ b/meta/recipes-core/udev/eudev/local.rules | |||
@@ -0,0 +1,19 @@ | |||
1 | # There are a number of modifiers that are allowed to be used in some | ||
2 | # of the different fields. They provide the following subsitutions: | ||
3 | # | ||
4 | # %n the "kernel number" of the device. | ||
5 | # For example, 'sda3' has a "kernel number" of '3' | ||
6 | # %e the smallest number for that name which does not matches an existing node | ||
7 | # %k the kernel name for the device | ||
8 | # %M the kernel major number for the device | ||
9 | # %m the kernel minor number for the device | ||
10 | # %b the bus id for the device | ||
11 | # %c the string returned by the PROGRAM | ||
12 | # %s{filename} the content of a sysfs attribute | ||
13 | # %% the '%' char itself | ||
14 | # | ||
15 | |||
16 | # Create a symlink to any touchscreen input device | ||
17 | # Trigger based on input type, that the evbit (-e) has EV_SYN and EV_ABS, | ||
18 | # has an EV_ABS value (-a) which is used for touchscreen type devices. | ||
19 | SUBSYSTEM=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", SYMLINK+="input/touchscreen0" | ||
diff --git a/meta/recipes-core/udev/eudev/permissions.rules b/meta/recipes-core/udev/eudev/permissions.rules new file mode 100644 index 0000000000..205b733292 --- /dev/null +++ b/meta/recipes-core/udev/eudev/permissions.rules | |||
@@ -0,0 +1,131 @@ | |||
1 | ACTION!="add", GOTO="permissions_end" | ||
2 | |||
3 | # workarounds needed to synchronize with sysfs | ||
4 | # only needed for kernels < v2.6.18-rc1 | ||
5 | ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" | ||
6 | SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" | ||
7 | # only needed for kernels < 2.6.16 | ||
8 | SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" | ||
9 | # only needed for kernels < 2.6.17 | ||
10 | SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" | ||
11 | |||
12 | # devices needed to load the drivers providing them | ||
13 | KERNEL=="tun", OPTIONS+="ignore_remove" | ||
14 | KERNEL=="ppp", OPTIONS+="ignore_remove" | ||
15 | KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" | ||
16 | |||
17 | # default permissions for block devices | ||
18 | SUBSYSTEM=="block", GROUP="disk" | ||
19 | # the aacraid driver is broken and reports that disks removable (see #404927) | ||
20 | SUBSYSTEM=="block", ATTRS{removable}=="1", \ | ||
21 | DRIVERS!="aacraid", GROUP="floppy" | ||
22 | # all block devices on these buses are "removable" | ||
23 | SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" | ||
24 | |||
25 | # IDE devices | ||
26 | KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ | ||
27 | IMPORT{program}="cdrom_id --export $tempnode" | ||
28 | ENV{ID_CDROM}=="?*", GROUP="cdrom" | ||
29 | KERNEL=="ht[0-9]*", GROUP="tape" | ||
30 | KERNEL=="nht[0-9]*", GROUP="tape" | ||
31 | |||
32 | # SCSI devices | ||
33 | KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" | ||
34 | SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" | ||
35 | SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" | ||
36 | SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" | ||
37 | SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" | ||
38 | SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" | ||
39 | SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" | ||
40 | SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" | ||
41 | SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" | ||
42 | |||
43 | # USB devices | ||
44 | KERNEL=="legousbtower*", MODE="0666" | ||
45 | KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" | ||
46 | |||
47 | # usbfs-like devices | ||
48 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ | ||
49 | MODE="0664" | ||
50 | |||
51 | # iRiver music players | ||
52 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ | ||
53 | ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" | ||
54 | |||
55 | # serial devices | ||
56 | SUBSYSTEM=="tty", GROUP="dialout" | ||
57 | SUBSYSTEM=="capi", GROUP="dialout" | ||
58 | SUBSYSTEM=="slamr", GROUP="dialout" | ||
59 | SUBSYSTEM=="zaptel", GROUP="dialout" | ||
60 | |||
61 | # vc devices (all members of the tty subsystem) | ||
62 | KERNEL=="ptmx", MODE="0666", GROUP="root" | ||
63 | KERNEL=="console", MODE="0600", GROUP="root" | ||
64 | KERNEL=="tty", MODE="0666", GROUP="root" | ||
65 | KERNEL=="tty[0-9]*", GROUP="root" | ||
66 | KERNEL=="pty*", MODE="0666", GROUP="tty" | ||
67 | |||
68 | # video devices | ||
69 | SUBSYSTEM=="video4linux", GROUP="video" | ||
70 | SUBSYSTEM=="drm", GROUP="video" | ||
71 | SUBSYSTEM=="dvb", GROUP="video" | ||
72 | SUBSYSTEM=="em8300", GROUP="video" | ||
73 | SUBSYSTEM=="graphics", GROUP="video" | ||
74 | SUBSYSTEM=="nvidia", GROUP="video" | ||
75 | |||
76 | # misc devices | ||
77 | KERNEL=="random", MODE="0666" | ||
78 | KERNEL=="urandom", MODE="0666" | ||
79 | KERNEL=="mem", MODE="0640", GROUP="kmem" | ||
80 | KERNEL=="kmem", MODE="0640", GROUP="kmem" | ||
81 | KERNEL=="port", MODE="0640", GROUP="kmem" | ||
82 | KERNEL=="full", MODE="0666" | ||
83 | KERNEL=="null", MODE="0666" | ||
84 | KERNEL=="zero", MODE="0666" | ||
85 | KERNEL=="inotify", MODE="0666" | ||
86 | KERNEL=="sgi_fetchop", MODE="0666" | ||
87 | KERNEL=="sonypi", MODE="0666" | ||
88 | KERNEL=="agpgart", GROUP="video" | ||
89 | KERNEL=="nvram", GROUP="nvram" | ||
90 | KERNEL=="rtc|rtc[0-9]*", GROUP="audio" | ||
91 | KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" | ||
92 | KERNEL=="fuse", GROUP="fuse" | ||
93 | KERNEL=="kqemu", MODE="0666" | ||
94 | KERNEL=="kvm", GROUP="kvm" | ||
95 | KERNEL=="tun", MODE="0666", | ||
96 | |||
97 | KERNEL=="cdemu[0-9]*", GROUP="cdrom" | ||
98 | KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" | ||
99 | KERNEL=="pktcdvd", MODE="0644" | ||
100 | |||
101 | KERNEL=="uverbs*", GROUP="rdma" | ||
102 | KERNEL=="ucm*", GROUP="rdma" | ||
103 | KERNEL=="rdma_ucm", GROUP="rdma" | ||
104 | |||
105 | # printers and parallel devices | ||
106 | SUBSYSTEM=="printer", GROUP="lp" | ||
107 | SUBSYSTEM=="ppdev", GROUP="lp" | ||
108 | KERNEL=="irlpt*", GROUP="lp" | ||
109 | KERNEL=="pt[0-9]*", GROUP="tape" | ||
110 | KERNEL=="pht[0-9]*", GROUP="tape" | ||
111 | |||
112 | # sound devices | ||
113 | SUBSYSTEM=="sound", GROUP="audio" | ||
114 | |||
115 | # ieee1394 devices | ||
116 | KERNEL=="raw1394", GROUP="disk" | ||
117 | KERNEL=="dv1394*", GROUP="video" | ||
118 | KERNEL=="video1394*", GROUP="video" | ||
119 | |||
120 | # input devices | ||
121 | KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ | ||
122 | MODE="0664", GROUP="video" | ||
123 | KERNEL=="js[0-9]*", MODE="0664" | ||
124 | KERNEL=="lirc[0-9]*", GROUP="video" | ||
125 | |||
126 | # AOE character devices | ||
127 | SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" | ||
128 | SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" | ||
129 | |||
130 | LABEL="permissions_end" | ||
131 | |||
diff --git a/meta/recipes-core/udev/eudev/run.rules b/meta/recipes-core/udev/eudev/run.rules new file mode 100644 index 0000000000..75d71375bb --- /dev/null +++ b/meta/recipes-core/udev/eudev/run.rules | |||
@@ -0,0 +1,14 @@ | |||
1 | # debugging monitor | ||
2 | RUN+="socket:/org/kernel/udev/monitor" | ||
3 | |||
4 | # run a command on remove events | ||
5 | ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" | ||
6 | |||
7 | # ignore the events generated by virtual consoles | ||
8 | KERNEL=="ptmx", OPTIONS+="last_rule" | ||
9 | KERNEL=="console", OPTIONS+="last_rule" | ||
10 | KERNEL=="tty" , OPTIONS+="last_rule" | ||
11 | KERNEL=="tty[0-9]*", OPTIONS+="last_rule" | ||
12 | KERNEL=="pty*", OPTIONS+="last_rule" | ||
13 | SUBSYSTEM=="vc", OPTIONS+="last_rule" | ||
14 | |||
diff --git a/meta/recipes-core/udev/eudev/udev-cache b/meta/recipes-core/udev/eudev/udev-cache new file mode 100644 index 0000000000..dcfff1cb45 --- /dev/null +++ b/meta/recipes-core/udev/eudev/udev-cache | |||
@@ -0,0 +1,75 @@ | |||
1 | #!/bin/sh -e | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: udev-cache | ||
5 | # Required-Start: mountall | ||
6 | # Required-Stop: | ||
7 | # Default-Start: S | ||
8 | # Default-Stop: | ||
9 | # Short-Description: cache /dev to speedup the udev next boot | ||
10 | ### END INIT INFO | ||
11 | |||
12 | export TZ=/etc/localtime | ||
13 | |||
14 | [ -r /proc/mounts ] || exit 1 | ||
15 | [ -x @UDEVD@ ] || exit 1 | ||
16 | [ -d /sys/class ] || exit 1 | ||
17 | |||
18 | [ -f /etc/default/rcS ] && . /etc/default/rcS | ||
19 | DEVCACHE_TMP="/dev/shm/udev-cache-tmp.tar" | ||
20 | SYSCONF_CACHED="/etc/udev/cache.data" | ||
21 | SYSCONF_TMP="/dev/shm/udev.cache" | ||
22 | DEVCACHE_REGEN="/dev/shm/udev-regen" # create to request cache regen | ||
23 | |||
24 | # A list of files which are used as a criteria to judge whether the udev cache could be reused. | ||
25 | CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices" | ||
26 | [ -f /proc/atags ] && CMP_FILE_LIST="$CMP_FILE_LIST /proc/atags" | ||
27 | |||
28 | # List of files whose metadata (size/mtime/name) will be included in cached | ||
29 | # system state. | ||
30 | META_FILE_LIST="lib/udev/rules.d/* etc/udev/rules.d/*" | ||
31 | |||
32 | # Command to compute system configuration. | ||
33 | sysconf_cmd () { | ||
34 | cat -- $CMP_FILE_LIST | ||
35 | stat -c '%s %Y %n' -- $META_FILE_LIST | awk -F/ '{print $1 " " $NF;}' | ||
36 | } | ||
37 | |||
38 | [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache | ||
39 | |||
40 | if [ "$ROOTFS_READ_ONLY" = "yes" ]; then | ||
41 | [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache" | ||
42 | exit 0 | ||
43 | fi | ||
44 | |||
45 | [ "$DEVCACHE" != "" ] || exit 0 | ||
46 | [ "${VERBOSE}" == "no" ] || echo -n "udev-cache: checking for ${DEVCACHE_REGEN}... " | ||
47 | if ! [ -e "$DEVCACHE_REGEN" ]; then | ||
48 | [ "${VERBOSE}" == "no" ] || echo "not found." | ||
49 | exit 0 | ||
50 | fi | ||
51 | [ "${VERBOSE}" == "no" ] || echo "found." | ||
52 | echo "Populating dev cache" | ||
53 | |||
54 | err_cleanup () { | ||
55 | echo "udev-cache: update failed!" | ||
56 | udevadm control --start-exec-queue | ||
57 | rm -f -- "$SYSCONF_TMP" "$DEVCACHE_TMP" "$DEVCACHE" "$SYSCONF_CACHED" | ||
58 | } | ||
59 | |||
60 | ( | ||
61 | set -e | ||
62 | trap 'err_cleanup' EXIT | ||
63 | udevadm control --stop-exec-queue | ||
64 | sysconf_cmd > "$SYSCONF_TMP" | ||
65 | find /dev -xdev \( -type b -o -type c -o -type l \) | cut -c 2- \ | ||
66 | | xargs tar cf "${DEVCACHE_TMP}" | ||
67 | gzip < "${DEVCACHE_TMP}" > "$DEVCACHE" | ||
68 | rm -f "${DEVCACHE_TMP}" | ||
69 | mv "$SYSCONF_TMP" "$SYSCONF_CACHED" | ||
70 | udevadm control --start-exec-queue | ||
71 | rm -f "$DEVCACHE_REGEN" | ||
72 | trap - EXIT | ||
73 | ) & | ||
74 | |||
75 | exit 0 | ||
diff --git a/meta/recipes-core/udev/eudev/udev-cache.default b/meta/recipes-core/udev/eudev/udev-cache.default new file mode 100644 index 0000000000..a3b732698d --- /dev/null +++ b/meta/recipes-core/udev/eudev/udev-cache.default | |||
@@ -0,0 +1,5 @@ | |||
1 | # Default for /etc/init.d/udev | ||
2 | |||
3 | # Comment this out to disable device cache | ||
4 | DEVCACHE="/etc/udev-cache.tar.gz" | ||
5 | PROBE_PLATFORM_BUS="yes" | ||
diff --git a/meta/recipes-core/udev/eudev/udev.rules b/meta/recipes-core/udev/eudev/udev.rules new file mode 100644 index 0000000000..a19d4a0bf6 --- /dev/null +++ b/meta/recipes-core/udev/eudev/udev.rules | |||
@@ -0,0 +1,116 @@ | |||
1 | # There are a number of modifiers that are allowed to be used in some | ||
2 | # of the different fields. They provide the following subsitutions: | ||
3 | # | ||
4 | # %n the "kernel number" of the device. | ||
5 | # For example, 'sda3' has a "kernel number" of '3' | ||
6 | # %e the smallest number for that name which does not matches an existing node | ||
7 | # %k the kernel name for the device | ||
8 | # %M the kernel major number for the device | ||
9 | # %m the kernel minor number for the device | ||
10 | # %b the bus id for the device | ||
11 | # %c the string returned by the PROGRAM | ||
12 | # %s{filename} the content of a sysfs attribute | ||
13 | # %% the '%' char itself | ||
14 | # | ||
15 | |||
16 | # workaround for devices which do not report media changes | ||
17 | SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ | ||
18 | ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" | ||
19 | SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ | ||
20 | OPTIONS+="all_partitions" | ||
21 | |||
22 | # SCSI devices | ||
23 | SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" | ||
24 | |||
25 | # USB devices | ||
26 | SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" | ||
27 | SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" | ||
28 | SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" | ||
29 | SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" | ||
30 | SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" | ||
31 | SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" | ||
32 | SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ | ||
33 | ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ | ||
34 | SYMLINK+="pilot" | ||
35 | |||
36 | # usbfs-like devices | ||
37 | SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ | ||
38 | NAME="%c" | ||
39 | SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" | ||
40 | |||
41 | # serial devices | ||
42 | KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" | ||
43 | KERNEL=="capi[0-9]*", NAME="capi/%n" | ||
44 | |||
45 | # video devices | ||
46 | KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ | ||
47 | NAME="%c" | ||
48 | KERNEL=="card[0-9]*", NAME="dri/%k" | ||
49 | |||
50 | # misc devices | ||
51 | KERNEL=="hw_random", NAME="hwrng" | ||
52 | KERNEL=="tun", NAME="net/%k" | ||
53 | KERNEL=="evtchn", NAME="xen/%k" | ||
54 | |||
55 | KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" | ||
56 | KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" | ||
57 | KERNEL=="pktcdvd", NAME="pktcdvd/control" | ||
58 | |||
59 | KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" | ||
60 | KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" | ||
61 | KERNEL=="microcode", NAME="cpu/microcode" | ||
62 | |||
63 | KERNEL=="umad*", NAME="infiniband/%k" | ||
64 | KERNEL=="issm*", NAME="infiniband/%k" | ||
65 | KERNEL=="uverbs*", NAME="infiniband/%k" | ||
66 | KERNEL=="ucm*", NAME="infiniband/%k" | ||
67 | KERNEL=="rdma_ucm", NAME="infiniband/%k" | ||
68 | |||
69 | # ALSA devices | ||
70 | KERNEL=="controlC[0-9]*", NAME="snd/%k" | ||
71 | KERNEL=="hwC[D0-9]*", NAME="snd/%k" | ||
72 | KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" | ||
73 | KERNEL=="midiC[D0-9]*", NAME="snd/%k" | ||
74 | KERNEL=="timer", NAME="snd/%k" | ||
75 | KERNEL=="seq", NAME="snd/%k" | ||
76 | |||
77 | # ieee1394 devices | ||
78 | KERNEL=="dv1394*", NAME="dv1394/%n" | ||
79 | KERNEL=="video1394*", NAME="video1394/%n" | ||
80 | |||
81 | # input devices | ||
82 | KERNEL=="mice", NAME="input/%k" | ||
83 | KERNEL=="mouse[0-9]*", NAME="input/%k" | ||
84 | KERNEL=="event[0-9]*", NAME="input/%k" | ||
85 | KERNEL=="js[0-9]*", NAME="input/%k" | ||
86 | KERNEL=="ts[0-9]*", NAME="input/%k" | ||
87 | KERNEL=="uinput", NAME="input/%k" | ||
88 | |||
89 | # Zaptel | ||
90 | KERNEL=="zapctl", NAME="zap/ctl" | ||
91 | KERNEL=="zaptimer", NAME="zap/timer" | ||
92 | KERNEL=="zapchannel", NAME="zap/channel" | ||
93 | KERNEL=="zappseudo", NAME="zap/pseudo" | ||
94 | KERNEL=="zap[0-9]*", NAME="zap/%n" | ||
95 | |||
96 | # AOE character devices | ||
97 | SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" | ||
98 | SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" | ||
99 | SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" | ||
100 | SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" | ||
101 | |||
102 | # device mapper creates its own device nodes, so ignore these | ||
103 | KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" | ||
104 | KERNEL=="device-mapper", NAME="mapper/control" | ||
105 | |||
106 | KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" | ||
107 | |||
108 | # Firmware Helper | ||
109 | ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh" | ||
110 | |||
111 | # Samsung UARTS | ||
112 | KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" | ||
113 | |||
114 | # MXC UARTs | ||
115 | KERNEL=="ttymxc[0-4]", NAME="ttymxc%n" | ||
116 | |||