From 61e63d302cd8bdb73dbb2d6567ca6e66184ae251 Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Fri, 23 May 2008 01:45:45 +0000 Subject: Upgrade Udev to 122, udev-config to 20080522, and lfs-bootscripts to 20080522. Replace "write_net_rules all_interfaces" with a "udevadm test" loop. Fix several typos. Remove the usb_id segfault patch, as it's included in Udev now. Add /lib/udev/devices/kmsg, as udevd uses /dev/kmsg to log a message at startup. Replace udevtrigger/udevinfo with "udevadm trigger" and "udevadm info" in the text. Should fix #2057, #2079, #2170, and #2186. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8545 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 13 ++++++ chapter01/whatsnew.xml | 8 +--- chapter03/patches.xml | 9 ---- chapter06/udev.xml | 122 ++++++++++++++++-------------------------------- chapter07/network.xml | 40 ++++++++++------ chapter07/symlinks.xml | 4 +- chapter07/udev.xml | 29 ++++++------ general.ent | 4 +- packages.ent | 18 +++---- patches.ent | 5 -- 10 files changed, 111 insertions(+), 141 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 371860310..35d9eb735 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -36,6 +36,19 @@ --> + + 2008-05-22 + + + [bryan] - Updated Udev to 122, udev-config to + 20080522, and lfs-bootscripts to 20080522. Also made + persistent-net rules able to be pre-generated, using + udevadm test. Fixes #2057, #2079 (I think), #2170, and + #2186. + + + + 2008-04-23 diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index 10e5e5e32..c0f887bc8 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -179,9 +179,9 @@ Texinfo &texinfo-version; - + &udev-config; @@ -236,10 +236,6 @@ &readline-fixes-patch; - - &udev-usbid-patch; - - &vim-fixes-patch; diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 5bd124a18..22a2d9620 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -187,15 +187,6 @@ - - Udev usb_id Segfault Patch - &udev-usbid-patch-size;: - - Download: - MD5 sum: &udev-usbid-md5; - - - - Vim Fixes Patch - &vim-fixes-patch-size;: diff --git a/chapter06/udev.xml b/chapter06/udev.xml index 8d7e820ae..95b7c3184 100644 --- a/chapter06/udev.xml +++ b/chapter06/udev.xml @@ -47,21 +47,17 @@ tar -xvf ../&udev-config;.tar.bz2 Create some devices and directories that Udev cannot handle due to - them being required very early in the boot process: + them being required very early in the boot process, or by Udev itself: install -dv /lib/{firmware,udev/devices/{pts,shm}} mknod -m0666 /lib/udev/devices/null c 1 3 +mknod -m0600 /lib/udev/devices/kmsg c 1 11 ln -sv /proc/self/fd /lib/udev/devices/fd ln -sv /proc/self/fd/0 /lib/udev/devices/stdin ln -sv /proc/self/fd/1 /lib/udev/devices/stdout ln -sv /proc/self/fd/2 /lib/udev/devices/stderr ln -sv /proc/kcore /lib/udev/devices/core - usb_id is known to segfault under certain kernel - configurations. Fix the issue by applying the following patch: - -patch -Np1 -i ../&udev-usbid-patch; - Compile the package: make EXTRAS="`echo extras/*/`" @@ -104,13 +100,9 @@ ln -sv /proc/kcore /lib/udev/devices/core - Udev has to be configured in order to work properly, as it only - installs a few configuration files by default. First install the - commonly-used rules files provided by Udev: - -cp -v etc/udev/rules.d/[0-9]* /etc/udev/rules.d/ - - Now install the LFS-specific rules files: + Udev has to be configured in order to work properly, as its default + configuration does not cover all devices. Install the (LFS-specific) + custom rules files: cd &udev-config; make install @@ -129,6 +121,7 @@ make install rules: cd .. +install -dv /usr/share/doc/udev-&udev-version; install -m644 -v docs/writing_udev_rules/index.html \ /usr/share/doc/udev-&udev-version;/index.html @@ -143,10 +136,9 @@ install -m644 -v docs/writing_udev_rules/index.html \ Installed directory - ata_id, cdrom_id, create_floppy_devices, edd_id, firmware.sh, - path_id, scsi_id, udevcontrol, udevd, udevinfo, udevmonitor, udevsettle, - udevtest, udevtrigger, usb_id, vol_id, write_cd_rules, and - write_net_rules + ata_id, cdrom_id, collect, create_floppy_devices, edd_id, + firmware.sh, fstab_import, path_id, scsi_id, udevadm, udevd, + usb_id, vol_id, write_cd_rules, and write_net_rules libvolume_id /etc/udev @@ -179,6 +171,18 @@ install -m644 -v docs/writing_udev_rules/index.html \ + + collect + + Given an ID for the current uevent and a list of + IDs (for all target uevents), registers the current ID + and indicates whether all target IDs have been registered + + collect + + + + create_floppy_devices @@ -209,6 +213,18 @@ install -m644 -v docs/writing_udev_rules/index.html \ + + fstab_import + + Finds an entry in /etc/fstab that + matches the current device, and provides its information to + Udev + + fstab_import + + + + path_id @@ -232,13 +248,15 @@ install -m644 -v docs/writing_udev_rules/index.html \ - - udevcontrol + + udevadm - Configures a number of options for the running - udevd daemon, such as the log level. - - udevcontrol + Generic udev administration tool: controls the udevd daemon, + provides info from the Udev database, monitors uevents, waits for + uevents to finish, tests Udev configuration, and triggers uevents + for a given device + + udevadm @@ -255,64 +273,6 @@ install -m644 -v docs/writing_udev_rules/index.html \ - - udevinfo - - Allows users to query the Udev database for - information on any device currently present on the system; it also - provides a way to query any device in the sysfs tree to help create udev - rules - - udevinfo - - - - - - udevmonitor - - Prints the event received from the kernel and the environment - which Udev sends out after rule processing - - udevmonitor - - - - - - udevsettle - - Watches the Udev event queue and exits if all current uevents - have been handled - - udevsettle - - - - - - udevtest - - Simulates a uevent for the given device, and prints out the - name of the node the real udevd would have created, - or the name of the renamed network interface - - udevtest - - - - - - udevtrigger - - Triggers kernel device uevents to be replayed - - udevtrigger - - - - usb_id diff --git a/chapter07/network.xml b/chapter07/network.xml index f3159a571..cf6762e5c 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -39,7 +39,9 @@ Pre-generate the rules to ensure the same names get assigned to the same devices at every boot, including the first: -/lib/udev/write_net_rules all_interfaces +for NIC in /sys/class/net/* ; do + INTERFACE=${NIC##*/} udevadm test --action=add --subsystem=net $NIC +done Now, inspect the /etc/udev/rules.d/70-persistent-net.rules file, to find out which name was assigned to which network device: @@ -48,14 +50,14 @@ The file begins with a comment block followed by two lines for each NIC. The first line for each NIC is a commented description showing its - hardware IDs (e.g. its PC vendor and device IDs, if it's a PCI card), + hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card), along with its driver in parentheses, if the driver can be found. Neither the hardware ID nor the driver is used to determine which name to give an - interface. The second line is the Udev rule that matches this NIC and - actually assigns it a name. + interface; this information is only for reference. The second line is the + Udev rule that matches this NIC and actually assigns it a name. All Udev rules are made up of several keys, separated by commas and - optional whitespace. This rule's keys and an explanations of each of them + optional whitespace. This rule's keys and an explanation of each of them are as follows: @@ -63,6 +65,11 @@ SUBSYSTEM=="net" - This tells Udev to ignore devices that are not network cards. + + ACTION=="add" - This tells Udev to ignore this + rule for a uevent that isn't an add ("remove" and "change" uevents also + happen, but don't need to rename network interfaces). + DRIVERS=="?*" - This exists so that Udev will ignore VLAN or bridge sub-interfaces (because these sub-interfaces do @@ -70,16 +77,23 @@ that would be assigned would collide with their parent devices. - ATTRS{type}=="1" - Optional. This key will - only be added if this NIC is a wireless NIC whose driver creates - multiple virtual interfaces; it ensures the rule only matches the - primary interface. The secondary interfaces are not matched for the - same reason that VLAN and bridge sub-interfaces are not matched: there - would be a name collision. + ATTR{address} - The value of this key is the + NIC's MAC address. + + + ATTR{type}=="1" - This ensures the rule only + matches the primary interface in the case of certain wireless drivers, + which create multiple virtual interfaces. The secondary interfaces are + skipped for the same reason that VLAN and bridge sub-interfaces are + skipped: there would be a name collision otherwise. - ATTRS{address} - The value of this key is the - NIC's MAC address. + KERNEL=="eth*" - This key was added to the + Udev rule generator to handle machines that have multiple network + interfaces, all with the same MAC address (the PS3 is one such + machine). If the independent interfaces have different basenames, + this key will allow Udev to tell them apart. This is generally not + necessary for most Linux From Scratch users, but does not hurt. NAME - The value of this key is the name that diff --git a/chapter07/symlinks.xml b/chapter07/symlinks.xml index 4b0aafeed..1ddfa62ea 100644 --- a/chapter07/symlinks.xml +++ b/chapter07/symlinks.xml @@ -63,7 +63,7 @@ /sys/block/hdd) and run a command similar to the following: -udevtest /sys/block/hdd +udevadm test /sys/block/hdd Look at the lines containing the output of various *_id programs. The by-id mode will use the ID_SERIAL value if it exists and @@ -124,7 +124,7 @@ Figure out the attributes that identify the device uniquely (usually, vendor and product IDs and/or serial numbers work): -udevinfo -a -p /sys/class/video4linux/video0 +udevadm info -a -p /sys/class/video4linux/video0 Then write rules that create the symlinks, e.g.: diff --git a/chapter07/udev.xml b/chapter07/udev.xml index e64fdf191..00afb06e7 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -105,14 +105,14 @@ class="directory">/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. - 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 + 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. @@ -155,9 +155,9 @@ /sys/bus/pci/devices/0000:00:0d.0/modalias file might contain the string pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. - The rules that LFS installs will cause udevd to call - out to /sbin/modprobe with the contents of the - MODALIAS uevent environment variable (that should be the + The default rules provided with Udev will cause udevd + to call out to /sbin/modprobe with the contents of the + MODALIAS uevent environment variable (which should be the same as the contents of the modalias file in sysfs), thus loading all modules whose aliases match this string after wildcard expansion. @@ -268,7 +268,8 @@ This usually happens if a rule unexpectedly matches a device. For example, a poorly-writen rule can match both a SCSI disk (as desired) and the corresponding SCSI generic device (incorrectly) by vendor. - Find the offending rule and make it more specific. + Find the offending rule and make it more specific, with the help of the + udevadm info command. @@ -281,8 +282,8 @@ For now, you can work around it by creating a rule that waits for the used sysfs attribute and appending it to the /etc/udev/rules.d/10-wait_for_sysfs.rules - file. Please notify the LFS Development list if you do so and it - helps. + file (create this file if it does not exist). Please notify the LFS + Development list if you do so and it helps. diff --git a/general.ent b/general.ent index 0c23bf567..e5bebbb16 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,6 @@ - - + + diff --git a/packages.ent b/packages.ent index 7afda42e1..67744dfb9 100644 --- a/packages.ent +++ b/packages.ent @@ -283,10 +283,10 @@ - - + + - + @@ -488,18 +488,18 @@ - - + + - + - + - + - + diff --git a/patches.ent b/patches.ent index 51310c3b5..70b97562c 100644 --- a/patches.ent +++ b/patches.ent @@ -104,11 +104,6 @@ - - - - - -- cgit v1.2.3-54-g00ecf