Author: jw Date: 2006-09-05 09:40:28 +0200 (Tue, 05 Sep 2006) New Revision: 1813 Added: tools/udev-rules/ tools/udev-rules/05-udev-early.rules tools/udev-rules/25-lfs.rules tools/udev-rules/26-modprobe.rules tools/udev-rules/27-firmware.rules tools/udev-rules/60-persistent-storage.rules tools/udev-rules/81-cdrom.rules tools/udev-rules/CHANGELOG.upstream tools/udev-rules/README Log: udev-rules: import to svn Added: tools/udev-rules/05-udev-early.rules =================================================================== --- tools/udev-rules/05-udev-early.rules (rev 0) +++ tools/udev-rules/05-udev-early.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,3 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" Added: tools/udev-rules/25-lfs.rules =================================================================== --- tools/udev-rules/25-lfs.rules (rev 0) +++ tools/udev-rules/25-lfs.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,136 @@ +# /etc/udev/rules.d/25-lfs.rules: Rule definitions for LFS. + +# Core kernel devices + +KERNEL=="ptmx", MODE="0666", GROUP="tty" +KERNEL=="random", MODE="0444" +KERNEL=="urandom", MODE="0444" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="full", MODE="0666" +KERNEL=="aio", MODE="0444" +KERNEL=="kmsg", MODE="0600" +KERNEL=="rtc", MODE="0666" + +# Comms devices + +KERNEL=="ttyS[0-9]*", GROUP="dialout" +KERNEL=="ttyUSB[0-9]*", GROUP="dialout" +KERNEL=="rfcomm[0-9]*", GROUP="dialout" +KERNEL=="tty[BCDEFHILMPRSTUVWX][0-9]*", GROUP="dialout" +KERNEL=="ttyS[ACIR][0-9]*", GROUP="dialout" +KERNEL=="ttyUSB[0-9]*", GROUP="dialout" +KERNEL=="ttyACM[0-9]*", GROUP="dialout" +KERNEL=="ippp[0-9]*", GROUP="dialout" +KERNEL=="isdn[0-9]*", GROUP="dialout" +KERNEL=="isdnctrl[0-9]*", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL=="capi?*", NAME="capi/%n", GROUP="dialout" +KERNEL=="dcbri[0-9]*", GROUP="dialout" +KERNEL=="ircomm[0-9]*", GROUP="dialout" + +# TTY's + +KERNEL=="tty", MODE="0666", GROUP="tty" +KERNEL=="tty[0-9]*", MODE="0666", GROUP="tty" +KERNEL=="vcs*", MODE="0600" +KERNEL=="console", MODE="0622", GROUP="tty" + +# ALSA devices go in their own subdirectory + +KERNEL=="controlC[0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", GROUP="audio", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", GROUP="audio", NAME="snd/%k" +KERNEL=="timer", GROUP="audio", NAME="snd/%k" +KERNEL=="seq", GROUP="audio", NAME="snd/%k" + +# Sound devices + +KERNEL=="admmidi*", GROUP="audio" +KERNEL=="adsp*", GROUP="audio" +KERNEL=="aload*", GROUP="audio" +KERNEL=="amidi*", GROUP="audio" +KERNEL=="amixer*", GROUP="audio" +KERNEL=="audio*", GROUP="audio" +KERNEL=="dmfm*", GROUP="audio" +KERNEL=="dmmidi*", GROUP="audio" +KERNEL=="dsp*", GROUP="audio" +KERNEL=="midi*", GROUP="audio" +KERNEL=="mixer*", GROUP="audio" +KERNEL=="music", GROUP="audio" +KERNEL=="sequencer*", GROUP="audio" + +# Printing devices + +KERNEL=="lp[0-9]*", GROUP="lp" +KERNEL=="parport[0-9]*", GROUP="lp" +KERNEL=="irlpt[0-9]*", GROUP="lp" + +# Input devices go in their own subdirectory + +KERNEL=="mice", MODE="0644", NAME="input/%k" SYMLINK="mouse" +KERNEL=="mouse*", MODE="0644", NAME="input/%k" +KERNEL=="event*", MODE="0644", NAME="input/%k" +KERNEL=="js*", MODE="0644", NAME="input/%k" +KERNEL=="ts*", MODE="0644", NAME="input/%k" + +KERNEL=="psaux", MODE="0644" +KERNEL=="js", MODE="0644" +KERNEL=="djs", MODE="0644" + +# USB devices go in their own subdirectory + +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k; X=$${X#usbdev}; B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", NAME="%c" +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp", NAME="usb/%k" + +# DRI devices are managed by the X server, so prevent udev from creating them + +KERNEL=="card*", NAME="" + +# Video devices + +KERNEL=="fb[0-9]*", MODE="0620", GROUP="video" +KERNEL=="agpgart", GROUP="video" +KERNEL=="video[0-9]*", GROUP="video" +KERNEL=="radio[0-9]*", GROUP="video" +KERNEL=="vbi[0-9]*", GROUP="video" +KERNEL=="vtx[0-9]*", GROUP="video" + +# Storage/memory devices + +KERNEL=="fd[0-9]*", GROUP="floppy" +KERNEL=="ram[0-9]*", GROUP="disk" +KERNEL=="raw[0-9]*", GROUP="disk", NAME="raw/%k" +KERNEL=="hd*", GROUP="disk" +KERNEL=="sd[a-z]", GROUP="disk" +KERNEL=="sd[a-z][0-9]*", GROUP="disk" +KERNEL=="sd[a-i][a-z]", GROUP="disk" +KERNEL=="sd[a-i][a-z][0-9]*", GROUP="disk" +KERNEL=="dasd[0-9]*", GROUP="disk" +KERNEL=="loop[0-9]*", GROUP="disk" +KERNEL=="md[0-9]*", GROUP="disk" + +# dmsetup and lvm2 related programs create devicemapper devices so we prevent +# udev from creating them + +KERNEL=="dm-*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", OPTIONS+="ignore_device" + +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="npt[0-9]*", GROUP="tape" +KERNEL=="st[0-9]*", GROUP="tape" +KERNEL=="nst[0-9]*", GROUP="tape" + +# Network devices + +KERNEL=="tun", NAME="net/%k" Added: tools/udev-rules/26-modprobe.rules =================================================================== --- tools/udev-rules/26-modprobe.rules (rev 0) +++ tools/udev-rules/26-modprobe.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,18 @@ +# /etc/udev/rules.d/26-modprobe.rules: Rules that require modprobe. + +# Generic rule to allow loading modular drivers for existing hardware + +ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# SCSI devices require different modules, dependent on their SYSFS{type}. All +# of them require 'sg' though. +# +# module name sysfs types +# sd 0 (TYPE_DISK), 7 (TYPE_MOD), 14 (TYPE_MOD) +# st/osst 1 (TYPE_TAPE) +# sr 4 (TYPE_WORM), 5 (TYPE_ROM) + +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" Added: tools/udev-rules/27-firmware.rules =================================================================== --- tools/udev-rules/27-firmware.rules (rev 0) +++ tools/udev-rules/27-firmware.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,3 @@ +# /etc/udev/rules.d/27-firmware.rules: Load firmware for devices that need it + +ACTION=="add", SUBSYSTEM=="firmware", RUN+="firmware.sh" Added: tools/udev-rules/60-persistent-storage.rules =================================================================== --- tools/udev-rules/60-persistent-storage.rules (rev 0) +++ tools/udev-rules/60-persistent-storage.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,49 @@ +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de> + +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" + +# for partitions import parent information +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + + +LABEL="persistent_storage_end" Added: tools/udev-rules/81-cdrom.rules =================================================================== --- tools/udev-rules/81-cdrom.rules (rev 0) +++ tools/udev-rules/81-cdrom.rules 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,3 @@ +# /etc/udev/rules.d/81-cdrom.rules: Set CD-ROM permissions. + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", GROUP="cdrom" Added: tools/udev-rules/CHANGELOG.upstream =================================================================== --- tools/udev-rules/CHANGELOG.upstream (rev 0) +++ tools/udev-rules/CHANGELOG.upstream 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,24 @@ +dnicholson - Jul 14, 2006 + * Fixed usbdev PROGRAM so that it works with the BusyBox sh. Thanks + to Anthony Wright. + +n/a - Jul 12, 2006 + * Added options so temporary nodes are not created with device-mapper + * Adapted cdrom rules to identify CD-ROM drives correctly by adding + SUBSYSTEM=="block" test. + * Added simple 81-cdrom.rules file to set cdrom group ownership + +n/a - Jun 07, 2006 + * Removed nvidia rules + * Removed bug reporting rule + * Moved Debian-based persistent CD-ROM rules to contrib + * Adapted firmware rule to udev-093 + +n/a - May 15, 2006 + * Part one of 25-lfs.rules rewrite + * Some minor tweaking of the layout + +n/a - May 12, 2006 + * Initial import of the udev-config directory. + * Reorganized and modularized the rules files. + * Added explanatory comments Added: tools/udev-rules/README =================================================================== --- tools/udev-rules/README (rev 0) +++ tools/udev-rules/README 2006-09-05 07:40:28 UTC (rev 1813) @@ -0,0 +1,3 @@ +udev rules for CRUX http://crux.nu + +Based on the rules from Linux From Scratch, http://www.linuxfromscratch.org/