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
25 # Check for missing binaries
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
36 # Directory where sysfs is mounted
41 # mount sysfs if it's not yet mounted
42 if [ ! -d $SYSFS_DIR ]; then
43 echo "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
46 grep -q "^sysfs $SYSFS_DIR" /proc
/mounts ||
47 mount
-t sysfs
/sys
/sys ||
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"
56 grep -q "^udev $udev_root" /proc
/mounts ||
57 mount
-t ramfs udev
$udev_root ||
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)
71 # Stop execution of events
72 udevcontrol stop_exec_queue
76 echo "Usage: $0 {start|stop}"