Jim Gifford suggested:

(I snip everything that is exactly the same as in LFS)

diff -urN /var/empty/05-udev-early.rules udev-cross-lfs/05-udev-early.rules
--- /var/empty/05-udev-early.rules      1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/05-udev-early.rules  2006-01-05 21:50:30.000000000 +0500

+ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", 
WAIT_FOR_SYSFS="bus"
+ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"

ACK.

+SUBSYSTEM=="drivers",                OPTIONS="ignore_device"
+SUBSYSTEM=="module",         OPTIONS="ignore_device"

Indeed, that gives a speedup.

diff -urN /var/empty/50-udev.rules udev-cross-lfs/50-udev.rules
--- /var/empty/50-udev.rules    1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/50-udev.rules        2006-01-05 21:50:30.000000000 +0500
+# hotplug
+ENV{MODALIAS}=="?*",    RUN+="/sbin/modprobe $env{MODALIAS}"

Should really be in a separate file (let's call it 40-modload.rules), together with the SCSI module loading rules.

+# console
+KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", 
OPTIONS="last_rule"
+KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", 
OPTIONS="last_rule"

These are not in LFS rules, not sure what is best for them.

+KERNEL=="vcs*",                      NAME="%k", GROUP="tty", MODE="620", 
OPTIONS="last_rule"
+KERNEL=="vcsa*",             NAME="%k", GROUP="tty", MODE="620", 
OPTIONS="last_rule"

Won't the "vcs*" rule catch "vcsa*" too? Also, LFS uses 0600 permissions (group is irrelevant then).

+KERNEL=="console",           NAME="%k", MODE="600", OPTIONS="last_rule"

LFS uses GROUP="tty", MODE="0622" which is probably insecure.

+# serial devices
+KERNEL=="tty[A-Z]*",         NAME="%k", GROUP="uucp"

LFS uses: KERNEL=="tty[BCDEFHILMPRSTUVWX][0-9]*", GROUP="dialout"

+KERNEL=="pppox*",            NAME="%k", GROUP="uucp"

LFS has no such rule, "modprobe pppox" doesn't produce anything in /sts/class with the name starting with "pppox". In the default udev rules, this appears to be SuSE-specific. But I am not an expert on pppox.

+KERNEL=="ircomm*",           NAME="%k", GROUP="uucp"

LFS uses GROUP="dialout"

+KERNEL=="modems/mwave*",     NAME="%k", GROUP="uucp"
+KERNEL=="hvc*",                      NAME="%k", GROUP="uucp"
+KERNEL=="hvsi*",             NAME="%k", GROUP="uucp"
+KERNEL=="iseries/vtty*",     NAME="%k", GROUP="uucp"

Looks SUSE-specific and even bogus. KERNEL names cannot contain a slash.

+KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot"

I have no Palm, can't comment here. But example rules for RedHat and Debian disagree, thus, confirmation needed.

+SUBSYSTEM=="video4linux",    GROUP="video"
+SUBSYSTEM=="graphics"                GROUP="video"

ACK, but what about MODE?

+KERNEL=="winradio*",         NAME="%k", GROUP="video"
+KERNEL=="vttuner*",          NAME="%k", GROUP="video"

Aren't they covered above with the SUBSYSTEM rules? (just a guess, I have no v4l devices)

+KERNEL=="nvidia*",           NAME="%k", GROUP="video"
+KERNEL=="nvidiactl*",                NAME="%k", GROUP="video"

"nvidia*" also covers nvidiactl

+KERNEL=="video0",            SYMLINK+="video"
+KERNEL=="radio0",            SYMLINK+="radio"
+KERNEL=="vbi0",                      SYMLINK+="vbi"

Not in LFS, doesn't make much sense with more than one card and modular drivers, because the random card will get the symlink.

+KERNEL=="pmu",                       GROUP="video"

Not in LFS. What is it?

+# dvb
+SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} 
$${K#*.}'", NAME="%c", GROUP="video"

ACK, needs to be added to LFS.

+# input devices
+KERNEL=="mice",                      NAME="input/%k", MODE="0640"
+KERNEL=="mouse*",            NAME="input/%k", MODE="0640"
+KERNEL=="event*",            NAME="input/%k", MODE="0640"
+KERNEL=="js*",                       NAME="input/%k", MODE="0644"
+KERNEL=="ts*",                       NAME="input/%k", MODE="0600"

Permissions disagree with LFS, MODE=644 or GROUP=something  wanted

+KERNEL=="uinput",            NAME="input/%k", MODE="0600"

Needs to be added to LFS with proper permissions.

+KERNEL=="lirc0",             NAME="%k", SYMLINK+="lirc"

Can't comment.

+KERNEL=="input[0-9]*", ACTION=="add", RUN+="input.sh"

You recommend the -gregkh kernel patch, thus you can drop this hack in favour of proper input modalias support in the kernel.

+# printer
parport devices are missing. LFS uses this:

KERNEL=="parport[0-9]*", GROUP="lp"

but this is also questionable because raw parport devices are used for things not related to printing, such as parallel port cnanners and the devices that program EEPROMs and some other chips.

+# cpu devices
+KERNEL=="cpu[0-9]*",         NAME="cpu/%n/cpuid"
+KERNEL=="msr[0-9]*",         NAME="cpu/%n/msr"
+KERNEL=="microcode",         NAME="cpu/microcode", MODE="0600"

Valuable addition to LFS.

+# IEEE1394 devices
+KERNEL=="raw1394*",          NAME="%k", GROUP="video"
+KERNEL=="dv1394*",           NAME="%k", SYMLINK+="dv1394/%n", GROUP="video"
+KERNEL=="video1394*",                NAME="%k", SYMLINK+="video1394/%n", 
GROUP="video"

Looks like useful for LFS too. But really can't comment.

+KERNEL=="hw_random",         NAME="hwrng", SYMLINK+="%k"

Not in LFS.

+KERNEL=="mwave",             NAME="modems/%k"
+KERNEL=="rioctl",            NAME="specialix_rioctl", SYMLINK+="%k"
+KERNEL=="sxctl",             NAME="specialix_sxctl", SYMLINK+="%k"

Not sure, no confirmation from non-SUSE.

+KERNEL=="nvram",             NAME="%k", GROUP="kmem", MODE="600"
+KERNEL=="sonypi",            MODE="0666"

Not in LFS

+KERNEL=="full",                      NAME="%k", MODE="622"
+KERNEL=="rtc",                       GROUP="audio"

Permissions disagree with LFS


+KERNEL=="agpgart",           MODE="0600", GROUP="video"

How can members of the "video" group use agpgart if the mode is 0600?

+KERNEL=="sgi_*",             NAME="%k", MODE="666"
+KERNEL=="rrom*",             NAME="%k", MODE="400"
+KERNEL=="rflash*",           NAME="%k", MODE="400"

Not in LFS

+KERNEL=="usbscanner*",               NAME="%k", MODE="644"

This is dead since linux-2.6.4.

+KERNEL=="3270/ttycons*",     NAME="%k", MODE="600"
+KERNEL=="3270/tub*",         NAME="%k", MODE="666"
+KERNEL=="3270/tubcons*",     NAME="%k", MODE="600"

Slash in KERNEL names.

+KERNEL=="ica",                       NAME="%k", MODE="666"
+KERNEL=="z90crypt",          NAME="%k", MODE="666"
+KERNEL=="mmtimer",           NAME="%k", MODE="444"

Not in LFS

+# packet writing interface
+KERNEL=="pktcdvd",           NAME="pktcdvd/control"
+KERNEL=="pktcdvd[0-9]*",     NAME="pktcdvd/%k"

Must be in LFS.

+# fix floppy devices
+KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh"

Belongs to 40-modload.rules

+KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", 
RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k"
+KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*"

Untested, but may be good.

+# block devices
+SUBSYSTEM=="block", GROUP="disk", MODE="0640"

Good idea

+ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 
> /sys/$DEVPATH/timeout'"
+ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > 
/sys/$DEVPATH/timeout'"

Belong to separate file, 39-scsi-tweaks.rules

+SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", 
RUN+="/sbin/modprobe sd_mod"
+SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", 
SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst"
+SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", 
RUN+="/sbin/modprobe st"
+SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", 
RUN+="/sbin/modprobe sr_mod"
+SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg"

Please move to 40-modload.rules

+# load IDE modules
+SUBSYSTEM=="ide", ACTION=="add", RUN+="ide.sh"

You recommend the -gregkh kernel patch, so drop this. No longer needed.

+# device mapper
+KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control"

Nobody opens /dev/device-mapper, so won't this be:

KERNEL=="device-mapper", NAME="mapper/control"

+KERNEL=="sg*",                       NAME="%k", GROUP="disk", MODE="640"

This is not only for disks, but for every SCSI device: disks, CD-RWs, tapes, scanners, etc. So the LFS root-only default seems better.

+KERNEL=="st*",                       NAME="%k", GROUP="disk"
+KERNEL=="nst*",                      NAME="%k", GROUP="disk"

We gave the "tape" group, why not use it?

+KERNEL=="initrd",            NAME="%k", GROUP="disk"

Isn't this a block device already caught by SUBSYSTEM=="block"?

+KERNEL=="qft*",                      NAME="%k", GROUP="disk"
+KERNEL=="nqft*",             NAME="%k", GROUP="disk"
+KERNEL=="zqft*",             NAME="%k", GROUP="disk"
+KERNEL=="nzqft*",            NAME="%k", GROUP="disk"
+KERNEL=="rawqft*",           NAME="%k", GROUP="disk"
+KERNEL=="nrawqft*",          NAME="%k", GROUP="disk"
+KERNEL=="npt*",                      NAME="%k", GROUP="disk"
+KERNEL=="osst*",             NAME="%k", GROUP="disk"
+KERNEL=="nosst*",            NAME="%k", GROUP="disk"

These devices are tapes, aren't they?

+KERNEL=="pf*",                       NAME="%k", GROUP="disk"

This looks like a block device, because there is no register_chrdev() in pf.c

+KERNEL=="sch*",                      NAME="%k", GROUP="disk"

What is this?

+KERNEL=="pt*",                       NAME="%k", GROUP="disk"

really tape

+KERNEL=="pg*",                       NAME="%k", GROUP="disk"

This represents a generic device that might be a CD-RW or anything else that has word "ATAPI" in its name and is connected to the parallel port. Maybe the LFS root-only default is better.

+KERNEL=="evms/block_device*",        NAME="%k", GROUP="disk"

Bogus. EVMS doesn't use such device, it is built on top of device-mapper.

+KERNEL=="rawctl*",           NAME="%k", GROUP="disk"

Obsolete, and doesn't come with the /dev/raw[0-9]* rule from LFS.

+KERNEL=="iseries/vt*",               NAME="%k", GROUP="disk"
+KERNEL=="iseries/nvt*",              NAME="%k", GROUP="disk"
+KERNEL=="iseries/ibmsis*",   NAME="%k", GROUP="disk"

Slash in KERNEL names. This also applies to LFS rules.

+# libusb device access
+SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i 
$${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644"

Permissions must be discussed. Right now, it is incompatible with SANE in BLFS because BLFS doesn't tell the user to override permissions for USB scanners.

+# kernel firmware loader
+SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware_helper"

Belongs to 38-misc-helpers.rules together with the obsolete run_hotplugd program (needed so that HAL is not broken in BLFS).

The following devices that are present in LFS rules are not covered:

KERNEL=="aio"
KERNEL=="kmsg"
KERNEL=="ippp[0-9]*"
KERNEL=="isdn[0-9]*"
KERNEL=="isdnctrl[0-9]*"
KERNEL=="capi"
KERNEL=="capi*"
KERNEL=="dcbri[0-9]*"

ALSA and other sound devices: entire section

KERNEL=="hiddev*"
KERNEL=="legousbtower*"
KERNEL=="dabusb*"

# DRI devices are managed by the X server
KERNEL=="card*",          NAME=""

# dmsetup and lvm2 related programs create devicemapper devices
# so we prevent udev from creating them
# Also, anything else breaks LILO.
KERNEL=="dm-*",                     NAME=""

diff -urN /var/empty/60-persistent.rules udev-cross-lfs/60-persistent.rules
--- /var/empty/60-persistent.rules      1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/60-persistent.rules  2006-01-05 21:50:30.000000000 +0500

Subject of a separate post.
diff -urN /var/empty/85-mount-fstab.rules udev-cross-lfs/85-mount-fstab.rules
--- /var/empty/85-mount-fstab.rules     1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/85-mount-fstab.rules 2006-01-05 21:50:30.000000000 +0500

Looks like a useful example for those who don't want to install HAL and ivman. Does nothing by default, which is good.

diff -urN /var/empty/95-debug.rules udev-cross-lfs/95-debug.rules
--- /var/empty/95-debug.rules   1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/95-debug.rules       2006-01-05 21:50:30.000000000 +0500

Subject of a separate post.
diff -urN /var/empty/ide.sh udev-cross-lfs/ide.sh
--- /var/empty/ide.sh   1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/ide.sh       2006-01-05 21:50:30.000000000 +0500

Kill it, no longer needed with the -gregkh kernel patch.
diff -urN /var/empty/input.sh udev-cross-lfs/input.sh
--- /var/empty/input.sh 1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/input.sh     2006-01-05 21:50:30.000000000 +0500

Same here.

diff -urN /var/empty/load_floppy_module.sh udev-cross-lfs/load_floppy_module.sh
--- /var/empty/load_floppy_module.sh    1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/load_floppy_module.sh        2006-01-05 21:50:30.000000000 
+0500

OK
diff -urN /var/empty/Makefile udev-cross-lfs/Makefile
--- /var/empty/Makefile 1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/Makefile     2006-01-05 21:50:30.000000000 +0500

I did the setup by hand, can't comment here.
diff -urN /var/empty/mount.sh udev-cross-lfs/mount.sh
--- /var/empty/mount.sh 1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/mount.sh     2006-01-05 21:50:30.000000000 +0500

Looks like a useful example for those who don't want to install HAL and ivman. Does nothing by default, which is good.
+# Description : Input devices
Please correct that :)

diff -urN /var/empty/README.debug udev-cross-lfs/README.debug
--- /var/empty/README.debug     1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/README.debug 2006-01-05 21:50:30.000000000 +0500

Subject of a separate post.
diff -urN /var/empty/show_event_log udev-cross-lfs/show_event_log
--- /var/empty/show_event_log   1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/show_event_log       2006-01-05 21:50:30.000000000 +0500

also.
diff -urN /var/empty/sysconfig.storage udev-cross-lfs/sysconfig.storage
--- /var/empty/sysconfig.storage        1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/sysconfig.storage    2006-01-05 21:50:30.000000000 +0500

Looks like a useful example for those who don't want to install HAL and ivman. Does nothing by default, which is good.

diff -urN /var/empty/udev udev-cross-lfs/udev
--- /var/empty/udev     1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/udev 2006-01-05 21:50:30.000000000 +0500
@@ -0,0 +1,136 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/udev
+#
+# Description : Udev Boot Script
+#
+# Authors     : Based on Open Suse Udev Rules
+#               [EMAIL PROTECTED]
+#
+# Adapted to  : Jim Gifford
+# LFS
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+trigger_device_events() {
+       # generate events with the sysfs trigger
+       list=$(echo /sys/bus/*/devices/*/uevent)
+       list="$list $(echo /sys/class/*/*/uevent)"
+       list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)"
+       for i in $list; do
+           case "$i" in
+               */device/uevent|*\**)
+                   # skip followed device symlinks
+                   continue
+                   ;;
+
+               */class/mem/*|*/class/tty/*)
+                   first="$first $i"
+                   ;;
+
+               */block/md*)
+                   last="$last $i"
+                   ;;
+
+               */*)
+                   default="$default $i"
+                   ;;
+           esac
+       done

Reordering the list is meaningless, since the events reach udev in random order.

+       # trigger the sorted events
+       for i in $first $default $last; do
+           echo "add" > "$i"
+       done
+}


This is the recommended way of retriggering uevents.

+
+case "$1" in
+    start)
+       boot_mesg "Creating /dev in tmpfs..."
+       mount -n -t tmpfs tmpfs /dev -o mode=755
+       evaluate_retval
+
+       boot_mesg "Copying static entries..."
+       cp -ar /lib/udev/devices/* /dev
+       evaluate_retval

This is the recommended way of creating /dev/pts, /dev/shm, /dev/fd and friends.

+       boot_mesg "Executing udevstart..."
+       udevstart
+       evaluate_retval

GRRRRR....

udevstart is no longer the recommended way to create initial device nodes, because it is synchronous. They are supposed to be created whyle echoing "add" to "uevent" files. The question is whether upstream is right in their recommendation.

+       # disable hotplug helper, udevd listens to netlink
+       echo "" > /proc/sys/kernel/hotplug

OK, but this will be robably no longer needed with 2.6.16.

+       # start udevd
+       boot_mesg "Starting udevd..."
+       loadproc /sbin/udevd --daemon

loadproc didn't work for me here. I changed this to:

/sbin/udevd --daemon
evaluate_retval

+       # cleanup some stuff
+       rm -f /var/run/sysconfig/network
+       rm -rf /events/*

SuSE-specific, please remove.

+       # start coldplugging
+       boot_mesg "Performing Coldplugging..."
+
+       # unlikely, but we may be faster than the first event
+       mkdir -p /dev/.udev/queue
+
+       # configure all devices
+       trigger_device_events

OK, that's how upstream thinks the script should behave.

+       # until we know how to do better, just wait for _all_ events to finish
+       loop=300
+       while test -d /dev/.udev/queue; do
+           sleep 0.1;
+           test "$loop" -gt 0 || break
+           loop=$(($loop - 1))
+       done

This comes directly from upstream. But I think this is buggy: once a non-USB uevent slipped through. I am going to add a rule to debug this.

+       echo_ok

OK only if the timeout is not reached. Otherwise, we failed.

The rest of the script looks OK.
diff -urN /var/empty/udev.count_events udev-cross-lfs/udev.count_events
--- /var/empty/udev.count_events        1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/udev.count_events    2006-01-05 21:50:30.000000000 +0500

Looks like unused file.
diff -urN /var/empty/udev.makechanges udev-cross-lfs/udev.makechanges
--- /var/empty/udev.makechanges 1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/udev.makechanges     2006-01-05 21:50:30.000000000 +0500

please rename to README or INSTALL
diff -urN /var/empty/udev_retry udev-cross-lfs/udev_retry
--- /var/empty/udev_retry       1970-01-01 05:00:00.000000000 +0500
+++ udev-cross-lfs/udev_retry   2006-01-05 21:50:30.000000000 +0500

Yes, upstream wants us to have this initscript also. This simplifies e.g. ALSA script in BLFS to:

/usr/sbin/alsactl restore "$1"

If /usr is a separate partition, this scriptlet will just fail, and the udev_retry initscript would retry it.

The script itself looks OK, but I had no chance to test it.

--
Alexander E. Patrakov
Don't mail to [EMAIL PROTECTED]: the server is off until 2006-01-11
Use my GMail or linuxfromscratch address instead
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to