Add missing udev bootscript for stage2
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 5 Dec 2014 04:37:56 +0000 (23:37 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 5 Dec 2014 04:44:19 +0000 (23:44 -0500)
udev is now installed in its final destination, instead of /tools.

stage2/bootscripts/udev [new file with mode: 0755]
stage2/pkg/eudev

diff --git a/stage2/bootscripts/udev b/stage2/bootscripts/udev
new file mode 100755 (executable)
index 0000000..12527a5
--- /dev/null
@@ -0,0 +1,59 @@
+#!/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 "" > /sys/kernel/uevent_helper &&
+
+    # Start the udev daemon to continually watch for, and act on uevents
+    ${DAEMON} ${DAEMON_OPTS}
+}
+
+# See how we were called
+case "$1" in
+    start)
+        if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
+           boot_failure "FAILURE: Unable to create devices without a SysFS filesystem."
+        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 "Performing Coldplugging" udev_coldplug
+       ;;
+
+    *)
+       echo "Usage: $0 {start}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
index e32be6d..990f95f 100644 (file)
@@ -29,4 +29,8 @@ hvbuild_post()
 
     sed -i -e "s/\(SYMLINK+=\"cdrom\)\"/\1 dvd\"/" \
         /lib/udev/rules.d/60-cdrom_id.rules
+
+    install -dv /lib/{firmware,udev/devices/{pts,shm}}
+
+    install -v -m740 ${SCRDIR}/bootscripts/udev /etc/rc.d/init.d
 }