summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-core/eudev/files/init66
-rw-r--r--recipes-core/eudev/files/udev-cache32
2 files changed, 11 insertions, 87 deletions
diff --git a/recipes-core/eudev/files/init b/recipes-core/eudev/files/init
index ee64f86..daa4079 100644
--- a/recipes-core/eudev/files/init
+++ b/recipes-core/eudev/files/init
@@ -3,7 +3,7 @@
3### BEGIN INIT INFO 3### BEGIN INIT INFO
4# Provides: udev 4# Provides: udev
5# Required-Start: mountvirtfs 5# Required-Start: mountvirtfs
6# Required-Stop: 6# Required-Stop:
7# Default-Start: S 7# Default-Start: S
8# Default-Stop: 8# Default-Stop:
9# Short-Description: Start udevd, populate /dev and load drivers. 9# Short-Description: Start udevd, populate /dev and load drivers.
@@ -14,23 +14,10 @@ export TZ=/etc/localtime
14[ -d /sys/class ] || exit 1 14[ -d /sys/class ] || exit 1
15[ -r /proc/mounts ] || exit 1 15[ -r /proc/mounts ] || exit 1
16[ -x @UDEVD@ ] || exit 1 16[ -x @UDEVD@ ] || exit 1
17if [ "$use_udev_cache" != "" ]; then 17
18 [ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
19fi
20[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf 18[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
21[ -f /etc/default/rcS ] && . /etc/default/rcS 19[ -f /etc/default/rcS ] && . /etc/default/rcS
22 20
23readfiles () {
24 READDATA=""
25 for filename in $@; do
26 if [ -r $filename ]; then
27 while read line; do
28 READDATA="$READDATA$line"
29 done < $filename
30 fi
31 done
32}
33
34kill_udevd () { 21kill_udevd () {
35 pid=`pidof -x udevd` 22 pid=`pidof -x udevd`
36 [ -n "$pid" ] && kill $pid 23 [ -n "$pid" ] && kill $pid
@@ -59,58 +46,27 @@ case "$1" in
59 # the automount rule for udev needs /tmp directory available, as /tmp is a symlink 46 # the automount rule for udev needs /tmp directory available, as /tmp is a symlink
60 # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure 47 # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure
61 # /var/volatile/tmp directory to be available. 48 # /var/volatile/tmp directory to be available.
62 mkdir -p /var/volatile/tmp 49 mkdir -m 1777 -p /var/volatile/tmp
63 50
64 # restorecon /run early to allow mdadm creating dir /run/mdadm 51 # restorecon /run early to allow mdadm creating dir /run/mdadm
65 test ! -x /sbin/restorecon || /sbin/restorecon -F /run 52 test ! -x /sbin/restorecon || /sbin/restorecon -F /run
66 53
67 # Cache handling.
68 # A list of files which are used as a criteria to judge whether the udev cache could be reused.
69 CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
70 if [ "$use_udev_cache" != "" ]; then
71 if [ "$DEVCACHE" != "" ]; then
72 if [ -e $DEVCACHE ]; then
73 readfiles $CMP_FILE_LIST
74 NEWDATA="$READDATA"
75 readfiles /etc/udev/cache.data
76 OLDDATA="$READDATA"
77 if [ "$OLDDATA" = "$NEWDATA" ]; then
78 tar --directory=/ -xf $DEVCACHE > /dev/null 2>&1
79 not_first_boot=1
80 [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
81 [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
82 else
83 # Output detailed reason why the cached /dev is not used
84 if [ "$VERBOSE" != "no" ]; then
85 echo "udev: udev cache not used"
86 echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
87 echo "udev: olddata: $OLDDATA"
88 echo "udev: newdata: $NEWDATA"
89 fi
90 echo "$NEWDATA" > /dev/shm/udev.cache
91 fi
92 else
93 if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
94 # If rootfs is not read-only, it's possible that a new udev cache would be generated;
95 # otherwise, we do not bother to read files.
96 readfiles $CMP_FILE_LIST
97 echo "$READDATA" > /dev/shm/udev.cache
98 fi
99 fi
100 fi
101 fi
102
103 # make_extra_nodes 54 # make_extra_nodes
104 kill_udevd > "/dev/null" 2>&1 55 kill_udevd > "/dev/null" 2>&1
105 56
106 # trigger the sorted events 57 # trigger the sorted events
107 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug 58 [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
108 @UDEVD@ -d 59 @UDEVD@ -d
109 60
110 udevadm control --env=STARTUP=1 61 udevadm control --env=STARTUP=1
111 if [ "$not_first_boot" != "" ];then 62 if [ "$not_first_boot" != "" ];then
112 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 63 if [ "$PROBE_PLATFORM_BUS" != "yes" ]; then
113 (udevadm settle --timeout=10; udevadm control --env=STARTUP=)& 64 PLATFORM_BUS_NOMATCH="--subsystem-nomatch=platform"
65 else
66 PLATFORM_BUS_NOMATCH=""
67 fi
68 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
69 (udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
114 else 70 else
115 udevadm trigger --action=add 71 udevadm trigger --action=add
116 udevadm settle 72 udevadm settle
diff --git a/recipes-core/eudev/files/udev-cache b/recipes-core/eudev/files/udev-cache
deleted file mode 100644
index 6898577..0000000
--- a/recipes-core/eudev/files/udev-cache
+++ /dev/null
@@ -1,32 +0,0 @@
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
12export 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[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
20
21if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
22 [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
23 exit 0
24fi
25
26if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
27 echo "Populating dev cache"
28 tar --directory=/ --selinux --xattrs -cf "$DEVCACHE" dev
29 mv /dev/shm/udev.cache /etc/udev/cache.data
30fi
31
32exit 0