From 2a1c1e03a43156b673a7188a0cd4a784829ab3c5 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Thu, 6 Oct 2011 15:35:49 +0000 Subject: [PATCH] Fix the udev_retry script, and add an explanation for how to configure it. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9614 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- bootscripts/ChangeLog | 9 ++++- bootscripts/Makefile | 3 ++ bootscripts/lfs/init.d/udev_retry | 11 ++++-- chapter01/changelog.xml | 10 ++++++ chapter07/udev.xml | 56 +++++++++++++++++++------------ general.ent | 4 +-- packages.ent | 2 +- 7 files changed, 67 insertions(+), 28 deletions(-) diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index fb3cc3138..1937ca4b0 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,4 +1,11 @@ -2100-09-18 +2011-10-06 Bryan Kadzban + + * Add configuration for udev_retry, and remove --type=failed (which does + not work with recent udev versions anyway, since no events can possibly + trigger it). Start with just the "rtc" subsystem. BLFS should eventually + add "sound" to this file, and perhaps others. + +2011-09-18 * Review and update of changes made in previous change. ** Rename /etc/sysconfig/init_params to /etc/sysconfig/rc.site. ** Move network services to /lib/services. diff --git a/bootscripts/Makefile b/bootscripts/Makefile index 5053e2698..65eafc888 100644 --- a/bootscripts/Makefile +++ b/bootscripts/Makefile @@ -60,6 +60,9 @@ files: create-dirs if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \ install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\ fi + if [ ! -f ${EXTDIR}/sysconfig/udev_retry ]; then \ + install -m ${CONFMODE} lfs/sysconfig/udev_retry ${EXTDIR}/sysconfig/ ;\ + fi if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \ install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\ fi diff --git a/bootscripts/lfs/init.d/udev_retry b/bootscripts/lfs/init.d/udev_retry index 8abf3da64..4f258ac19 100644 --- a/bootscripts/lfs/init.d/udev_retry +++ b/bootscripts/lfs/init.d/udev_retry @@ -7,6 +7,7 @@ # Authors : Alexander E. Patrakov # DJ Lucas - dj@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# Bryan Kadzban - # # Version : LFS 7.0 # @@ -44,8 +45,14 @@ case "${1}" in rm -f $file done - # Re-trigger the failed uevents in hope they will succeed now - /sbin/udevadm trigger --type=failed --action=add + # Re-trigger the uevents that may have failed, + # in hope they will succeed now + /bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \ + while read line ; do + for subsystem in $line ; do + /sbin/udevadm trigger --subsystem-match=$subsystem --action=add + done + done # Now wait for udevd to process the uevents we triggered /sbin/udevadm settle diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 63aade35b..6fd4daedc 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -36,6 +36,16 @@ --> + + 2011-10-06 + + + [bryan] - Fix the udev_retry script, and add an explanation + for how to configure it. + + + + 2011-10-05 diff --git a/chapter07/udev.xml b/chapter07/udev.xml index 5bb769caa..3ceb7704c 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -93,40 +93,52 @@ - Udev Bootscript + Udev Bootscripts - The /etc/rc.d/init.d/udev initscript takes care of creating - device nodes when Linux is booted. The script unsets the uevent handler - from the default of /sbin/hotplug. This is done - because the kernel no longer needs to call out to an external binary. - Instead udevd will listen on a netlink socket for - uevents that the kernel raises. Next, the bootscript copies any static - device nodes that exist in The /etc/rc.d/init.d/udev initscript takes care + of creating device nodes when Linux is booted. The script unsets the + uevent handler from the default of /sbin/hotplug. + This is done because the kernel no longer needs to call out to an + external binary. Instead udevd will listen on a + netlink socket for uevents that the kernel raises. Next, the bootscript + copies any static device nodes that exist in /lib/udev/devices to /dev. This is necessary because some devices, - directories, and symlinks are needed before the dynamic device handling - processes are available during the early stages of booting a system, or - are required by udevd itself. Creating static device - nodes in /lib/udev/devices also - provides an easy workaround for devices that are not supported by the - dynamic device handling infrastructure. The bootscript then starts the - Udev daemon, udevd, which will act on any uevents it - receives. Finally, the bootscript forces the kernel to replay uevents for - any devices that have already been registered and then waits for + class="directory">/dev. This is necessary because some + devices, directories, and symlinks are needed before the dynamic device + handling processes are available during the early stages of booting a + system, or are required by udevd itself. Creating + static device nodes in /lib/udev/devices also provides an easy + workaround for devices that are not supported by the dynamic device + handling infrastructure. The bootscript then starts the Udev daemon, + udevd, which will act on any uevents it receives. + Finally, the bootscript forces the kernel to replay uevents for any + devices that have already been registered and then waits for udevd to handle them. + The /etc/rc.d/init.d/udev_retry initscript takes + care of re-triggering events for subsystems whose rules may rely on + filesystems that are not mounted until the mountfs + script is run (in particular, /usr and /var may cause this). This script + runs after the mountfs script, so those rules (if + re-triggered) should succeed the second time around. It is configured + from the /etc/sysconfig/udev_retry file; any words + in this file other than comments are considered subsystem names to + trigger at retry time. (To find the subsystem of a device, use + udevadm info --attribute-walk.) + Device Node Creation - To obtain the right major and minor number for a device, Udev relies - on the information provided by To obtain the right major and minor number for a device, Udev + relies on the information provided by sysfs in /sys. For example, /sys/class/tty/vcs/dev contains the string - 7:0. This string is used by udevd - to create a device node with major number 7 and minor + 7:0. This string is used by udevd to + create a device node with major number 7 and minor 0. The names and permissions of the nodes created under the /dev directory are determined by rules specified in the files within the - + + diff --git a/packages.ent b/packages.ent index 62c32c83b..813fcfb12 100644 --- a/packages.ent +++ b/packages.ent @@ -298,7 +298,7 @@ - +