bump version
[buildroot.git] / package / udev / S10udev
blob5b663a00db51f590fb6a807b3139a2a0e593ed62
1 #!/bin/sh
3 # udev This is a minimal non-LSB version of a UDEV startup script. It
4 # was derived by stripping down the udev-058 LSB version for use
5 # with buildroot on embedded hardware using Linux 2.6.12+ kernels.
7 # You may need to customize this for your system's resource limits
8 # (including startup time!) and administration. For example, if
9 # your early userspace has a custom initramfs or initrd you might
10 # need /dev much earlier; or without hotpluggable busses (like USB,
11 # PCMCIA, MMC/SD, and so on) your /dev might be static after boot.
13 # This script assumes your system boots right into the eventual root
14 # filesystem, and that init runs this udev script before any programs
15 # needing more device nodes than the bare-bones set -- /dev/console,
16 # /dev/zero, /dev/null -- that's needed to boot and run this script.
19 # old kernels don't use udev
20 case $(uname -r) in
21 2.6*|2.7*) ;;
22 *) exit 0;;
23 esac
25 # Check for missing binaries
26 UDEV_BIN=/sbin/udevd
27 test -x $UDEV_BIN || exit 5
28 UDEVSTART_BIN=/sbin/udevstart
29 test -x $UDEVSTART_BIN || exit 5
31 # Check for config file and read it
32 UDEV_CONFIG=/etc/udev/udev.conf
33 test -r $UDEV_CONFIG || exit 6
34 . $UDEV_CONFIG
36 # Directory where sysfs is mounted
37 SYSFS_DIR=/sys
39 case "$1" in
40 start)
41 # mount sysfs if it's not yet mounted
42 if [ ! -d $SYSFS_DIR ]; then
43 echo "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
44 exit 1
46 grep -q "^sysfs $SYSFS_DIR" /proc/mounts ||
47 mount -t sysfs /sys /sys ||
48 exit 1
50 # mount $udev_root as ramfs if it's not yet mounted
51 # we know 2.6 kernels always support ramfs
52 if [ ! -d $udev_root ]; then
53 echo "${0}: udev_root \"$udev_root\" not found"
54 exit 1
56 grep -q "^udev $udev_root" /proc/mounts ||
57 mount -t ramfs udev $udev_root ||
58 exit 1
60 mkdir $udev_root/pts $udev_root/shm
62 # populate /dev (normally)
63 echo -n "Populating $udev_root using udev: "
64 echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
65 $UDEV_BIN -d || (echo "FAIL" && exit 1)
66 $UDEVSTART_BIN || (echo "FAIL" && exit 1)
67 mount -t devpts /dev/pts /dev/pts || (echo "FAIL" && exit 1)
68 echo "done"
70 stop)
71 # Stop execution of events
72 udevcontrol stop_exec_queue
73 killall udevd
76 echo "Usage: $0 {start|stop}"
77 exit 1
79 esac
82 exit 0