X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=sidebyside;f=stage2%2Fbootscripts%2Fudev;h=12527a5f6a5a33efa8986cd020ad62b53d42e004;hb=22ec65898211b590bfbbf2f25c604169c456d15d;hp=98542e8fc48a2dc8ba52680b189e47256cb45324;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage2/bootscripts/udev b/stage2/bootscripts/udev old mode 100644 new mode 100755 index 98542e8..12527a5 --- a/stage2/bootscripts/udev +++ b/stage2/bootscripts/udev @@ -1,32 +1,38 @@ -#!/bin/sh +#!/bin/bash # udev # Udev cold-plugging script +DAEMON=/sbin/udevd +DAEMON_DESC=UDEV +DAEMON_OPTS="--daemon" + # Source functions library source /etc/rc.d/init.d/functions log_script_name "$0 $*" +udev_coldplug() +{ + # Unlikely, but we may be faster than the first event + mkdir -p /dev/udev/queue && + + # Configure all devices + /sbin/udevadm trigger --action=add --type=subsystems && + /sbin/udevadm trigger --action=add --type=devices && + + # Now wait for udevd to process the uevents we triggered + /sbin/udevadm settle +} + udev_start() { # Udev handles uevents itself, so we don't need to have # the kernel call out to any binary in response to them - echo > /proc/sys/kernel/hotplug && - - # Copy static device nodes to /dev - cp -a /lib/udev/devices/* /dev && - - # Start the udev daemon to continually watch for, and act on, - # uevents - /sbin/udevd --daemon && - - # Now traverse /sys in order to "coldplug" devices that have - # already been discovered - /sbin/udevtrigger && - - # Now wait for udevd to process the uevents we triggered - /sbin/udevsettle + echo "" > /sys/kernel/uevent_helper && + + # Start the udev daemon to continually watch for, and act on uevents + ${DAEMON} ${DAEMON_OPTS} } # See how we were called @@ -36,18 +42,14 @@ case "$1" in boot_failure "FAILURE: Unable to create devices without a SysFS filesystem." fi - # Mount a temporary file system over /dev, so that any devices - # made or removed during this boot don't affect the next one. - # The reason we don't write to mtab is because we don't ever - # want /dev to be unavailable (such as by `umount -a'). - mount -n -t tmpfs tmpfs /dev -o mode=755 - if [ ${?} != 0 ]; then - boot_failure "FAILURE: Cannot mount a tmpfs onto /dev." - fi + cmd_run_log_box "Copying static /dev entries" cp --preserve=all --recursive --remove-destination /lib/udev/devices/* /dev + cmd_run_log_box "Setting permissons on /dev/shm" chmod 1777 /dev/shm + + cmd_run_log_box_warn "${DAEMON_DESC} start" udev_start - cmd_run_log_box_warn "Udevd start" udev_start + cmd_run_log_box "Performing Coldplugging" udev_coldplug ;; - + *) echo "Usage: $0 {start}" exit ${EXIT_CODE_FAILURE}