4 # Required-Start: mountkernfs
8 # Short-Description: Start udevd, populate /dev and load drivers.
11 # This script is based on Debian's.
14 COLDPLUG_TARBALL="/lib/udev/devices.tar.gz"
16 for x in $(cat /proc/cmdline); do
24 # we need to unmount /dev/pts/ and remount it later over the tmpfs
26 if mountpoint -q /dev/pts/; then
27 umount -n -l /dev/pts/
30 if mountpoint -q /dev/shm/; then
31 umount -n -l /dev/shm/
35 # mount a tmpfs over /dev, if somebody did not already do it
37 if grep -q "/dev tmpfs" /proc/mounts; then
41 if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs udev /dev; then
42 echo "udev requires tmpfs support, not started."
49 create_dev_makedev() {
50 if [ -e /sbin/MAKEDEV ]; then
51 ln -sf /sbin/MAKEDEV /dev/MAKEDEV
53 ln -sf /bin/true /dev/MAKEDEV
59 if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then
60 cp -a /lib/udev/devices/* /$1/
64 [ -e /etc/udev/links.conf ] || return $ret
66 grep '^[^#]' /etc/udev/links.conf | \
67 while read type name arg1; do
68 [ "$type" -a "$name" -a ! -e "/$1/$name" -a ! -L "/$1/$name" ] || continue
70 L) ln -s $arg1 /$1/$name ;;
71 D) mkdir -p /$1/$name ;;
72 M) mknod -m 600 /$1/$name $arg1 ;;
73 *) echo "links.conf: unparseable line ($type $name $arg1)" >&2 ;;
80 ##############################################################################
82 [ -x /sbin/udevd ] || exit 0
90 if [ -e /etc/udev/udev.conf ]; then
94 ##############################################################################
96 # When modifying this script, do not forget that between the time that the
97 # new /dev has been mounted and udevadm trigger has been run there will be
98 # no /dev/null. This also means that you cannot use the "&" shell command.
102 if [ -e "$udev_root/.udev/" ]; then
103 if mountpoint -q $udev_root/; then
106 echo ".udev/ already exists on the static $udev_root!"
110 echo > /sys/kernel/uevent_helper
112 if [ -z "$TMPFS_MOUNTED" ]; then
116 # and clean up the database of the initramfs udev
120 # /dev/null must be created before udevd is started
121 if ! make_extra_nodes "$udev_root"; then
124 if [ ! -f "$COLDPLUG_TARBALL" ]; then
128 # if this directory is not present /dev will not be updated by udev
129 mkdir -p /dev/.udev/db/
131 echo "Startting the hotplug events dispatcher"
134 mkdir -p /dev/.udev/queue/ /dev/.udev/rules.d/
138 if [ $COLDPLUG != "no" ]; then
139 echo "Synthesizing the initial hotplug events"
142 # wait for the udevd childs to finish
143 echo "Waiting for /dev to be fully populated"
144 if udevadm settle; then
154 echo "Stopping the hotplug events dispatcher"
155 start-stop-daemon --stop --name udevd --quiet --oknodo
159 echo "Stopping the hotplug events dispatcher"
160 start-stop-daemon --stop --name udevd --quiet --oknodo
162 echo "Startting the hotplug events dispatcher"
167 udevadm control --reload_rules
171 echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}"