summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorJesse Zhang <sen.zhang@windriver.com>2013-01-26 17:16:26 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-08 14:50:38 +0000
commita38e4d91cf435d73997ddcb9cc41e934d3cef9a6 (patch)
tree66256430ec754140e718d2464fae3993ccce733e /meta/recipes-core/udev
parent2e913bc62abd9a5a1373bc9f0fbce68c0838cbdf (diff)
downloadpoky-a38e4d91cf435d73997ddcb9cc41e934d3cef9a6.tar.gz
udev: Add start/stop/status/restart support to init script
[ CQID: WIND00388860 ] Add the ability to use "stop", "start", "restart" and "status" with the udev initscript. (From OE-Core rev: bc6193824ec3eb1f3c590a93ccb79c8588b74412) Signed-off-by: Jesse Zhang <sen.zhang@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/udev/init113
-rw-r--r--meta/recipes-core/udev/udev_182.bb2
2 files changed, 65 insertions, 50 deletions
diff --git a/meta/recipes-core/udev/udev/init b/meta/recipes-core/udev/udev/init
index 1934d11e49..8ac1ff7b9c 100644
--- a/meta/recipes-core/udev/udev/init
+++ b/meta/recipes-core/udev/udev/init
@@ -9,6 +9,8 @@
9# Short-Description: Start udevd, populate /dev and load drivers. 9# Short-Description: Start udevd, populate /dev and load drivers.
10### END INIT INFO 10### END INIT INFO
11 11
12. /etc/init.d/functions
13
12export TZ=/etc/localtime 14export TZ=/etc/localtime
13 15
14[ -d /sys/class ] || exit 1 16[ -d /sys/class ] || exit 1
@@ -27,60 +29,73 @@ readfile () {
27 fi 29 fi
28} 30}
29 31
30kill_udevd() { 32case "$1" in
31 pid=`pidof -x udevd` 33 start)
32 [ -n "$pid" ] && kill $pid 34 export ACTION=add
33} 35 # propagate /dev from /sys
34 36 echo "Starting udev"
35export ACTION=add
36# propagate /dev from /sys
37echo "Starting udev"
38
39# mount the tmpfs on /dev, if not already done
40LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /proc/mounts && {
41 mount -n -o mode=0755 -t tmpfs none "/dev"
42}
43[ -e /dev/pts ] || mkdir -m 0755 /dev/pts
44[ -e /dev/shm ] || mkdir -m 1777 /dev/shm
45mount -a -t tmpfs 2>/dev/null
46mkdir -p /var/volatile/run
47 37
48# cache handling 38 # mount the tmpfs on /dev, if not already done
49if [ "$DEVCACHE" != "" ]; then 39 LANG=C awk '$2 == "/dev" && ($3 == "tmpfs" || $3 == "devtmpfs") { exit 1 }' /proc/mounts && {
50 readfile /proc/version 40 mount -n -o mode=0755 -t tmpfs none "/dev"
51 VERSION="$READDATA" 41 }
52 readfile /proc/cmdline 42 [ -e /dev/pts ] || mkdir -m 0755 /dev/pts
53 CMDLINE="$READDATA" 43 [ -e /dev/shm ] || mkdir -m 1777 /dev/shm
54 readfile /proc/devices 44 mount -a -t tmpfs 2>/dev/null
55 DEVICES="$READDATA" 45 mkdir -p /var/volatile/run
56 readfile /proc/atags
57 ATAGS="$READDATA"
58 46
59 if [ -e $DEVCACHE ]; then 47 # cache handling
60 readfile /etc/udev/cache.data 48 if [ "$DEVCACHE" != "" ]; then
61 if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then 49 readfile /proc/version
62 (cd /; tar xf $DEVCACHE > /dev/null 2>&1) 50 VERSION="$READDATA"
63 not_first_boot=1 51 readfile /proc/cmdline
64 fi 52 CMDLINE="$READDATA"
53 readfile /proc/devices
54 DEVICES="$READDATA"
55 readfile /proc/atags
56 ATAGS="$READDATA"
65 57
66 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache 58 if [ -e $DEVCACHE ]; then
67 fi 59 readfile /etc/udev/cache.data
68fi 60 if [ "$READDATA" = "$VERSION$CMDLINE$DEVICES$ATAGS" ]; then
61 (cd /; tar xf $DEVCACHE > /dev/null 2>&1)
62 not_first_boot=1
63 fi
69 64
70# make_extra_nodes 65 echo "$VERSION$CMDLINE$DEVICES$ATAGS" > /dev/shm/udev.cache
71kill_udevd > "/dev/null" 2>&1 66 fi
67 fi
72 68
73# trigger the sorted events 69 # make_extra_nodes
74echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug 70 killproc udevd > "/dev/null" 2>&1
75/lib/udev/udevd -d
76 71
77/usr/bin/udevadm control --env=STARTUP=1 72 # trigger the sorted events
78if [ "$not_first_boot" != "" ];then 73 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
79 /usr/bin/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 74 /lib/udev/udevd -d
80 (/usr/bin/udevadm settle --timeout=3; /usr/bin/udevadm control --env=STARTUP=)&
81else
82 /usr/bin/udevadm trigger --action=add
83 /usr/bin/udevadm settle
84fi
85 75
76 /usr/sbin/udevadm control --env=STARTUP=1
77 if [ "$not_first_boot" != "" ];then
78 /usr/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
79 (/usr/sbin/udevadm settle --timeout=3; /sbin/udevadm control --env=STARTUP=)&
80 else
81 /usr/sbin/udevadm trigger --action=add
82 /usr/sbin/udevadm settle
83 fi
84 ;;
85 stop)
86 echo "Stopping udevd"
87 start-stop-daemon --stop --name udevd --quiet
88 ;;
89 restart)
90 $0 stop
91 sleep 1
92 $0 start
93 ;;
94 status)
95 status udevd
96 ;;
97 *)
98 echo "Usage: $0 {start|stop|status|restart}"
99 exit 1
100esac
86exit 0 101exit 0
diff --git a/meta/recipes-core/udev/udev_182.bb b/meta/recipes-core/udev/udev_182.bb
index cf0f126b92..56d412eb40 100644
--- a/meta/recipes-core/udev/udev_182.bb
+++ b/meta/recipes-core/udev/udev_182.bb
@@ -1,6 +1,6 @@
1include udev.inc 1include udev.inc
2 2
3PR = "r4" 3PR = "r5"
4 4
5# module-init-tools from kmod_git will provide libkmod runtime 5# module-init-tools from kmod_git will provide libkmod runtime
6DEPENDS += "module-init-tools" 6DEPENDS += "module-init-tools"