diff options
author | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:19:12 (GMT) |
---|---|---|
committer | James Meyer <James.meyer@operamail.com> | 2008-10-02 03:19:12 (GMT) |
commit | 0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch) | |
tree | c0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core-testing/udev | |
download | linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2 |
initial import
Diffstat (limited to 'abs/core-testing/udev')
-rw-r--r-- | abs/core-testing/udev/00-load-blacklist.rules | 1 | ||||
-rw-r--r-- | abs/core-testing/udev/51-arch.rules | 191 | ||||
-rw-r--r-- | abs/core-testing/udev/PKGBUILD | 82 | ||||
-rw-r--r-- | abs/core-testing/udev/arch-udev-rules.patch | 151 | ||||
-rw-r--r-- | abs/core-testing/udev/cdrom-rules.patch | 8 | ||||
-rwxr-xr-x | abs/core-testing/udev/cdsymlinks.sh | 45 | ||||
-rwxr-xr-x | abs/core-testing/udev/load-modules.sh | 60 | ||||
-rw-r--r-- | abs/core-testing/udev/migrate-udev | 29 | ||||
-rwxr-xr-x | abs/core-testing/udev/mod-blacklist.sh | 47 | ||||
-rw-r--r-- | abs/core-testing/udev/readme-udev-arch.txt | 264 | ||||
-rwxr-xr-x | abs/core-testing/udev/root-link.sh | 7 | ||||
-rwxr-xr-x | abs/core-testing/udev/start_udev | 137 | ||||
-rw-r--r-- | abs/core-testing/udev/udev.install | 22 | ||||
-rw-r--r-- | abs/core-testing/udev/udev.rules | 456 | ||||
-rw-r--r-- | abs/core-testing/udev/usb_id-fix.patch | 107 |
15 files changed, 1607 insertions, 0 deletions
diff --git a/abs/core-testing/udev/00-load-blacklist.rules b/abs/core-testing/udev/00-load-blacklist.rules new file mode 100644 index 0000000..b1a5faf --- /dev/null +++ b/abs/core-testing/udev/00-load-blacklist.rules @@ -0,0 +1 @@ +IMPORT{program} = "/lib/udev/mod-blacklist.sh" diff --git a/abs/core-testing/udev/51-arch.rules b/abs/core-testing/udev/51-arch.rules new file mode 100644 index 0000000..b06be93 --- /dev/null +++ b/abs/core-testing/udev/51-arch.rules @@ -0,0 +1,191 @@ +# Udev rules for Archlinux by Tobias Powalowski <tpowa@archlinux.org> +# do not edit this file, it will be overwritten on update +# +# This ruleset should provide a DevFS-compatible device tree. +# +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %k the kernel name for the device. +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute. +# %% the '%' char itself. +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# global stuff +# + +##################################### +###### Hotplug rules - begin +##################################### +# check if the device has already been claimed by a driver +ACTION!="add", GOTO="drivers_end" +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/lib/udev/load-modules.sh $env{MODALIAS}" + +# SCSI addon modules +SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/lib/udev/load-modules.sh sd_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/lib/udev/load-modules.sh sd_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/lib/udev/load-modules.sh sr_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/lib/udev/load-modules.sh osst" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/lib/udev/load-modules.sh st" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/lib/udev/load-modules.sh st" + +# SOUND addon modules +SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-pcm-oss" +SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-seq-oss" + +#PNP addon modules +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0800", RUN+="/lib/udev/load-modules.sh pcspkr" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0b00", RUN+="/lib/udev/load-modules.sh rtc_cmos" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="*PNP0510*", RUN+="/lib/udev/load-modules.sh irtty-sir" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="*PNP0511*", RUN+="/lib/udev/load-modules.sh irtty-sir" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNPb02f", RUN+="/lib/udev/load-modules.sh analog" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0501", RUN+="/lib/udev/load-modules.sh ppp-generic" + +# PARPORT addon modules +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh lp" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh ppdev" + +# fix ide cdrom detection on old proliant servers +SUBSYSTEM=="pci", ENV{MODALIAS}=="pci:v00000E11d00000001sv00000000sd00000000bc06sc02i00", RUN+="/lib/udev/load-modules.sh ide-generic" + +LABEL="drivers_end" +##################################### +##### Hotplug rules - end +##################################### + +##################################### +###### CD/DVD symlinks - begin +##################################### +ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", IMPORT="cdrom_id --export $tempnode" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", IMPORT="cdrom_id --export $tempnode" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="scd[a-z]", IMPORT="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", SYMLINK+="cd/cdrom-%b" +ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cd/cdrw-%b" +ENV{ID_CDROM_DVD}=="?*", SYMLINK+="cd/dvd-%b" +ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="cd/dvd-%b" +ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", RUN+="cdsymlinks.sh" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", RUN+="cdsymlinks.sh" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", RUN+="cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="hd[a-z]", RUN+="cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sr[0-9]*", RUN+="cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sg[0-9]*", RUN+="cdsymlinks.sh" +##################################### +###### CD/DVD symlinks - end +##################################### + +##################################### +# Permissions and Symlinks - begin +##################################### +# fix /dev/root symlink +SUBSYSTEM=="block", RUN+="root-link.sh" + +# permissions for IDE CD devices +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical" + +# permissions for SCSI CD devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", SYMLINK+="scd%n", GROUP="optical" +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", GROUP="optical" + +# permissions for removable devices like cardreaders or sticks +KERNEL=="sd*", ATTRS{scsi_level}=="0", ATTRS{type}=="0", GROUP="storage" + +# permissions for firewire external drives +KERNEL=="sd*", ATTRS{scsi_level}=="5", GROUP="storage" + +# permissions for usb to scsi external adapters +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", GROUP="storage" + +# permissions for ide storage like pcmcia card readers +ACTION!="add", GOTO="pcmcia_end" +SUBSYSTEM!="block", GOTO="pcmcia_end" +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="hd*", IMPORT{parent}=="ID_*" +KERNEL=="hd*", ENV{ID_TYPE}=="generic", GROUP="storage" +LABEL="pcmcia_end" + +# permissions for SCSI scanners +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="6", GROUP="scanner" + +# md block devices +KERNEL=="md[0-9]*", NAME="md%n", SYMLINK+="md/%n" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +### xorg resets those permissions, adjust your xorg.conf! +KERNEL=="nvidia*", GROUP="video" +KERNEL=="3dfx*", GROUP="video" + +# i2c devices +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" + +# loop devices +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k" + +# misc +KERNEL=="nvram", NAME="misc/%k", SYMLINK+="%k", GROUP="kmem", MODE="0640" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" + +# sound devices +# alsa devices +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midi[CD0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +# oss devices +KERNEL=="audio*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="dmmidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="admmidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="dsp*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="adsp*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="midi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="amidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="mixer*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="sequencer*", NAME="sound/%k", SYMLINK+="%k" + +# USB devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k", MODE="0666" +KERNEL=="dabusb*", NAME="usb/%k" + +# netlink devices +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +### ! disabled seems to break device creation ! +# KERNEL=="tap*", NAME="netlink/%k" + +# CAPI devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp" +KERNEL=="capi*", NAME="capi/%n", GROUP="uucp" + +# IEEE1394 (firewire) devices +KERNEL=="raw1394", NAME="%k", GROUP="video" + +# kbd devices +KERNEL=="kbd", MODE="0664" + +####################################### +# Permissions and Symlinks - end +####################################### diff --git a/abs/core-testing/udev/PKGBUILD b/abs/core-testing/udev/PKGBUILD new file mode 100644 index 0000000..7c71a08 --- /dev/null +++ b/abs/core-testing/udev/PKGBUILD @@ -0,0 +1,82 @@ +# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $ +# Maintainer: Tobias Powalowski <tpowa@archlinux.org> +# Maintainer: Thomas Bächler <thomas@archlinux.org> +pkgname=udev +pkgver=119 +pkgrel=10 +pkgdesc="The userspace dev tools (udev)" +arch=(i686 x86_64) +url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html" +license=('GPL') +groups=('base') +depends=('glibc' 'coreutils' 'util-linux') +install=udev.install +backup=(etc/udev/udev.conf + etc/scsi_id.config + etc/udev/cdsymlinks.conf + etc/modprobe.d/framebuffer_blacklist) +conflicts=('pcmcia-cs' 'hotplug') +replaces=('devfsd') +options=(!makeflags) +source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/$pkgname-$pkgver.tar.bz2 + migrate-udev start_udev 51-arch.rules load-modules.sh + cdrom-rules.patch cdsymlinks.sh root-link.sh readme-udev-arch.txt arch-udev-rules.patch) +md5sums=('dd299c16371c9e14e52d79744bccf4c0' + '49434a593918c822077bc3af765f1aff' + 'a68a519d1ed8cbbd2f45c23eb32ea218' + '082e76ef9053495a5cade321817467cd' + '945f6d30ab458189b3c17f8e6722da1f' + '5de33ba31ce52ab4da47fe3ddd3c19ea' + '8424b78e9dd772e75b4ef90814807815' + '2d6dc6842464f107bccc68cd505a6c31' + '780db5316a762dc5cdcf52027ab8a8eb' + 'fab7fa68aa35f0595c0b2bd88c4dbfd9') + +build() { + cd $startdir/src/$pkgname-$pkgver + make || return 1 + make INSTALL=/bin/install DESTDIR=$startdir/pkg install \ + EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id extras/firmware extras/floppy extras/scsi_id extras/usb_id extras/volume_id extras/path_id extras/rule_generator" + + install -D -m755 extras/path_id/path_id $startdir/pkg/sbin/path_id + install -D -m755 $startdir/src/start_udev $startdir/pkg/etc/start_udev + install -D -m755 $startdir/src/migrate-udev $startdir/pkg/sbin/migrate-udev + install -D -m644 $startdir/src/51-arch.rules $startdir/pkg/etc/udev/rules.d/51-arch.rules + # install our module loading subsystem + install -D -m755 $startdir/src/load-modules.sh $startdir/pkg/lib/udev/load-modules.sh + # install cdsymlinks.sh + install -D -m755 $startdir/src/cdsymlinks.sh $startdir/pkg/lib/udev/cdsymlinks.sh + # install root-link.sh + install -D -m755 $startdir/src/root-link.sh $startdir/pkg/lib/udev/root-link.sh + # install instructions + install -D -m644 $startdir/src/readme-udev-arch.txt $startdir/pkg/etc/udev/readme-udev-arch.txt + # add devices dir + mkdir $startdir/pkg/lib/udev/devices + # disable error loggin to prevent startup failures printed to vc on boot + sed -i -e 's|udev_log="err"|udev_log="0"|g' $startdir/pkg/etc/udev/udev.conf + # install additional rules files + install -D -m 644 $startdir/src/$pkgname-$pkgver/etc/udev/packages/40-pilot-links.rules $startdir/pkg/etc/udev/rules.d/ + install -D -m 644 $startdir/src/$pkgname-$pkgver/etc/udev/packages/64-device-mapper.rules $startdir/pkg/etc/udev/rules.d/ + install -D -m 644 $startdir/src/$pkgname-$pkgver/etc/udev/packages/64-md-raid.rules $startdir/pkg/etc/udev/rules.d/ + # fix 60-cdrom_id.rules + cd $startdir/pkg/etc/udev/rules.d/ + patch -Np0 -i $startdir/src/cdrom-rules.patch || return 1 + # fix standard udev rules to fit to arch + patch -Np0 -i $startdir/src/arch-udev-rules.patch || return 1 + # fix program paths in rules files + for i in vol_id cdrom_id ata_id scsi_id path_id edd_id usb_id; do + sed -i -e "s#$i#/lib/udev/$i#g" $startdir/pkg/etc/udev/rules.d/* + done + # fix modprobe rules to use the load-modules.sh + sed -i -e "s#/sbin/modprobe#/lib/udev/load-modules.sh#g" $startdir/pkg/etc/udev/rules.d/* + # disable persistent cdromsymlinks and network by default + mv $startdir/pkg/etc/udev/rules.d/75-persistent-net-generator.rules \ + $startdir/pkg/etc/udev/rules.d/75-persistent-net-generator.rules.optional + mv $startdir/pkg/etc/udev/rules.d/75-cd-aliases-generator.rules \ + $startdir/pkg/etc/udev/rules.d/75-cd-aliases-generator.rules.optional + # create framebuffer blacklist + mkdir -p $startdir/pkg/etc/modprobe.d/ + for mod in $(find /lib/modules/ -name '*fb*.ko' -exec basename {} .ko \;); do + echo "blacklist $mod" >> $startdir/pkg/etc/modprobe.d/framebuffer_blacklist + done +} diff --git a/abs/core-testing/udev/arch-udev-rules.patch b/abs/core-testing/udev/arch-udev-rules.patch new file mode 100644 index 0000000..fc5ede0 --- /dev/null +++ b/abs/core-testing/udev/arch-udev-rules.patch @@ -0,0 +1,151 @@ +--- 50-udev-default.rules.old 2008-03-09 17:52:59.000000000 +0100 ++++ 50-udev-default.rules 2008-03-09 17:09:50.000000000 +0100 +@@ -4,12 +4,17 @@ + KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS="last_rule" + KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" + KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" +-KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS="last_rule" +-KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS="last_rule" ++KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", NAME="vc/%n", SYMLINK+="%k" OPTIONS="last_rule" ++KERNEL=="vcs", GROUP="tty", NAME="vcc/0", OPTIONS="last_rule" ++KERNEL=="vcs[0-9]*", GROUP="tty", NAME="vcc/%n", OPTIONS="last_rule" ++KERNEL=="vcsa", GROUP="tty", NAME="vcc/a0", OPTIONS="last_rule" ++KERNEL=="vcsa[0-9]*", GROUP="tty", NAME="vcc/a%n", OPTIONS="last_rule" + KERNEL=="console", MODE="0600", OPTIONS="last_rule" + + # serial + KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" ++KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="ttyS%n" ++KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", SYMLINK+="%k" + KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" + KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" + KERNEL=="hvc*|hvsi*", GROUP="uucp" +@@ -20,8 +25,7 @@ + KERNEL=="null|zero|full|random|urandom", MODE="0666" + KERNEL=="null", SYMLINK+="XOR" + KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +-KERNEL=="ram0", SYMLINK+="ramdisk" +-KERNEL=="ram1", SYMLINK+="ram" ++KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" + + # input + KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" +@@ -30,23 +34,30 @@ + + # video4linux + KERNEL=="vbi0", SYMLINK+="vbi" ++KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" + KERNEL=="radio0", SYMLINK+="radio" ++KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" + KERNEL=="video0", SYMLINK+="video" ++KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" ++KERNEL=="vtx0", SYMLINK+="vtx" ++KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", SYMLINK+="%k", GROUP="video" + + # graphics +-KERNEL=="agpgart", MODE="0600" +-KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" ++### xorg resets those permissions, adjust your xorg.conf! ++KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k", GROUP="video", MODE="0600" ++KERNEL=="card[0-9]*", NAME="dri/%k", GROUP="video", MODE="0666" ++KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" + KERNEL=="fb0", SYMLINK+="fb" + + # DVB video +-SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" ++SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + + # Firewire +-KERNEL=="dv1394*", SYMLINK+="dv1394/%n" +-KERNEL=="video1394*", NAME="video1394/%n" ++KERNEL=="dv1394*", SYMLINK+="dv1394/%n", GROUP="video" ++KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" + + # firmware class requests +-SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" ++SUBSYSTEM=="firmware", ACTION=="add", ENV{FIRMWARE}=="?*", RUN+="firmware.sh" + + # libusb device nodes + SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" +@@ -59,23 +70,20 @@ + KERNEL=="irlpt[0-9]*", GROUP="lp" + + # block, tapes, block-releated +-SUBSYSTEM=="block", GROUP="disk", MODE="0640" +-SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" ++SUBSYSTEM=="block", GROUP="disk" + SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" + SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +-KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +-KERNEL=="fd[0-9]", GROUP="floppy" +-KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" ++KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions", GROUP="floppy" ++KERNEL=="fd[0-9]*", NAME="fd%n", SYMLINK+="floppy/%n fd%nu1440 fd%nu720 fd%nh1200 fd%nu360", GROUP="floppy" + KERNEL=="sch[0-9]*", GROUP="disk" +-KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640" + KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" + KERNEL=="pg[0-9]*", GROUP="disk" + KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" + KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" + KERNEL=="rawctl", NAME="raw/%k", GROUP="disk" + SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +-KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +-KERNEL=="pktcdvd", NAME="pktcdvd/control" ++KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="optical", MODE="0660" ++KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="optical", MODE="0660" + KERNEL=="qft0", SYMLINK+="ftape" + SUBSYSTEM=="bsg", NAME="bsg/%k" + SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk" +@@ -84,13 +92,13 @@ + KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" + + # CPU +-KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +-KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" ++KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid", SYMLINK="%k" ++KERNEL=="msr[0-9]*", NAME="cpu/%n/msr", SYMLINK="%k" + KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + + # miscellaneous + KERNEL=="fuse", MODE="0666" +-KERNEL=="rtc|rtc0", MODE="0644" ++KERNEL=="rtc*", NAME="misc/%k", SYMLINK+="%k", GROUP="audio", MODE="0664" + KERNEL=="rtc0", SYMLINK+="rtc" + KERNEL=="auer[0-9]*", NAME="usb/%k" + KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +--- 60-persistent-storage.rules.old 2008-03-09 17:52:59.000000000 +0100 ++++ 60-persistent-storage.rules 2008-03-09 15:05:13.000000000 +0100 +@@ -3,11 +3,13 @@ + # persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} + # scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de> + +-ACTION!="add|change", GOTO="persistent_storage_end" ++# needed like this!!! ++ACTION!="add|change", GOTO="persistent_storage_end" + SUBSYSTEM!="block", GOTO="persistent_storage_end" + + # skip rules for inappropriate block devices +-KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" ++# don't add dm-*!!! ++KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|md*", GOTO="persistent_storage_end" + + # never access non-cdrom removable ide devices, the drivers are causing event loops on open() + KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +--- 80-drivers.rules~ 2008-03-15 00:05:02.000000000 +0100 ++++ 80-drivers.rules 2008-03-21 21:44:28.000000000 +0100 +@@ -3,10 +3,11 @@ + ACTION!="add", GOTO="drivers_end" + + DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" +-SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ +- RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" +-SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" +-SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" ++SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", DRIVER!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/load-modules.sh pnp:d$$id; /lib/udev/load-modules.sh pnp:c$$id ; done < /sys$devpath/id'" ++SUBSYSTEM=="tifm", RUN+="/sbin/modprobe tifm_sd" ++SUBSYSTEM=="tifm", RUN+="/sbin/modprobe tifm_ms" ++SUBSYSTEM=="memstick", RUN+="/sbin/modprobe ms_block" ++SUBSYSTEM=="memstick", RUN+="/sbin/modprobe mspro_block" + SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" + SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" + SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" diff --git a/abs/core-testing/udev/cdrom-rules.patch b/abs/core-testing/udev/cdrom-rules.patch new file mode 100644 index 0000000..9b3518a --- /dev/null +++ b/abs/core-testing/udev/cdrom-rules.patch @@ -0,0 +1,8 @@ +--- 60-cdrom_id.rules.old 2006-09-07 09:57:04.000000000 +0200 ++++ 60-cdrom_id.rules 2006-09-07 11:29:31.000000000 +0200 +@@ -1,3 +1,4 @@ + # import optical drive properties + +-KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" ++KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" ++KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="path_id %p" diff --git a/abs/core-testing/udev/cdsymlinks.sh b/abs/core-testing/udev/cdsymlinks.sh new file mode 100755 index 0000000..c4185ac --- /dev/null +++ b/abs/core-testing/udev/cdsymlinks.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# Creates cdsymlinks in /dev +# for Archlinux by Tobias Powalowski <tpowa@archlinux.org> +if [ -d /dev/cd ]; then + rm /dev/cdrom* + rm /dev/cdrw* + rm /dev/dvd* + rm /dev/dvdrw* + for i in /dev/cd/cdrom-*; do + if [ -h $i ]; then + [ "$CD_NUMBER" = "" ] && ln -s $i /dev/cdrom + [ "$CD_NUMBER" = "" ] && CD_NUMBER="-1" + ! [ "$CD_NUMBER" = "" ] && CD_NUMBER="$((CD_NUMBER+1))" && ln -s $i /dev/cdrom$CD_NUMBER + fi + done + + for i in /dev/cd/cdrw-*; do + if [ -h $i ]; then + [ "$CDRW_NUMBER" = "" ] && ln -s $i /dev/cdrw + [ "$CDRW_NUMBER" = "" ] && CDRW_NUMBER="-1" + ! [ "$CDRW_NUMBER" = "" ] && CDRW_NUMBER="$((CDRW_NUMBER+1))" && ln -s $i /dev/cdrw$CDRW_NUMBER + fi + done + + for i in /dev/cd/dvd-*; do + if [ -h $i ]; then + [ "$DVD_NUMBER" = "" ] && ln -s $i /dev/dvd + [ "$DVD_NUMBER" = "" ] && DVD_NUMBER="-1" + ! [ "$DVD_NUMBER" = "" ] && DVD_NUMBER="$((DVD_NUMBER+1))" && ln -s $i /dev/dvd$DVD_NUMBER + fi + done + + for i in /dev/cd/dvdrw-*; do + if [ -h $i ]; then + [ "$DVDRW_NUMBER" = "" ] && ln -s $i /dev/dvdrw + [ "$DVDRW_NUMBER" = "" ] && DVDRW_NUMBER="-1" + ! [ "$DVDRW_NUMBER" = "" ] && DVDRW_NUMBER="$((DVDRW_NUMBER+1))" && ln -s $i /dev/dvdrw$DVDRW_NUMBER + fi + done +else + rm /dev/cdrom* + rm /dev/cdrw* + rm /dev/dvd* + rm /dev/dvdrw* +fi diff --git a/abs/core-testing/udev/load-modules.sh b/abs/core-testing/udev/load-modules.sh new file mode 100755 index 0000000..861b942 --- /dev/null +++ b/abs/core-testing/udev/load-modules.sh @@ -0,0 +1,60 @@ +#! /bin/bash +# Implement blacklisting for udev-loaded modules + +[ $# -ne 1 ] && exit 1 + +. /etc/rc.conf + +# grab modules from rc.conf +BLACKLIST="${MOD_BLACKLIST[@]}" + +if [ -f /proc/cmdline ]; then + for cmd in $(cat /proc/cmdline); do + case $cmd in + *=*) eval $cmd ;; + esac + done + #parse cmdline entries of the form "disablemodules=x,y,z" + if [ -n "$disablemodules" ]; then + BLACKLIST="$BLACKLIST $(echo $disablemodules | sed 's|,| |g')" + fi + if [ "$load_modules" == "off" ]; then + MOD_AUTOLOAD="no" + fi +fi + +#MODULES entries in rc.conf that begin with ! are blacklisted +for mod in ${MODULES[@]}; do + if [ "${mod}" != "${mod#!}" ]; then + BLACKLIST="$BLACKLIST ${mod#!}" + fi +done + + +if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then + if [ -n "$BLACKLIST" ]; then + depmods="$(/sbin/modprobe -i --show-depends $1)" + if [ $? -ne 0 ]; then + /usr/bin/logger -p info "cannot find module $1" + exit 1 + fi + + #sanitize our module names + depmods="$(echo "$depmods" | sed \ + -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" \ + -e 's|-|_|g')" + + for mod in $depmods; do + if echo $BLACKLIST | /bin/grep "\<$mod\>" 2>&1 >/dev/null; then + /usr/bin/logger -p info "udev load-modules: $1 is blacklisted" + exit 1 + fi + done + fi + /sbin/modprobe $1 +else + #/usr/bin/logger -p info \ + echo \ + "udev load-modules: autoloading is disabled, not loading $1" +fi +# vim: set et ts=4: diff --git a/abs/core-testing/udev/migrate-udev b/abs/core-testing/udev/migrate-udev new file mode 100644 index 0000000..a7a24c9 --- /dev/null +++ b/abs/core-testing/udev/migrate-udev @@ -0,0 +1,29 @@ +#!/bin/bash + +# This script will create static system-critical device nodes in your /dev +# tree so the initscripts can get by without devfs/udev long enough to start +# up devfs/udev. + +STARTDIR=`pwd` +TMPDIR=`mktemp -d` +ROOT=/ +[ "$1" != "" ] && ROOT=$1 + +mount --bind $ROOT $TMPDIR +cd $TMPDIR + +echo -n "creating device nodes: " +rm -f dev/console +rm -f dev/null +rm -f dev/zero +mknod dev/console c 5 1 +echo -n "console " +mknod -m 666 dev/null c 1 3 +echo -n "null " +mknod -m 666 dev/zero c 1 5 +echo -n "zero " +echo + +cd $STARTDIR +umount $TMPDIR +rm -rf $TMPDIR diff --git a/abs/core-testing/udev/mod-blacklist.sh b/abs/core-testing/udev/mod-blacklist.sh new file mode 100755 index 0000000..264192a --- /dev/null +++ b/abs/core-testing/udev/mod-blacklist.sh @@ -0,0 +1,47 @@ +#! /bin/bash +# Export a combined blacklist of all modules +# for use by the load-modules script +# +# NOTE: we only need bash because of rc.conf, but this +# is a one-time use script, so we're good + +. /etc/rc.conf + +# grab modules from rc.conf +BLACKLIST="${MOD_BLACKLIST[@]}" + +if [ -f /proc/cmdline ]; then + for cmd in $(cat /proc/cmdline); do + case $cmd in + *=*) eval $cmd ;; + esac + done + #parse cmdline entries of the form "disablemodules=x,y,z" + if [ -n "$disablemodules" ]; then + BLACKLIST="$BLACKLIST $(echo $disablemodules | sed 's|,| |g')" + fi + if [ "$load_modules" == "off" ]; then + MOD_AUTOLOAD="no" + fi +fi + +# blacklist framebuffer modules +DRIVER_DIR="/lib/modules/$(uname -r)/kernel/drivers/" +for x in $DRIVER_DIR/video/*/*fb*; do + BLACKLIST="$BLACKLIST $(basename $x .ko)" +done +for x in $DRIVER_DIR/video/*fb*; do + BLACKLIST="$BLACKLIST $(basename $x .ko)" +done + +#MODULES entries in rc.conf that begin with ! are blacklisted +for mod in ${MODULES[@]}; do + if [ "${mod}" != "${mod#!}" ]; then + BLACKLIST="$BLACKLIST ${mod#!}" + fi +done + +echo "MOD_AUTOLOAD=\"$MOD_AUTOLOAD\"" +echo "BLACKLIST=\"$BLACKLIST\"" + +# vim: set et ts=4: diff --git a/abs/core-testing/udev/readme-udev-arch.txt b/abs/core-testing/udev/readme-udev-arch.txt new file mode 100644 index 0000000..ac4a693 --- /dev/null +++ b/abs/core-testing/udev/readme-udev-arch.txt @@ -0,0 +1,264 @@ +========================== +Cold/Hotplugging with Udev +========================== +Version 1.1.5 +written by Tobias Powalowski <tpowa@archlinux.org> + +--------------- +* Requirements: +--------------- +- recommended kernel >=2.6.18 for this udev to work properly. +- No more DevFS device paths! If you have them, update /etc/fstab: + /dev/discs/... etc. has been deprecated in favor of the old style: + /dev/discs/disc0/part1 -> /dev/hda1 + /dev/discs/disc1/part2 -> /dev/hdb2 +- /etc/modprobe.conf should be cleaned from old install entries (see below). + +--------------- +* Udev Changes: +--------------- +- The syntax of udev rules has been changed in >=098 release, please update your rules. + --- Snip Changelog Udev 098 + Renaming of some key names: + BUS -> SUBSYSTEMS + ID -> KERNELS + SYSFS -> ATTRS + DRIVER -> DRIVERS + ATTR{file}="value" can be used now, to write to a sysfs file of the + event device. Instead of: + ..., SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" + we now can do: + ..., ATTR{type}=="0|7|14", ATTR{timeout}="60" + All the PHYSDEV* keys are deprecated and will be removed from a + future kernel: + PHYDEVPATH - is the path of a parent device and should not be + needed at all. + PHYSDEVBUS - is just a SUBSYSTEM value of a parent, and can be + matched with SUBSYSTEMS== + PHYSDEVDRIVER - for bus devices it is available as ENV{DRIVER}. + Newer kernels will have DRIVER in the environment, + for older kernels udev puts in. Class device will + no longer carry this property of a parent and + DRIVERS== can be used to match such a parent value. + Note that ENV{DRIVER} is only available for a few bus devices, where + the driver is already bound at device event time. On coldplug, the + events for a lot devices are already bound to a driver, and they will have + that value set. But on hotplug, at the time the kernel creates the device, + it can't know what driver may claim the device after that, therefore + in most cases it will be empty. + --- snap Changelog Udev 098 +- optional udev >= 099 Persistent rules generator for network and cd/dvd devices was added. + +--------------- +* How it works: +--------------- +- Udev replaces the functionality of hotplug and hwdetect scripts. +- Udev does autoloading of modules and coldplugging. +- Udev loads the modules simultaneously, which is much faster, + but can cause some troubles with multiple network/sound/etc devices + (see below). +- To reload your rules please use /etc/start_udev. + +====================== +* Autoloading modules: +====================== + +------------------------------------------------------------------------- +* Module autoloading is controlled by MOD_AUTOLOAD="" in /etc/rc.conf +------------------------------------------------------------------------- +MOD_AUTOLOAD="yes" in /etc/rc.conf is necessary: +- if you want module autodetection +- if you want modules be loaded by udev (hotplugging and coldplugging) + +MOD_AUTOLOAD="no" is necessary: +- if you want to load modules strictly using 'modprobe <module>' +- if you want to load only the modules listed in the MODULES=() array + in /etc/rc.conf + +--------------- +* Blacklisting: +--------------- +- means udev will never try to load the module, even if MOD_AUTOLOAD="yes" + is set. + +You can do this in 2 ways: +- MOD_BLACKLIST=(moduleA moduleB) +- MODULES=(!moduleA !moduleB) + +Both entries mean the same thing to udev. MOD_BLACKLIST was used by hwdetect. +hwdetect does not understand the MODULES= syntax, but it doesn't have to -- it +is only used in mkinitrd now. + +================================== +* Boot parameter: load_modules=off +================================== + +- No modules are loaded during boot using udev autoloading or the MODULES array +- Useful for repairing your system if something goes wrong during udev startup + and/or during loading modules + +================================== +* Boot parameter: disablemodules= +================================== + +- list modules there that shouldn't be loaded by udev +- Syntax: disablemodules=module1,module2,module3,... +- Useful for repairing your system if something goes wrong during udev startup + and/or during loading modules and you know the module that causes the trouble. + +======================================== +* Persistent CD/DVD symlinks (optional): +======================================== + +- To enable this feature copy in /etc/udev/rules.d + 75-cd-aliases-generator.rules.optinal + to 75-cd-aliases-generator.rules + Also disable this part in /etc/udev/rules.d/40-arch.rules by putting a # in front: + --- snip + ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", RUN+="/lib/udev/cdsymlinks.sh" + ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", RUN+="/lib/udev/cdsymlinks.sh" + ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", RUN+="/lib/udev/cdsymlinks.sh" + ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="hd[a-z]", RUN+="/lib/udev/cdsymlinks.sh" + ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sr[0-9]*", RUN+="/lib/udev/cdsymlinks.sh" + ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sg[0-9]*", RUN+="/lib/udev/cdsymlinks.sh" +--- snap + +- To get the same device name for CD/DVD symlinks each time you boot, + a rule will be generated during bootup or by executing /etc/start_udev. +- Examples: dvd, cdrom ,cdrw etc. +- If you want to change those links, + modify '/etc/udev/rules.d/70-peristent-cd.rules' to your needs. + +Known issues: +The symlink name is then bound to the hardware pci adress, +if you change your CD/DVD device, you have to check the +/etc/udev/rules.d/70-peristent-net.rules file for correctness. + +====================================== +* Persistent Network names (optional): +====================================== + +- To enable this feature copy in /etc/udev/rules.d + 75-persistent-net-generator.rules.optional + to 75-persistent-net-generator.rules +- To get the same network device name each time you boot, + a rule will be generated during bootup or by executing /etc/start_udev. +- Examples: eth0, eth1, wlan0 etc. +- If you want to change those names, + modify '/etc/udev/rules.d/70-peristent-net.rules' to your needs. +- NAME= determines the name of your network card. Use these names in your + network configuration in rc.conf as well. + +Known issues: +The interface name is then bound to the hardware mac adress, +if you change your network card, you have to check the +/etc/udev/rules.d/70-peristent-net.rules file for correctness. + +==================================== +* Known Problems Hardware: +==================================== + +- BusLogic devices are broken and will cause a freeze during startup +Solution: +This is a kernel bug and no fix has been provided yet. + +- PCMCIA Card readers are not treated as removabel devices. +Solution: +To get access to them with hal's pmount backend add them to /etc/pmount.allow + +==================================== +* Known Problems MOD_AUTOLOAD="yes": +==================================== + +----------------------------------------------------------------------------- +* Sound is not working or modules (eg. parport) are not loaded automatically: +----------------------------------------------------------------------------- +Solution: +- Do you have a clean /etc/modprobe.conf? + - A clean /etc/modprobe.conf is empty. The stock modprobe.conf file + contains nothing +- alsaconf can write output to modprobe.conf. Please keep that in mind. + +--------------------------------------------- +* Devices get mixed up eg. Network/Soundcards +--------------------------------------------- +- Because udev loads all the modules at once, sometimes devices are initialized + in different orders (eg. network cards switch eth0 and eth1, sound cards + the same) + +Solution: +- Load them in MODULES=() array in the order you need them +- eg: MODULES=(moduleA moduleB) + +Second solution for network: +- The "proper" way to configure net interfaces to hold static names within + udev rules. Add lines like these to a custom rules file such as + /etc/udev/rules.d/01-network.rules: + SUBSYSTEM=="net", SYSFS{address}=="aa:bb:cc:dd:ee:ff", NAME="lan0" + SUBSYSTEM=="net", SYSFS{address}=="ff:ee:dd:cc:bb:aa", NAME="wlan0" + +- To get the right mac address use this command: + udevinfo -a -p /sys/class/net/<yourdevice> +- Make sure you use lower-case hex values in your udev rules. +- NAME= determines the name of your network card. Use these names in your + network configuration in rc.conf as well. + +Third solution for network: +- check Persistent Network part + +----------------------------------- +* Network 8139too & 8139cp problem: +----------------------------------- +- Both modules have the same kernel entry, which can cause problems. +Solution: +- Enter the one you need in MODULES=() and blacklist the other one +- eg: MODULES=(!8139cp 8139too) +- The example tells udev to ignore 8139cp module and load 8139too afterwards. + +-------------------------------------------------------- +* You need a special loading order to get devices going: +-------------------------------------------------------- +- Kernel loads modules in wrong order. +Solution: +- Load them in the correct order in MODULES=() + +----------------------------- +* Module is not autodetected: +----------------------------- +- If your device does not provide a modalias in /sys it cannot be autodetected. +- If modalias is not combined to a kernel module it cannot be autodetected. +Known modules that are not autodetected: +- SCSI CONTROLLER: + scsi_transport_sas ultrastor qlogicfas eata BusLogic pas16 wd7000 sym53c416 + g_NCR5380_mmio fdomain u14-34f dtc initio in2000 imm t128 aha1542 aha152x + atp870u g_NCR5380 NCR53c406a qlogicfas408 megaraid_mm advansys +- NETWORK CARDS: + hp ne de4x5 wd cs89x0 eepro smc9194 seeq8005 ni52 ni65 ac3200 smc-ultra + at1700 hp-plus depca eexpress 82596 de600 eth16i de620 lance ewrk3 e2100 + lp486e 3c501 3c503 3c505 3c507 3c509 3c515 myri10ge +Solution: +- Enter the one you need in MODULES=() + +======================================= +* Known Problems with MOD_AUTOLOAD="no" +======================================= + +----------------------------------------------------------------- +* Modules are not loaded anymore during coldplug or hotplug event +----------------------------------------------------------------- +- Udev is usually responsible for this, but the MOD_AUTOLOAD switch will + now disable it. If you want automatic hot/cold-plugging, turn on + MOD_AUTOLOAD. Otherwise you will have to load all your modules manually, + either with /sbin/modprobe or entries in the MODULES=() array. +Solution: +- For bootup (coldplug) enter this in rc.conf: MODULES=(moduleA moduleB) +- After bootup (hotplug) use this: modprobe <moduleA> + +========================================= +* Known problems for custom kernel users: +========================================= + +---------------------------- +* Udev doesn't start at all: +---------------------------- +- Check Requirements list diff --git a/abs/core-testing/udev/root-link.sh b/abs/core-testing/udev/root-link.sh new file mode 100755 index 0000000..05273fe --- /dev/null +++ b/abs/core-testing/udev/root-link.sh @@ -0,0 +1,7 @@ +#! /bin/sh +# Creates root symlink in /dev +# for Arch Linux by Roman Kyrylych <Roman.Kyrylych@gmail.com> + +if ! [ -L /dev/root ]; then +ln -s $(cat /proc/cmdline | sed "s: :\n:g" | grep root= | sed "s:root=::") /dev/root +fi
\ No newline at end of file diff --git a/abs/core-testing/udev/start_udev b/abs/core-testing/udev/start_udev new file mode 100755 index 0000000..03c38fd --- /dev/null +++ b/abs/core-testing/udev/start_udev @@ -0,0 +1,137 @@ +#! /bin/sh +# +# start_udev +# script to initialize /dev by using udev. +# +# Modified for Archlinux by Tobias Powalowski <tpowa@archlinux.org> +# +# Inspired by: +# +# Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> +# +# Released under the GPL v2 only. +# +# This needs to be run at the earliest possible point in the boot +# process. +# +# Based on the udev init.d script +# +# Thanks go out to the Gentoo developers for proving +# that this is possible to do. +# +# Yes, it's very verbose, feel free to turn off all of the echo calls, +# they were there to make me feel better that everything was working +# properly during development... +# + +prog=udev +sysfs_dir=/sys +bin=/sbin/udev +udevd=/sbin/udevd +udev_root="/dev" + +starttime=$(date +%s) + + +function trigger_builtin_events() { + list="$(echo /sys/class/tty/ttyS*/uevent)" + for i in $list; do + case "$i" in + */class/uevent|*\**) + continue + ;; + */class/tty/ttyS*) + echo "add" > "$i" + ;; + esac + done + } + +function trigger_device_events() { + /sbin/udevtrigger +} + +function wait_for_queue() { +# loop=20 +# while ! [ "$loop" -gt 0 -a -d /dev/.udev/queue ]; do +# sleep 0.1; +# loop=$(($loop - 1)) +# done + /sbin/udevsettle +} + +make_extra_nodes () { + # there are a few things that sysfs does not export for us. + # these things go here (and remember to remove them in + # remove_extra_nodes() + # + # Thanks to Gentoo for the initial list of these. + ln -snf /proc/self/fd $udev_root/fd + ln -snf /proc/self/fd/0 $udev_root/stdin + ln -snf /proc/self/fd/1 $udev_root/stdout + ln -snf /proc/self/fd/2 $udev_root/stderr + ln -snf /proc/kcore $udev_root/core + + mkdir $udev_root/pts + mkdir $udev_root/shm +} + +udev_init () { +# don't use udev if sysfs is not mounted. +if [ ! -d $sysfs_dir/block ]; then + exit 1 +fi + +echo "mounting... ramfs at $udev_root" +mount -n -t ramfs none $udev_root + +# propogate /udev from /sys +echo "Creating initial udev device nodes:" + +#echo "making extra nodes" +make_extra_nodes + +# check if udevd is already running +if [ `pidof -o %PPID /sbin/udevd` ]; then + grep -v "/dev/shm" /etc/mtab | grep -v "/dev/pts" > /etc/mtab + mount /dev/pts + mount /dev/shm +else + echo "start udev daemon" + /sbin/udevd --daemon +fi +case "$(uname -r)" in + 2.6.[0-9]|2.6.[0-9][!0-9]*) ;; + *) if [ -f "/sys/class/tty/console/uevent" ]; then + echo "Kernel >= 2.6.15 and supports uevents" + # trigger the sorted events + echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug + # catch events that are real fast + mkdir -p /dev/.udev/queue + trigger_builtin_events + else + # for older kernels without uevents will be removed when udevstart dies in udev + echo "Kernel does not support uevents, you need a kernel >= 2.6.15!" + exit 1 + fi + ;; +esac +} + +udev_uevents () { +# configure all devices +trigger_device_events +# until we know how to do better, just wait for _all_ events to finish +wait_for_queue +} + +if [ $# -eq 0 ]; then +udev_init +udev_uevents +fi + +[ "$1" = "init" ] && udev_init +[ "$1" = "uevents" ] && udev_uevents + +echo "udev startup is finished! - time = $(( `date +%s` - $starttime ))" +exit 0 diff --git a/abs/core-testing/udev/udev.install b/abs/core-testing/udev/udev.install new file mode 100644 index 0000000..19d3546 --- /dev/null +++ b/abs/core-testing/udev/udev.install @@ -0,0 +1,22 @@ +# arg 1: the new package version +post_install() { + sbin/migrate-udev `pwd` +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { +if [ "$(vercmp $2 100)" -lt 0 ]; then + echo "ATTENTION UDEV:" + echo "----------" + echo "udev >=098 rules syntax has changed, please update your own rules." + echo "udev >=099 Added persistent network and CD/DVD Symlink generator rules." + echo "Please read the instructions carefully before reboot." + echo "They are located in /etc/udev/readme-udev-arch.txt" + echo "----------" +fi +} + +op=$1 +shift +$op $* diff --git a/abs/core-testing/udev/udev.rules b/abs/core-testing/udev/udev.rules new file mode 100644 index 0000000..f789e50 --- /dev/null +++ b/abs/core-testing/udev/udev.rules @@ -0,0 +1,456 @@ +# Udev rules for Archlinux by Tobias Powalowski <tpowa@archlinux.org> +# +# This ruleset should provide a DevFS-compatible device tree. +# +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %k the kernel name for the device. +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute. +# %% the '%' char itself. +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# global stuff +# + +##################################### +# Early rules - begin +##################################### +# wait for sysfs +ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# Setting timeout for tape-devices (type 1) to 900 seconds +# and 60 seconds for device types 0, 7 and 14 +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +##################################### +# Early rules -end +##################################### + +##################################### +###### Hotplug rules - begin +##################################### +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" +ACTION!="add", GOTO="hotplug_not_add_event" + +#Skip auto-loading of framebuffer devices +KERNEL=="fb[0-9]*", GOTO="hotplug_driver_loaded" + +# Modaliases to load +ENV{MODALIAS}=="?*", RUN{ignore_error}+="/lib/udev/load-modules.sh $env{MODALIAS}" + +# SCSI addon modules +SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/lib/udev/load-modules.sh sd_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/lib/udev/load-modules.sh sd_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/lib/udev/load-modules.sh sr_mod" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/lib/udev/load-modules.sh osst" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/lib/udev/load-modules.sh st" +SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/lib/udev/load-modules.sh st" +SUBSYSTEM=="scsi", ATTRS{type}=="[235689]", TEST!="[module/sg]", RUN+="/lib/udev/load-modules.sh sg" + +# load sg module for burners +SUBSYSTEM=="block", ATTRS{type}=="[45]", RUN+="/lib/udev/load-modules.sh sg" + +# MMC block devices +SUBSYSTEM=="mmc", RUN+="/lib/udev/load-modules.sh mmc_block" + +# I2O block devices +SUBSYSTEM=="i2o", RUN+="/lib/udev/load-modules.sh i2o_block" + +# Skip already claimed drivers +DRIVERS=="?*", GOTO="hotplug_driver_loaded" + +# PNP modules +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/load-modules.sh pnp:d$$id; /lib/udev/load-modules.sh pnp:c$$id ; done < /sys$devpath/id'" + +# SOUND addon modules +SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-pcm-oss" +SUBSYSTEM=="sound", RUN+="/lib/udev/load-modules.sh snd-seq-oss" + +LABEL="hotplug_driver_loaded" + +#PNP addon modules +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0800", RUN+="/lib/udev/load-modules.sh pcspkr" +# not needed anymore with kernel >= 2.6.21 +#ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0b00", RUN+="/lib/udev/load-modules.sh rtc" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0b00", RUN+="/lib/udev/load-modules.sh rtc_cmos" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="*PNP0510*", RUN+="/lib/udev/load-modules.sh irtty-sir" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="*PNP0511*", RUN+="/lib/udev/load-modules.sh irtty-sir" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNPb02f", RUN+="/lib/udev/load-modules.sh analog" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP0501", RUN+="/lib/udev/load-modules.sh ppp-generic" + +# PARPORT addon modules +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh lp" +ACTION=="add", SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", ATTRS{id}=="PNP040*", RUN+="/lib/udev/load-modules.sh ppdev" + +# fix ide cdrom detection on old proliant servers +ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="pci:v00000E11d00000001sv00000000sd00000000bc06sc02i00", RUN+="/lib/udev/load-modules.sh ide-generic" + +# FIRMWARE +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="?*", RUN+="/lib/udev/firmware.sh" +LABEL="hotplug_not_add_event" +##################################### +##### Hotplug rules - end +##################################### + +##################################### +###### CD/DVD symlinks - begin +##################################### +ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", IMPORT="/lib/udev/cdrom_id --export $tempnode" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="scd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", SYMLINK+="cd/cdrom-%b" +ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cd/cdrw-%b" +ENV{ID_CDROM_DVD}=="?*", SYMLINK+="cd/dvd-%b" +ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="cd/dvd-%b" +ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", RUN+="/lib/udev/cdsymlinks.sh" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", RUN+="/lib/udev/cdsymlinks.sh" +ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", RUN+="/lib/udev/cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="hd[a-z]", RUN+="/lib/udev/cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sr[0-9]*", RUN+="/lib/udev/cdsymlinks.sh" +ACTION=="remove", SUBSYSTEMS=="block", KERNEL=="sg[0-9]*", RUN+="/lib/udev/cdsymlinks.sh" +##################################### +###### CD/DVD symlinks - end +##################################### + +# fix /dev/root symlink +SUBSYSTEM=="block", RUN+="/lib/udev/root-link.sh" + +##################################### +# Permissions and Symlinks - begin +##################################### +# default permissions for all block devices +SUBSYSTEM=="block", GROUP="disk" + +# permissions for IDE CD devices +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", ATTRS{media}=="cdrom*", GROUP="optical" + +# permissions for SCSI CD devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", ATTRS{type}=="5", SYMLINK+="scd%n", GROUP="optical" +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="5", GROUP="optical" + +# permissions for IDE floppy devices +SUBSYSTEMS=="ide", KERNEL=="hd*", ATTRS{media}=="floppy*", NAME{all_partitions}="%k", GROUP="floppy" + +# permissions for removable devices like cardreaders or sticks +KERNEL=="sd*", ATTRS{scsi_level}=="0", ATTRS{type}=="0", GROUP="storage" + +# permissions for firewire external drives +KERNEL=="sd*", ATTRS{scsi_level}=="5", GROUP="storage" + +# permissions for usb to scsi external adapters +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", GROUP="storage" + +# permissions for ide storage like pcmcia card readers +ACTION!="add", GOTO="pcmcia_end" +SUBSYSTEM!="block", GOTO="pcmcia_end" +KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" +KERNEL=="hd*", IMPORT{parent}=="ID_*" +KERNEL=="hd*", ENV{ID_TYPE}=="generic", GROUP="storage" +LABEL="pcmcia_end" + +# permissions for SCSI scanners +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="6", GROUP="scanner" + +# pty and tty legacy devices +KERNEL=="pty[a-z][a-z,0-9]*", NAME="legacy/%k", OPTIONS="last_rule" +KERNEL=="tty[a-z][a-z,0-9]*", NAME="legacy/%k", OPTIONS="last_rule" + +# md block devices +KERNEL=="md[0-9]*", NAME="md%n", SYMLINK+="md/%n" + +# device-mapper +KERNEL=="device-mapper", NAME="mapper/control" + +# floppy devices +KERNEL=="fd[0-9]*", NAME="fd%n", SYMLINK+="floppy/%n fd%nu1440 fd%nu720 fd%nh1200 fd%nu360", GROUP="floppy" + +# tty devices +SUBSYSTEM=="tty", GROUP="tty" +KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k" +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="ttyS%n" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", SYMLINK+="%k" + +# vc devices +KERNEL=="vcs", NAME="vcc/0", OPTIONS="last_rule" +KERNEL=="vcs[0-9]*", NAME="vcc/%n", OPTIONS="last_rule" +KERNEL=="vcsa", NAME="vcc/a0", OPTIONS="last_rule" +KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", OPTIONS="last_rule" +KERNEL=="ptmx", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty", MODE="0666", OPTIONS="last_rule" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ + NAME="%c", GROUP="video" +### xorg resets those permissions, adjust your xorg.conf! +KERNEL=="nvidia*", GROUP="video" +KERNEL=="card[0-9]*", NAME="dri/%k", GROUP="video" +KERNEL=="3dfx*", GROUP="video" + +# v4l devices +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vtx0", SYMLINK+="vtx" + +# i2c devices +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" + +# loop devices +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k" + +# ramdisks +KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" + +# framebuffer devices +KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" + +# misc +KERNEL=="rtc*", NAME="misc/%k", SYMLINK+="%k", GROUP="audio", MODE="0664" +KERNEL=="rtc0", SYMLINK+="rtc" +KERNEL=="nvram", NAME="misc/%k", SYMLINK+="%k", GROUP="kmem", MODE="0640" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" GROUP="video" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0666" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid", SYMLINK="%k" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr", SYMLINK="%k" + +# sound devices +# alsa devices +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midi[CD0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +# oss devices +KERNEL=="audio*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="dmmidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="admmidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="dsp*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="adsp*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="midi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="amidi*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="mixer*", NAME="sound/%k", SYMLINK+="%k" +KERNEL=="sequencer*", NAME="sound/%k", SYMLINK+="%k" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0644" +KERNEL=="mouse*", NAME="input/%k", MODE="0644" +KERNEL=="event*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k", MODE="0664" +KERNEL=="ts*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# USB devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k", MODE="0666" +KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*", SYMLINK+="pilot" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{product}=="palmOne Handheld*", SYMLINK+="pilot" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{product}=="Handspring Visor*", SYMLINK+="pilot" + +# printer devices +SUBSYSTEM=="printer", GROUP="lp" + +# netlink devices +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +### ! disabled seems to break device creation ! +# KERNEL=="tap*", NAME="netlink/%k" + +# CAPI devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# Network devices +KERNEL=="tun", NAME="net/%k", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" + +# IEEE1394 (firewire) devices +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" + +# raw devices +KERNEL=="raw[0-9]*", NAME="raw/%k" + +# kbd devices +KERNEL=="kbd", MODE="0664" + +# packet devices +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="optical", MODE="0660" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="optical", MODE="0660" + +# usbfs-like device nodes, libusb device access +# for kernel 2.6.21 and below +SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev};printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0664" +# starting from kernel 2.6.22 use this rule +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" +####################################### +# Permissions and Symlinks - end +####################################### + +####################################### +# Persistant block device stuff - begin +####################################### +# 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> + +# needed like this!!! +ACTION!="add|change", GOTO="persistent_storage_end" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# type 8 devices are "Medium Changers" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +# don't add dm-*!!! +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|md*", GOTO="persistent_storage_end" + +# never access non-cdrom removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +ATTR{whole_disk}=="*", GOTO="persistent_storage_end" + +# /sys/class/block will export this +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/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]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_SUBSYSTEMS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="/lib/udev/usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|cciss*p[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}" + +# libata compat (links like hd*) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="/lib/udev/ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +ENV{DEVTYPE}=="disk", IMPORT{program}="/lib/udev/path_id %p" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" +KERNEL=="st*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" + +KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# by-label/by-uuid (filesystem properties) +IMPORT{program}="/lib/udev/vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +# BIOS Enhanced Disk Device +ENV{DEVTYPE}=="disk", IMPORT{program}="/lib/udev/edd_id --export $tempnode" +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" +LABEL="persistent_storage_end" + +# md links hook into "change" events, when the array becomes available +KERNEL!="md[0-9]*", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" +IMPORT{program}="/lib/udev/vol_id --export $tempnode" +OPTIONS="link_priority=100" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" +LABEL="md_end" +# Persistant block device stuff - end +##################################### + +####################################### +# Persistant input stuff - begin +####################################### +SUBSYSTEM!="input", GOTO="persistent_input_end" +ACTION!="add", GOTO="persistent_input_end" +# ignore the mid-level drivers +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +SUBSYSTEMS=="usb", IMPORT{program}="/lib/udev/usb_id --export" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" + +# other devices +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" + +# fill empty serial number +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links, generic and for the event devices +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + + +# by-path links +IMPORT{program}="/lib/udev/path_id %p" +KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_PATH}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" +##################################### +# Persistant input stuff - end +##################################### + +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" diff --git a/abs/core-testing/udev/usb_id-fix.patch b/abs/core-testing/udev/usb_id-fix.patch new file mode 100644 index 0000000..35fb2e1 --- /dev/null +++ b/abs/core-testing/udev/usb_id-fix.patch @@ -0,0 +1,107 @@ +From: Kay Sievers <kay.sievers@vrfy.org> +Date: Mon, 15 Oct 2007 18:38:20 +0000 (+0200) +Subject: usb_id: fail if vendor/product can not be retrieved +X-Git-Url: http://git.kernel.org/?p=linux%2Fhotplug%2Fudev.git;a=commitdiff_plain;h=963033472f8d2aab0bf77147b916de8f3b0b5450 + +usb_id: fail if vendor/product can not be retrieved + +Thanks to Daniel Drake for identifying the bug. +--- + +diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c +index d36a27b..5fb030d 100644 +--- a/extras/usb_id/usb_id.c ++++ b/extras/usb_id/usb_id.c +@@ -1,7 +1,5 @@ + /* +- * usb_id.c +- * +- * Identify an USB (block) device ++ * usb_id - identify an USB device + * + * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * +@@ -224,8 +222,6 @@ static int usb_id(const char *devpath) + struct sysfs_device *dev; + struct sysfs_device *dev_interface; + struct sysfs_device *dev_usb; +- const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; +- const char *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; + const char *if_class, *if_subclass; + int if_class_num; + int protocol = 0; +@@ -271,6 +267,7 @@ static int usb_id(const char *devpath) + /* mass storage */ + if (protocol == 6 && !use_usb_info) { + struct sysfs_device *dev_scsi; ++ const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + int host, bus, target, lun; + + /* get scsi device */ +@@ -321,40 +318,50 @@ static int usb_id(const char *devpath) + } + + fallback: +- /* Fallback to USB vendor & device */ ++ /* fallback to USB vendor & device */ + if (vendor_str[0] == '\0') { ++ const char *usb_vendor = NULL; ++ + if (!use_num_info) +- if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"))) +- dbg("No USB vendor string found, using idVendor"); ++ usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"); ++ ++ if (!usb_vendor) ++ usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"); + + if (!usb_vendor) { +- if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"))) { +- dbg("No USB vendor information available\n"); +- sprintf(vendor_str,"0000"); +- } ++ info("No USB vendor information available"); ++ return 1; + } +- set_str(vendor_str,usb_vendor, sizeof(vendor_str) - 1); ++ set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); + } +- ++ + if (model_str[0] == '\0') { ++ const char *usb_model = NULL; ++ + if (!use_num_info) +- if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"))) +- dbg("No USB model string found, using idProduct"); +- ++ usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"); ++ ++ if (!usb_model) ++ usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"); ++ + if (!usb_model) { +- if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"))) +- dbg("No USB model information available\n"); sprintf(model_str,"0000"); ++ dbg("No USB model information available"); ++ return 1; + } +- set_str(model_str, usb_model, sizeof(model_str) - 1); ++ set_str(model_str, usb_model, sizeof(model_str)-1); + } + + if (revision_str[0] == '\0') { ++ const char *usb_rev; ++ + usb_rev = sysfs_attr_get_value(dev_usb->devpath, "bcdDevice"); + if (usb_rev) + set_str(revision_str, usb_rev, sizeof(revision_str)-1); + } + + if (serial_str[0] == '\0') { ++ const char *usb_serial; ++ + usb_serial = sysfs_attr_get_value(dev_usb->devpath, "serial"); + if (usb_serial) + set_str(serial_str, usb_serial, sizeof(serial_str)-1); + |