diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-17 21:41:22 +0100 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2011-03-17 21:41:22 +0100 |
commit | c58cc7d3796dcee6e93885c835ed04cb566abeb2 (patch) | |
tree | 3eea4d4ef6a4ef79e0f4e025d7012c1a5cc38835 /meta-oe/recipes-core/udev/udev-165/init | |
parent | eec6ab97f712e06eb52c9f7c99e19ffab3ce9d74 (diff) | |
download | meta-openembedded-c58cc7d3796dcee6e93885c835ed04cb566abeb2.tar.gz |
move layer into meta-oe in preparation for future splits
As per TSC decision
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-core/udev/udev-165/init')
-rw-r--r-- | meta-oe/recipes-core/udev/udev-165/init | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/udev/udev-165/init b/meta-oe/recipes-core/udev/udev-165/init new file mode 100644 index 000000000..7ec32afd0 --- /dev/null +++ b/meta-oe/recipes-core/udev/udev-165/init | |||
@@ -0,0 +1,73 @@ | |||
1 | #!/bin/sh -e | ||
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 /sbin/udevd ] || exit 1 | ||
17 | [ -f /etc/default/udev ] && . /etc/default/udev | ||
18 | [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf | ||
19 | |||
20 | kill_udevd() { | ||
21 | if [ -x /sbin/pidof ]; then | ||
22 | pid=`/sbin/pidof -x udevd` | ||
23 | [ -n "$pid" ] && kill $pid | ||
24 | fi | ||
25 | } | ||
26 | |||
27 | export ACTION=add | ||
28 | # propagate /dev from /sys | ||
29 | echo "Starting udev" | ||
30 | |||
31 | # mount the tmpfs on /dev, if not already done | ||
32 | LANG=C awk "\$2 == \"/dev\" && \$3 == \"tmpfs\" { exit 1 }" /proc/mounts && { | ||
33 | mount -n -o mode=0755 -t tmpfs none "/dev" | ||
34 | mkdir -m 0755 /dev/pts | ||
35 | mkdir -m 1777 /dev/shm | ||
36 | } | ||
37 | |||
38 | if [ "$DEVCACHE" != "" ]; then | ||
39 | # Invalidate udev cache if the kernel or its bootargs/cmdline have changed | ||
40 | [ -x /bin/uname ] && /bin/uname -mrspv > /tmp/uname || touch /tmp/uname | ||
41 | [ -r /proc/cmdline ] && cat /proc/cmdline > /tmp/cmdline || touch /tmp/cmdline | ||
42 | [ -r /proc/atags ] && cat /proc/atags > /tmp/atags || touch /tmp/atags | ||
43 | if [ -e $DEVCACHE ] && \ | ||
44 | cmp -s /tmp/uname /etc/udev/saved.uname && \ | ||
45 | cmp -s /tmp/cmdline /etc/udev/saved.cmdline && \ | ||
46 | cmp -s /tmp/atags /etc/udev/saved.atags; then | ||
47 | (cd /; tar xf $DEVCACHE > /dev/null 2>&1) | ||
48 | not_first_boot=1 | ||
49 | fi | ||
50 | fi | ||
51 | |||
52 | if [ ! -e "/lib/modules/$(uname -r)"/modules.dep ] ; then | ||
53 | mkdir -p /lib/modules/$(uname -r) | ||
54 | depmod -ae | ||
55 | fi | ||
56 | |||
57 | # make_extra_nodes | ||
58 | kill_udevd > "/dev/null" 2>&1 | ||
59 | |||
60 | # trigger the sorted events | ||
61 | echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug | ||
62 | /sbin/udevd -d | ||
63 | |||
64 | /sbin/udevadm control --env STARTUP=1 | ||
65 | if [ "$not_first_boot" != "" ];then | ||
66 | /sbin/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 --subsystem-nomatch=platform | ||
67 | (/sbin/udevadm settle --timeout=8; /sbin/udevadm control --env STARTUP=)& | ||
68 | else | ||
69 | /sbin/udevadm trigger | ||
70 | /sbin/udevadm settle | ||
71 | fi | ||
72 | |||
73 | exit 0 | ||