summaryrefslogtreecommitdiff
path: root/package/udev/S10udev
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2007-05-09 22:48:41 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2007-05-09 22:48:41 +0000
commit6b00c90d709a01822027fb9986ec8ace605dd991 (patch)
tree247dda891d7c16580a7d274411581c519d01c2db /package/udev/S10udev
parent448153a06a443ad61f3df88408edf3a7da98ea0c (diff)
Rename all INIT scripts to have the numerical prefixes to easily see the start-up order.
Diffstat (limited to 'package/udev/S10udev')
-rwxr-xr-xpackage/udev/S10udev81
1 files changed, 81 insertions, 0 deletions
diff --git a/package/udev/S10udev b/package/udev/S10udev
new file mode 100755
index 000000000..220fbcef6
--- /dev/null
+++ b/package/udev/S10udev
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# udev This is a minimal non-LSB version of a UDEV startup script. It
+# was derived by stripping down the udev-058 LSB version for use
+# with buildroot on embedded hardware using Linux 2.6.12+ kernels.
+#
+# You may need to customize this for your system's resource limits
+# (including startup time!) and administration. For example, if
+# your early userspace has a custom initramfs or initrd you might
+# need /dev much earlier; or without hotpluggable busses (like USB,
+# PCMCIA, MMC/SD, and so on) your /dev might be static after boot.
+#
+# This script assumes your system boots right into the eventual root
+# filesystem, and that init runs this udev script before any programs
+# needing more device nodes than the bare-bones set -- /dev/console,
+# /dev/zero, /dev/null -- that's needed to boot and run this script.
+#
+
+# old kernels don't use udev
+case $(uname -r) in
+ 2.6*|2.7*) ;;
+ *) exit 0;;
+esac
+
+# Check for missing binaries
+UDEV_BIN=/sbin/udevd
+test -x $UDEV_BIN || exit 5
+UDEVSTART_BIN=/sbin/udevstart
+test -x $UDEVSTART_BIN || exit 5
+
+# Check for config file and read it
+UDEV_CONFIG=/etc/udev/udev.conf
+test -r $UDEV_CONFIG || exit 6
+. $UDEV_CONFIG
+
+# Directory where sysfs is mounted
+SYSFS_DIR=/sys
+
+case "$1" in
+ start)
+ # mount sysfs if it's not yet mounted
+ if [ ! -d $SYSFS_DIR ]; then
+ echo "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
+ exit 1
+ fi
+ grep -q "^sysfs $SYSFS_DIR" /proc/mounts ||
+ mount -t sysfs /sys /sys ||
+ exit 1
+
+ # mount $udev_root as ramfs if it's not yet mounted
+ # we know 2.6 kernels always support ramfs
+ if [ ! -d $udev_root ]; then
+ echo "${0}: udev_root \"$udev_root\" not found"
+ exit 1
+ fi
+ grep -q "^udev $udev_root" /proc/mounts ||
+ mount -t ramfs udev $udev_root ||
+ exit 1
+
+ mkdir $udev_root/pts $udev_root/shm
+
+ # populate /dev (normally)
+ echo -n "Populating $udev_root using udev: "
+ echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
+ $UDEV_BIN -d || (echo "FAIL" && exit 1)
+ $UDEVSTART_BIN || (echo "FAIL" && exit 1)
+ echo "done"
+ ;;
+ stop)
+ # Stop execution of events
+ udevcontrol stop_exec_queue
+ killall udevd
+ ;;
+ *)
+ echo "Usage: $0 {start|stop}"
+ exit 1
+ ;;
+esac
+
+
+exit 0