xref: /OK3568_Linux_fs/buildroot/package/eudev/S10udev (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
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.34+ kernels.
6#
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.
12#
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.
17#
18
19# Check for config file and read it
20UDEV_CONFIG=/etc/udev/udev.conf
21test -r $UDEV_CONFIG || exit 6
22. $UDEV_CONFIG
23
24case "$1" in
25    start)
26        printf "Populating %s using udev: " "${udev_root:-/dev}"
27        [ -e /proc/sys/kernel/hotplug ] && printf '\000\000\000\000' > /proc/sys/kernel/hotplug
28        /sbin/udevd -d || { echo "FAIL"; exit 1; }
29        udevadm trigger --type=subsystems --action=add
30        udevadm trigger --type=devices --action=add
31        udevadm settle --timeout=30 || echo "udevadm settle failed"
32        echo "done"
33        ;;
34    stop)
35        # Stop execution of events
36        udevadm control --stop-exec-queue
37        killall udevd
38        ;;
39    *)
40        echo "Usage: $0 {start|stop}"
41        exit 1
42        ;;
43esac
44
45
46exit 0
47