1*4882a593Smuzhiyun#!/bin/sh 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# udev This is a minimal non-LSB version of a UDEV startup script. It 4*4882a593Smuzhiyun# was derived by stripping down the udev-058 LSB version for use 5*4882a593Smuzhiyun# with buildroot on embedded hardware using Linux 2.6.34+ kernels. 6*4882a593Smuzhiyun# 7*4882a593Smuzhiyun# You may need to customize this for your system's resource limits 8*4882a593Smuzhiyun# (including startup time!) and administration. For example, if 9*4882a593Smuzhiyun# your early userspace has a custom initramfs or initrd you might 10*4882a593Smuzhiyun# need /dev much earlier; or without hotpluggable busses (like USB, 11*4882a593Smuzhiyun# PCMCIA, MMC/SD, and so on) your /dev might be static after boot. 12*4882a593Smuzhiyun# 13*4882a593Smuzhiyun# This script assumes your system boots right into the eventual root 14*4882a593Smuzhiyun# filesystem, and that init runs this udev script before any programs 15*4882a593Smuzhiyun# needing more device nodes than the bare-bones set -- /dev/console, 16*4882a593Smuzhiyun# /dev/zero, /dev/null -- that's needed to boot and run this script. 17*4882a593Smuzhiyun# 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun# Check for config file and read it 20*4882a593SmuzhiyunUDEV_CONFIG=/etc/udev/udev.conf 21*4882a593Smuzhiyuntest -r $UDEV_CONFIG || exit 6 22*4882a593Smuzhiyun. $UDEV_CONFIG 23*4882a593Smuzhiyun 24*4882a593Smuzhiyuncase "$1" in 25*4882a593Smuzhiyun start) 26*4882a593Smuzhiyun printf "Populating %s using udev: " "${udev_root:-/dev}" 27*4882a593Smuzhiyun [ -e /proc/sys/kernel/hotplug ] && printf '\000\000\000\000' > /proc/sys/kernel/hotplug 28*4882a593Smuzhiyun /sbin/udevd -d || { echo "FAIL"; exit 1; } 29*4882a593Smuzhiyun udevadm trigger --type=subsystems --action=add 30*4882a593Smuzhiyun udevadm trigger --type=devices --action=add 31*4882a593Smuzhiyun udevadm settle --timeout=30 || echo "udevadm settle failed" 32*4882a593Smuzhiyun echo "done" 33*4882a593Smuzhiyun ;; 34*4882a593Smuzhiyun stop) 35*4882a593Smuzhiyun # Stop execution of events 36*4882a593Smuzhiyun udevadm control --stop-exec-queue 37*4882a593Smuzhiyun killall udevd 38*4882a593Smuzhiyun ;; 39*4882a593Smuzhiyun *) 40*4882a593Smuzhiyun echo "Usage: $0 {start|stop}" 41*4882a593Smuzhiyun exit 1 42*4882a593Smuzhiyun ;; 43*4882a593Smuzhiyunesac 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun 46*4882a593Smuzhiyunexit 0 47