diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
---|---|---|
committer | Denys Dmytriyenko <denis@denix.org> | 2009-03-17 14:32:59 -0400 |
commit | 709c4d66e0b107ca606941b988bad717c0b45d9b (patch) | |
tree | 37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/udev | |
parent | fa6cd5a3b993f16c27de4ff82b42684516d433ba (diff) |
rename packages/ to recipes/ per earlier agreement
See links below for more details:
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326
http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Acked-by: Mike Westerhof <mwester@dls.net>
Acked-by: Philip Balister <philip@balister.org>
Acked-by: Khem Raj <raj.khem@gmail.com>
Acked-by: Marcin Juszkiewicz <hrw@openembedded.org>
Acked-by: Koen Kooi <koen@openembedded.org>
Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/udev')
68 files changed, 5125 insertions, 0 deletions
diff --git a/recipes/udev/files/50-hostap_cs.rules b/recipes/udev/files/50-hostap_cs.rules new file mode 100644 index 0000000000..efefdc58fc --- /dev/null +++ b/recipes/udev/files/50-hostap_cs.rules @@ -0,0 +1,4 @@ +# hostap_cs needs ignore_cis_vcc=1 set - this should handle all cards +# +ACTION=="add", DEVICE=="hostap_cs", \ + SYSFS{func_id}=="0x06", RUN+="/sbin/modprobe hostap_cs ignore_cis_vcc=1" diff --git a/recipes/udev/files/akita/mount.blacklist b/recipes/udev/files/akita/mount.blacklist new file mode 100644 index 0000000000..7e351bc988 --- /dev/null +++ b/recipes/udev/files/akita/mount.blacklist @@ -0,0 +1,6 @@ +# This is a grep pattern matched against the device name +# Any matched pattern will _not_ be mounted / removed by udevd + +/dev/mtdblock +/dev/loop +/dev/ram
\ No newline at end of file diff --git a/recipes/udev/files/c7x0/mount.blacklist b/recipes/udev/files/c7x0/mount.blacklist new file mode 100644 index 0000000000..7e351bc988 --- /dev/null +++ b/recipes/udev/files/c7x0/mount.blacklist @@ -0,0 +1,6 @@ +# This is a grep pattern matched against the device name +# Any matched pattern will _not_ be mounted / removed by udevd + +/dev/mtdblock +/dev/loop +/dev/ram
\ No newline at end of file diff --git a/recipes/udev/files/devfs-udev.rules b/recipes/udev/files/devfs-udev.rules new file mode 100644 index 0000000000..0ba1ad4e7f --- /dev/null +++ b/recipes/udev/files/devfs-udev.rules @@ -0,0 +1,108 @@ +# The use of these rules is not recommended or supported. +# In a world where devices can come and go at any time, the devfs scheme +# of simple device enumeration does not help _anything_. Just forget about +# it. Use custom rules to name your device or look at the persistent device +# naming scheme, which is implemented for disks and add your subsystem. + +# ide block devices +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +KERNEL="vcs", NAME="vcc/0" +KERNEL="vcs[0-9]*", NAME="vcc/%n" +KERNEL="vcsa", NAME="vcc/a0" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" + +# 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" + +# misc +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" + +# alsa devices +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="dsp*", NAME="sound/%k", SYMLINK="%k" +KERNEL="midi*", 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" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +# USB devices +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]*", 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" +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" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/recipes/udev/files/fix-alignment.patch b/recipes/udev/files/fix-alignment.patch new file mode 100644 index 0000000000..8c7b8b5ac5 --- /dev/null +++ b/recipes/udev/files/fix-alignment.patch @@ -0,0 +1,24 @@ +diff --git a/udev_rules_parse.c b/udev_rules_parse.c +--- a/udev_rules_parse.c ++++ b/udev_rules_parse.c +@@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rule + int valid; + char *linepos; + char *attr; ++ size_t padding; + int retval; + + /* get all the keys */ +@@ -506,6 +507,11 @@ static int add_to_rules(struct udev_rule + + /* grow buffer and add rule */ + rule_size = sizeof(struct udev_rule) + rule->bufsize; ++ padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); ++ dbg("add %zi padding bytes", padding); ++ rule_size += padding; ++ rule->bufsize += padding; ++ + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); + if (!rules->buf) { + err("realloc failed"); + diff --git a/recipes/udev/files/init b/recipes/udev/files/init new file mode 100755 index 0000000000..a13b9afcd5 --- /dev/null +++ b/recipes/udev/files/init @@ -0,0 +1,212 @@ +#!/bin/sh + +UDEVSTART=/sbin/udevstart + +# defaults +tmpfs_size="2M" +udev_root="/dev" + +[ -x $UDEVSTART ] || exit 0 + +. /etc/udev/udev.conf + +############################################################################## + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then + return 0 + fi + + # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. + # /etc/udev/ is recycled as a temporary mount point because it's the only + # directory which is guaranteed to be available. + mount -n -o bind /dev /etc/udev + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then + umount /etc/udev + echo "udev requires tmpfs support, not started." + exit 1 + fi + + # using ln to test if /dev works, because touch is in /usr/bin/ + if ln -s test /dev/test-file; then + rm /dev/test-file + else + echo "udev requires tmpfs support, not started." + umount /etc/udev + umount /dev + exit 1 + fi + + mkdir -p /dev/.static/dev + chmod 700 /dev/.static/ + # The mount options in busybox are non-standard... + if test -x /bin/mount.util-linux + then + /bin/mount.util-linux --move /etc/udev /dev/.static/dev + elif test -x /bin/busybox + then + busybox mount -n -o move /etc/udev /dev/.static/dev + else + echo "udev requires an identifiable mount command, not started." + umount /etc/udev + umount /dev + exit 1 + fi +} + +# I hate this hack. -- Md +make_extra_nodes() { + [ -e /etc/udev/links.conf ] || return 0 + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue + case "$type" in + L) ln -s $arg1 /dev/$name ;; + D) mkdir -p /dev/$name ;; + M) mknod -m 600 /dev/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" ;; + esac + done +} + +# this function is duplicated in preinst, postinst and d-i +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;; + esac + return 0 +} + +# shell version of /usr/bin/tty +my_tty() { + [ -x /bin/readlink ] || return 0 + [ -e /proc/self/fd/0 ] || return 0 + readlink --silent /proc/self/fd/0 || true +} + +warn_if_interactive() { + if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then + return 0 + fi + + TTY=$(my_tty) + if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then + return 0 + fi + + printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" + printf "has been run from an interactive shell.\n" + printf "It will probably not do what you expect, so this script will wait\n" + printf "60 seconds before continuing. Press ^C to stop it.\n" + printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" + sleep 60 +} + +############################################################################## + +if ! supported_kernel; then + echo "udev requires a kernel >= 2.6.12, not started." + exit 1 +fi + +if [ ! -e /proc/filesystems ]; then + echo "udev requires a mounted procfs, not started." + exit 1 +fi + +if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then + echo "udev requires tmpfs support, not started." + exit 1 +fi + +if [ ! -d /sys/class/ ]; then + echo "udev requires a mounted sysfs, not started." + exit 1 +fi + +if [ ! -e /proc/sys/kernel/hotplug ] && [ ! -e /sys/kernel/uevent_helper ]; then + echo "udev requires hotplug support, not started." + exit 1 +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that +# the new /dev has been mounted and udevstart has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. + +case "$1" in + start) + if [ -e "$udev_root/.udevdb" ]; then + if mountpoint -q /dev/; then + TMPFS_MOUNTED=1 + else + echo ".udevdb already exists on the old $udev_root!" + fi + fi + warn_if_interactive + + #echo /sbin/udevsend > /proc/sys/kernel/hotplug + if [ -e /sys/kernel/uevent_helper ] ; then + echo "" > /sys/kernel/uevent_helper + else + echo "" > /proc/sys/kernel/hotplug + fi + udevsend + if [ "$UDEV_DISABLED" = "yes" ]; then + echo "udev disabled on the kernel command line, not started." + exit 0 + fi + + if [ ! "$TMPFS_MOUNTED" ]; then + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc + # if this directory is not present /dev will not be updated by udev + mkdir /dev/.udevdb/ + echo "Creating initial device nodes..." + udevstart + fi + make_extra_nodes + ;; + stop) + warn_if_interactive + start-stop-daemon --stop --exec /sbin/udevd --quiet + unmount_devpts + if [ -d /dev/.static/dev/ ]; then + umount -l /dev/.static/dev/ || true + fi + echo "Unmounting /dev..." + # unmounting with -l should never fail + if ! umount -l /dev; then + exit 1 + fi + ;; + restart|force-reload) + start-stop-daemon --stop --exec /sbin/udevd --quiet + log_begin_msg "Recreating device nodes..." + udevstart + make_extra_nodes + log_end_msg 0 + ;; + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/udev/files/links.conf b/recipes/udev/files/links.conf new file mode 100644 index 0000000000..a9f8b58b27 --- /dev/null +++ b/recipes/udev/files/links.conf @@ -0,0 +1,24 @@ +# This file does not exist. Please do not ask the debian maintainer about it. +# You may use it to do strange and wonderful things, at your risk. + +L fd /proc/self/fd +L stdin /proc/self/fd/0 +L stdout /proc/self/fd/1 +L stderr /proc/self/fd/2 +L core /proc/kcore +L sndstat /proc/asound/oss/sndstat +L MAKEDEV /sbin/MAKEDEV + +D pts +D shm + +M null c 1 3 +M console c 5 1 + +# Hic sunt leones. +M ppp c 108 0 +D loop +M loop/0 b 7 0 +D net +M net/tun c 10 200 + diff --git a/recipes/udev/files/local.rules b/recipes/udev/files/local.rules new file mode 100644 index 0000000000..5f2efbeb0c --- /dev/null +++ b/recipes/udev/files/local.rules @@ -0,0 +1,22 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" diff --git a/recipes/udev/files/mount.blacklist b/recipes/udev/files/mount.blacklist new file mode 100644 index 0000000000..d3ebb17176 --- /dev/null +++ b/recipes/udev/files/mount.blacklist @@ -0,0 +1,3 @@ +/dev/loop +/dev/ram +/dev/mtdblock diff --git a/recipes/udev/files/mount.sh b/recipes/udev/files/mount.sh new file mode 100644 index 0000000000..be8b3dfca9 --- /dev/null +++ b/recipes/udev/files/mount.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Called from udev +# Attemp to mount any added block devices +# and remove any removed devices +# + +MOUNT="/bin/mount" +PMOUNT="/usr/bin/pmount" +UMOUNT="/bin/umount" +name="`basename "$DEVNAME"`" + +for line in `cat /etc/udev/mount.blacklist | grep -v ^#` +do + if ( echo "$DEVNAME" | grep -q "$line" ) + then + logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" + exit 0 + fi +done + +automount() { + ! test -d "/media/$name" && mkdir -p "/media/$name" + + if ! $MOUNT -t auto -o sync $DEVNAME "/media/$name" + then + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" + rm_dir "/media/$name" + else + logger "mount.sh/automount" "Auto-mount of [/media/$name] successful" + touch "/tmp/.automount-$name" + fi +} + +rm_dir() { + # We do not want to rm -r populated directories + if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1" + then + ! test -z "$1" && rm -r "$1" + else + logger "mount.sh/automount" "Not removing non-empty directory [$1]" + fi +} + +if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then + if [ -x "$PMOUNT" ]; then + $PMOUNT $DEVNAME 2> /dev/null + elif [ -x $MOUNT ]; then + $MOUNT $DEVNAME 2> /dev/null + fi + + # If the device isn't mounted at this point, it isn't configured in fstab + # 20061107: Small correction: The rootfs partition may be called just "rootfs" and not by + # its true device name so this would break. If the rootfs is mounted on two places + # during boot, it confuses the heck out of fsck. So Im auto-adding the root-partition + # to /etc/udev/mount.blacklist via postinst + + cat /proc/mounts | awk '{print $1}' | grep -q "^$DEVNAME$" || automount + +fi + + + +if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then + for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` + do + $UMOUNT $mnt + done + + # Remove empty directories from auto-mounter + test -e "/tmp/.automount-$name" && rm_dir "/media/$name" +fi diff --git a/recipes/udev/files/network.sh b/recipes/udev/files/network.sh new file mode 100644 index 0000000000..182c26d86a --- /dev/null +++ b/recipes/udev/files/network.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# udevd does clearenv(). Export shell PATH to children. +export PATH + +# Do not run when pcmcia-cs is installed +test -x /sbin/cardctl && exit 0 + +# We get two "add" events for hostap cards due to wifi0 +echo "$INTERFACE" | grep -q wifi && exit 0 + + +# Check if /etc/init.d/network has been run yet to see if we are +# called by starting /etc/rcS.d/S03udev and not by hotplugging a device +# +# At this stage, network interfaces should not be brought up +# automatically because: +# a) /etc/init.d/network has not been run yet (security issue) +# b) /var has not been populated yet so /etc/resolv,conf points to +# oblivion, making the network unusable +# + +spoofp="`grep ^spoofprotect /etc/network/options`" +if test -z "$spoofp" +then + # This is the default from /etc/init.d/network + spoofp_val=yes +else + spoofp_val=${spoofp#spoofprotect=} +fi + +test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0 + +# I think it is safe to assume that "lo" will always be there ;) +if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val" +then + echo "$INTERFACE" >> /dev/udev_network_queue + exit 0 +fi + +# +# Code taken from pcmcia-cs:/etc/pcmcia/network +# + +# if this interface has an entry in /etc/network/interfaces, let ifupdown +# handle it +if grep -q "iface \+$INTERFACE" /etc/network/interfaces; then + case $ACTION in + add) + ifconfig | grep -q "^$INTERFACE" || ifup $INTERFACE + ;; + remove) + ifdown $INTERFACE + ;; + esac + + exit 0 +fi diff --git a/recipes/udev/files/noasmlinkage.patch b/recipes/udev/files/noasmlinkage.patch new file mode 100644 index 0000000000..0d8e854c0e --- /dev/null +++ b/recipes/udev/files/noasmlinkage.patch @@ -0,0 +1,38 @@ + +# +# Patch managed by http://www.holgerschurig.de/patcher.html +# + +--- udev-062/udev.c~noasmlinkage.patch ++++ udev-062/udev.c +@@ -54,7 +54,7 @@ + } + #endif + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGALRM: +--- udev-062/udevd.c~noasmlinkage.patch ++++ udev-062/udevd.c +@@ -639,7 +639,7 @@ + return msg; + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + int rc; + +--- udev-062/udevstart.c~noasmlinkage.patch ++++ udev-062/udevstart.c +@@ -323,7 +323,7 @@ + exec_list(&device_list); + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGALRM: diff --git a/recipes/udev/files/permissions.rules b/recipes/udev/files/permissions.rules new file mode 100644 index 0000000000..efbe568a2b --- /dev/null +++ b/recipes/udev/files/permissions.rules @@ -0,0 +1,79 @@ +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" + +# IDE devices +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" + +# USB devices +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0444" +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc", MODE="0660", GROUP="audio" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", MODE="0664" +KERNEL=="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + diff --git a/recipes/udev/files/slugos/mount.blacklist b/recipes/udev/files/slugos/mount.blacklist new file mode 100644 index 0000000000..d9da5cfd71 --- /dev/null +++ b/recipes/udev/files/slugos/mount.blacklist @@ -0,0 +1,5 @@ +ram[0-9]$ +mtdblock[0-9]$ +hd[a-z]$ +sd[a-z]$ +loop[0-9]$ diff --git a/recipes/udev/files/slugos/mount.sh b/recipes/udev/files/slugos/mount.sh new file mode 100644 index 0000000000..0990a7e85a --- /dev/null +++ b/recipes/udev/files/slugos/mount.sh @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Called from udev +# Attemp to mount any added block devices +# and remove any removed devices +# + +MOUNT="/bin/mount" +PMOUNT="/usr/bin/pmount" +UMOUNT="/bin/umount" +name="`basename "$DEVNAME"`" + +if ( blkid "$DEVNAME" | grep -q 'TYPE="mdraid"' ) +then + logger "udev/mount.sh" "[$DEVNAME] is a member of an array, ignoring" + exit 0 +fi + +for line in `cat /etc/udev/mount.blacklist | grep -v ^#` +do + if ( echo "$DEVNAME" | grep -q "$line" ) + then + logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" + exit 0 + fi +done + +automount() { + ! test -d "/media/$name" && mkdir -p "/media/$name" + + if ! $MOUNT -t auto -o sync $DEVNAME "/media/$name" + then + #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" + rm_dir "/media/$name" + else + logger "mount.sh/automount" "Auto-mount of [/media/$name] successful" + touch "/tmp/.automount-$name" + fi +} + +rm_dir() { + # We do not want to rm -r populated directories + if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1" + then + ! test -z "$1" && rm -r "$1" + else + logger "mount.sh/automount" "Not removing non-empty directory [$1]" + fi +} + +if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then + # SlugOS: we pivot to the rootfs based on UUID, not on fstab -- so the fstab may not + # be correct at this point in the boot. So we must not let udev mount devices based + # soley on the fstab, lest we mount overtop the real rootfs. For now we just comment + # out the logic below and let the automount logic (far below) deal with all udev mount + # operations. + #if [ -x "$PMOUNT" ]; then + # $PMOUNT $DEVNAME 2> /dev/null + #elif [ -x $MOUNT ]; then + # $MOUNT $DEVNAME 2> /dev/null + #fi + + # If the device isn't mounted at this point, it isn't configured in fstab + # 20061107: Small correction: The rootfs partition may be called just "rootfs" and not by + # its true device name so this would break. If the rootfs is mounted on two places + # during boot, it confuses the heck out of fsck. So Im auto-adding the root-partition + # to /etc/udev/mount.blacklist via postinst + + cat /proc/mounts | awk '{print $1}' | grep -q "^$DEVNAME$" || automount + +fi + + + +if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then + for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` + do + $UMOUNT $mnt + done + + # Remove empty directories from auto-mounter + test -e "/tmp/.automount-$name" && rm_dir "/media/$name" +fi diff --git a/recipes/udev/files/spitz/mount.blacklist b/recipes/udev/files/spitz/mount.blacklist new file mode 100644 index 0000000000..38c7aa4b32 --- /dev/null +++ b/recipes/udev/files/spitz/mount.blacklist @@ -0,0 +1,7 @@ +# This is a grep pattern matched against the device name +# Any matched pattern will _not_ be mounted / removed by udevd + +/dev/mtdblock +/dev/hda +/dev/loop +/dev/ram
\ No newline at end of file diff --git a/recipes/udev/files/tmpfs.patch b/recipes/udev/files/tmpfs.patch new file mode 100644 index 0000000000..9d0d8b4515 --- /dev/null +++ b/recipes/udev/files/tmpfs.patch @@ -0,0 +1,16 @@ + +# +# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher +# + +--- udev-031/extras/start_udev~tmpfs 2004-09-10 17:10:03.000000000 -0400 ++++ udev-031/extras/start_udev 2004-09-11 15:18:15.560789160 -0400 +@@ -85,7 +85,7 @@ + fi + + echo "mounting... ramfs at $udev_root" +-mount -n -t ramfs none $udev_root ++mount -n -t ramfs none $udev_root || mount -n -t tmpfs none $udev_root + + # propogate /udev from /sys + echo "Creating initial udev device nodes:" diff --git a/recipes/udev/files/tosa/mount.blacklist b/recipes/udev/files/tosa/mount.blacklist new file mode 100644 index 0000000000..7e351bc988 --- /dev/null +++ b/recipes/udev/files/tosa/mount.blacklist @@ -0,0 +1,6 @@ +# This is a grep pattern matched against the device name +# Any matched pattern will _not_ be mounted / removed by udevd + +/dev/mtdblock +/dev/loop +/dev/ram
\ No newline at end of file diff --git a/recipes/udev/files/udev.rules b/recipes/udev/files/udev.rules new file mode 100644 index 0000000000..5c566f6cef --- /dev/null +++ b/recipes/udev/files/udev.rules @@ -0,0 +1,98 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# SCSI devices +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" + +KERNEL=="buzzer", NAME="misc/buzzer" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/sbin/firmware_helper" diff --git a/recipes/udev/files/udev_network_queue.sh b/recipes/udev/files/udev_network_queue.sh new file mode 100644 index 0000000000..05e08e9d1b --- /dev/null +++ b/recipes/udev/files/udev_network_queue.sh @@ -0,0 +1,35 @@ +#! /bin/sh +# +# Copyright Matthias Hentges <devel@hentges.net> (c) 2006 +# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license) +# +# Filename: udev_network_queue.sh +# Date: 03-May-06 + +do_start() { + if test -e /dev/udev_network_queue + then + echo "Activating queued NICs..." + for NIC in `cat /dev/udev_network_queue` + do + export INTERFACE="$NIC" ; export ACTION=add + /etc/udev/scripts/network.sh + done + echo "" + else + echo "No NICs queued" + fi +} + +do_stop() { + /bin/true +} + +case "$1" in +start) do_start;; +stop) do_stop;; +restart) do_stop + do_start;; +*) echo "Usage: `basename $0` [ start | stop | restart ]" + exit 0;; +esac diff --git a/recipes/udev/files/udevsynthesize.patch b/recipes/udev/files/udevsynthesize.patch new file mode 100644 index 0000000000..7811188485 --- /dev/null +++ b/recipes/udev/files/udevsynthesize.patch @@ -0,0 +1,776 @@ +--- udev-081/udevsynthesize.c.orig 2006-01-29 12:22:45.000000000 +0100 ++++ udev-081/udevsynthesize.c 2006-01-29 12:22:40.000000000 +0100 +@@ -0,0 +1,763 @@ ++/* ++ * udevcoldplug.c ++ * ++ * Copyright (C) 2005 SUSE Linux Products GmbH ++ * ++ * Author: ++ * Kay Sievers <kay.sievers@vrfy.org> ++ * ++ * Synthesize kernel events from sysfs information and pass them ++ * to the udevd daemon. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation version 2 of the License. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#include <stdlib.h> ++#include <stddef.h> ++#include <string.h> ++#include <stdio.h> ++#include <unistd.h> ++#include <errno.h> ++#include <ctype.h> ++#include <fcntl.h> ++#include <dirent.h> ++#include <signal.h> ++#include <syslog.h> ++#include <sys/socket.h> ++#include <sys/un.h> ++#include <sys/wait.h> ++#include <sys/stat.h> ++#include <sys/types.h> ++ ++#include "udev_libc_wrapper.h" ++#include "udev.h" ++#include "udevd.h" ++#include "udev_version.h" ++#include "logging.h" ++ ++#include "list.h" ++ ++#ifndef DT_DIR ++#define DT_DIR 4 ++#endif ++ ++static const char *udev_log_str; ++static int udevd_sock = -1; ++ ++#ifdef USE_LOG ++void log_message(int priority, const char *format, ...) ++{ ++ va_list args; ++ ++ if (priority > udev_log_priority) ++ return; ++ ++ va_start(args, format); ++ vsyslog(priority, format, args); ++ va_end(args); ++} ++#endif ++ ++struct device { ++ struct list_head node; ++ struct udevd_msg msg; ++ size_t bufpos; ++ char *path; ++}; ++ ++static dev_t read_devt(const char *path) ++{ ++ char filename[PATH_SIZE]; ++ char majorminor[64]; ++ unsigned int major, minor; ++ ssize_t count; ++ int fd; ++ ++ snprintf(filename, sizeof(filename), "%s/%s", path, "dev"); ++ filename[sizeof(filename)-1] = '\0'; ++ ++ fd = open(filename, O_RDONLY); ++ if (fd < 0) ++ return 0; ++ ++ count = read(fd, majorminor, sizeof(majorminor)); ++ close(fd); ++ majorminor[count] = '\0'; ++ if (sscanf(majorminor, "%u:%u", &major, &minor) != 2) ++ return 0; ++ dbg("found major=%d, minor=%d", major, minor); ++ ++ return makedev(major, minor); ++} ++ ++static ssize_t read_file(const char *directory, const char *file, char *str, size_t len) ++{ ++ char filename[PATH_SIZE]; ++ ssize_t count; ++ int fd; ++ ++ memset(filename, 0, sizeof(filename)); ++ snprintf(filename, sizeof(filename), "%s/%s", directory, file); ++ filename[sizeof(filename)-1] = '\0'; ++ ++ fd = open(filename, O_RDONLY); ++ if (fd < 0) ++ return -1; ++ ++ count = read(fd, str, len-1); ++ close(fd); ++ ++ if (count > (ssize_t)len) ++ count = len; ++ str[count-1] = '\0'; ++ ++ return count; ++} ++ ++static ssize_t read_link(const char *directory, const char *file, char *str, size_t size) ++{ ++ char filename[PATH_SIZE]; ++ char target[PATH_SIZE]; ++ int len; ++ char *back; ++ char *strip; ++ int level = 1; ++ ++ snprintf(filename, sizeof(filename), "%s/%s", directory, file); ++ filename[sizeof(filename)-1] = '\0'; ++ ++ len = readlink(filename, target, sizeof(target)-1); ++ if (len < 0) ++ return -1; ++ target[len] = '\0'; ++ ++ back = target; ++ while (strncmp(back, "../", 3) == 0) { ++ back += 3; ++ level++; ++ } ++ while(level--) { ++ strip = strrchr(filename, '/'); ++ if (!strip) ++ return -1; ++ strip[0] = '\0'; ++ } ++ ++ snprintf(str, size, "%s/%s", filename, back); ++ str[size-1] = '\0'; ++ ++ return len; ++} ++ ++static char *add_env_key(struct device *device, const char *key, const char *value) ++{ ++ size_t pos = device->bufpos; ++ device->bufpos += sprintf(&device->msg.envbuf[device->bufpos], "%s=%s", key, value)+1; ++ return &device->msg.envbuf[pos]; ++} ++ ++static struct device *device_create(const char *path, const char *subsystem, dev_t devt) ++{ ++ struct device *device; ++ const char *devpath = &path[strlen(sysfs_path)]; ++ char target[PATH_SIZE]; ++ ++ device = malloc(sizeof(struct device)); ++ if (device == NULL) { ++ dbg("error malloc"); ++ return NULL; ++ } ++ memset(device, 0x00, sizeof(struct device)); ++ ++ device->path = add_env_key(device, "DEVPATH", devpath); ++ device->path += strlen("DEVPATH="); ++ add_env_key(device, "SUBSYSTEM", subsystem); ++ add_env_key(device, "ACTION", "add"); ++ add_env_key(device, "UDEV_COLDPLUG", "1"); ++ ++ if (major(devt)) { ++ char number[32]; ++ sprintf(number, "%u", major(devt)); ++ add_env_key(device, "MAJOR", number); ++ sprintf(number, "%u", minor(devt)); ++ add_env_key(device, "MINOR", number); ++ } ++ ++ if (strncmp(devpath, "/block/", strlen("/block/")) == 0 || ++ strncmp(devpath, "/class/", strlen("/class/")) == 0) { ++ char physpath[PATH_SIZE]; ++ ++ if (read_link(path, "device", physpath, sizeof(physpath)) > (ssize_t)strlen(sysfs_path)) { ++ add_env_key(device, "PHYSDEVPATH", &physpath[strlen(sysfs_path)]); ++ if (read_link(physpath, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { ++ char *pos = strrchr(target, '/'); ++ if (pos) ++ add_env_key(device, "PHYSDEVDRIVER", &pos[1]); ++ } ++ if (read_link(physpath, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { ++ char *pos = strrchr(target, '/'); ++ if (pos) ++ add_env_key(device, "PHYSDEVBUS", &pos[1]); ++ } ++ } ++ } else if (strncmp(devpath, "/devices/", strlen("/devices/")) == 0) { ++ if (read_link(path, "driver", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { ++ char *pos = strrchr(target, '/'); ++ if (pos) ++ add_env_key(device, "PHYSDEVDRIVER", &pos[1]); ++ } ++ if (read_link(path, "bus", target, sizeof(target)) > (ssize_t)strlen(sysfs_path)) { ++ char *pos = strrchr(target, '/'); ++ if (pos) ++ add_env_key(device, "PHYSDEVBUS", &pos[1]); ++ } ++ } ++ ++ return device; ++} ++ ++static int device_list_insert(struct list_head *device_list, struct device *device) ++{ ++ struct device *loop_device; ++ ++ dbg("insert: '%s'", device->path); ++ ++ /* sort files in lexical order */ ++ list_for_each_entry(loop_device, device_list, node) ++ if (strcmp(loop_device->path, device->path) > 0) ++ break; ++ ++ list_add_tail(&device->node, &loop_device->node); ++ ++ return 0; ++} ++ ++static int add_device_udevd(struct device *device) ++{ ++ size_t msg_len; ++ struct sockaddr_un saddr; ++ socklen_t addrlen; ++ int retval; ++ ++ memset(&saddr, 0x00, sizeof(struct sockaddr_un)); ++ saddr.sun_family = AF_LOCAL; ++ /* use abstract namespace for socket path */ ++ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); ++ addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; ++ ++ strcpy(device->msg.magic, UDEV_MAGIC); ++ device->msg.type = UDEVD_UEVENT_UDEVSEND; ++ ++ msg_len = offsetof(struct udevd_msg, envbuf) + device->bufpos; ++ dbg("msg_len=%i", msg_len); ++ ++ retval = sendto(udevd_sock, &device->msg, msg_len, 0, (struct sockaddr *)&saddr, addrlen); ++ if (retval < 0) ++ return -1; ++ ++ return 0; ++} ++ ++static void exec_list(struct list_head *device_list, const char *first[], const char *last[]) ++{ ++ struct device *loop_device; ++ struct device *tmp_device; ++ int i; ++ ++ /* handle the "first" type devices first */ ++ if (first) ++ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { ++ for (i = 0; first[i] != NULL; i++) { ++ if (strncmp(loop_device->path, first[i], strlen(first[i])) == 0) { ++ add_device_udevd(loop_device); ++ list_del(&loop_device->node); ++ free(loop_device); ++ break; ++ } ++ } ++ } ++ ++ /* handle the devices we are allowed to, excluding the "last" type devices */ ++ if (last) ++ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { ++ int found = 0; ++ for (i = 0; last[i] != NULL; i++) { ++ if (strncmp(loop_device->path, last[i], strlen(last[i])) == 0) { ++ found = 1; ++ break; ++ } ++ } ++ if (found) ++ continue; ++ ++ add_device_udevd(loop_device); ++ list_del(&loop_device->node); ++ free(loop_device); ++ } ++ ++ /* handle the rest of the devices */ ++ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { ++ add_device_udevd(loop_device); ++ list_del(&loop_device->node); ++ free(loop_device); ++ } ++} ++ ++static int udev_scan_class(void) ++{ ++ char base[PATH_SIZE]; ++ DIR *dir; ++ struct dirent *dent; ++ LIST_HEAD(device_list); ++ ++ /* we want /dev/null and /dev/console first */ ++ const char *first[] = { ++ "/class/mem", ++ "/class/tty", ++ NULL, ++ }; ++ ++ snprintf(base, sizeof(base), "%s/class", sysfs_path); ++ base[sizeof(base)-1] = '\0'; ++ ++ dir = opendir(base); ++ if (!dir) ++ return -1; ++ ++ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { ++ char dirname[PATH_SIZE]; ++ DIR *dir2; ++ struct dirent *dent2; ++ ++ if (dent->d_name[0] == '.') ++ continue; ++ ++ snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); ++ dirname[sizeof(dirname)-1] = '\0'; ++ ++ dir2 = opendir(dirname); ++ if (!dir2) ++ continue; ++ for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { ++ char dirname2[PATH_SIZE]; ++ struct device *device; ++ dev_t devt; ++ ++ if (dent2->d_name[0] == '.') ++ continue; ++ if (dent2->d_type != DT_DIR) ++ continue; ++ ++ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); ++ dirname2[sizeof(dirname2)-1] = '\0'; ++ devt = read_devt(dirname2); ++ device = device_create(dirname2, dent->d_name, devt); ++ ++ if (strcmp(dent->d_name, "net") == 0 || ++ strcmp(dent->d_name, "bluetooth") == 0) { ++ add_env_key(device, "INTERFACE", dent2->d_name); ++ } else if (strcmp(dent->d_name, "pcmcia_socket") == 0 && ++ strlen(dent->d_name) > 14) { ++ add_env_key(device, "SOCKET_NO", ++ dent2->d_name + 14); ++ } ++ ++ device_list_insert(&device_list, device); ++ } ++ closedir(dir2); ++ } ++ closedir(dir); ++ exec_list(&device_list, first, NULL); ++ ++ return 0; ++} ++ ++static int udev_scan_block(void) ++{ ++ char base[PATH_SIZE]; ++ DIR *dir; ++ struct dirent *dent; ++ LIST_HEAD(device_list); ++ ++ /* dm wants to have the block devices around before it */ ++ const char *last[] = { ++ "/block/dm", ++ NULL, ++ }; ++ ++ snprintf(base, sizeof(base), "%s/block", sysfs_path); ++ base[sizeof(base)-1] = '\0'; ++ ++ dir = opendir(base); ++ if (!dir) ++ return -1; ++ ++ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { ++ char dirname[PATH_SIZE]; ++ struct device *device; ++ struct dirent *dent2; ++ DIR *dir2; ++ dev_t devt; ++ ++ if (dent->d_name[0] == '.') ++ continue; ++ if (dent->d_type != DT_DIR) ++ continue; ++ ++ snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); ++ dirname[sizeof(dirname)-1] = '\0'; ++ devt = read_devt(dirname); ++ if (major(devt)) { ++ device = device_create(dirname, "block", devt); ++ device_list_insert(&device_list, device); ++ } ++ ++ /* look for partitions */ ++ dir2 = opendir(dirname); ++ if (!dir2) ++ continue; ++ for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { ++ char dirname2[PATH_SIZE]; ++ ++ if (dent2->d_name[0] == '.') ++ continue; ++ if (dent2->d_type != DT_DIR) ++ continue; ++ ++ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); ++ dirname2[sizeof(dirname2)-1] = '\0'; ++ devt = read_devt(dirname2); ++ if (major(devt)) { ++ device = device_create(dirname2, "block", devt); ++ device_list_insert(&device_list, device); ++ continue; ++ } ++ } ++ closedir(dir2); ++ } ++ closedir(dir); ++ exec_list(&device_list, NULL, last); ++ ++ return 0; ++} ++ ++static int pci_handler(struct device *device) ++{ ++ char path[PATH_SIZE]; ++ char value[PATH_SIZE]; ++ char vendor[PATH_SIZE]; ++ char product[PATH_SIZE]; ++ const char *name; ++ ++ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); ++ path[sizeof(path)-1] = '\0'; ++ ++ if (read_file(path, "modalias", value, sizeof(value)) > 0) ++ add_env_key(device, "MODALIAS", value); ++ ++ name = strrchr(device->path, '/'); ++ if (name) ++ add_env_key(device, "PCI_SLOT_NAME", &name[1]); ++ ++ if (read_file(path, "class", value, sizeof(value)) > 0) ++ add_env_key(device, "PCI_CLASS", &value[2]); ++ ++ if (read_file(path, "vendor", vendor, sizeof(vendor)) > 0 && ++ read_file(path, "device", product, sizeof(product)) > 0) { ++ snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "PCI_ID", value); ++ } ++ ++ if (read_file(path, "subsystem_vendor", vendor, sizeof(vendor)) > 0 && ++ read_file(path, "subsystem_device", product, sizeof(product)) > 0) { ++ snprintf(value, sizeof(value), "%s:%s", &vendor[2], &product[2]); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "PCI_SUBSYS_ID", value); ++ } ++ ++ return 0; ++} ++ ++static int usb_handler(struct device *device) ++{ ++ char path[PATH_SIZE]; ++ char value[PATH_SIZE]; ++ char str1[PATH_SIZE]; ++ char str2[PATH_SIZE]; ++ char str3[PATH_SIZE]; ++ unsigned int int1; ++ unsigned int int2; ++ unsigned int int3; ++ char *pos; ++ ++ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); ++ path[sizeof(path)-1] = '\0'; ++ ++ /* device events have : in their directory name */ ++ pos = strrchr(path, '/'); ++ if (!strchr(pos, ':')) ++ return 0; /* and do not have other variables */ ++ ++ if (read_file(path, "modalias", value, sizeof(value)) > 0) ++ add_env_key(device, "MODALIAS", value); ++ ++ if (read_file(path, "bInterfaceClass", str1, sizeof(str1)) > 0 && ++ read_file(path, "bInterfaceSubClass", str2, sizeof(str2)) > 0 && ++ read_file(path, "bInterfaceProtocol", str3, sizeof(str3)) > 0) { ++ int1 = (int) strtol(str1, NULL, 16); ++ int2 = (int) strtol(str2, NULL, 16); ++ int3 = (int) strtol(str3, NULL, 16); ++ snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "INTERFACE", value); ++ } ++ ++ /* move to the parent directory */ ++ pos[0] = '\0'; ++ ++ if (read_file(path, "idVendor", str1, sizeof(str1)) > 0 && ++ read_file(path, "idProduct", str2, sizeof(str2)) > 0 && ++ read_file(path, "bcdDevice", str3, sizeof(str3)) > 0) { ++ int1 = (int) strtol(str1, NULL, 16); ++ int2 = (int) strtol(str2, NULL, 16); ++ int3 = (int) strtol(str3, NULL, 16); ++ snprintf(value, sizeof(value), "%x/%x/%x", int1, int2, int3); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "PRODUCT", value); ++ } ++ ++ if (read_file(path, "bDeviceClass", str1, sizeof(str1)) > 0 && ++ read_file(path, "bDeviceSubClass", str2, sizeof(str2)) > 0 && ++ read_file(path, "bDeviceProtocol", str3, sizeof(str3)) > 0) { ++ int1 = (int) strtol(str1, NULL, 16); ++ int2 = (int) strtol(str2, NULL, 16); ++ int3 = (int) strtol(str3, NULL, 16); ++ snprintf(value, sizeof(value), "%u/%u/%u", int1, int2, int3); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "TYPE", value); ++ } ++ ++ if (read_file(path, "devnum", str2, sizeof(str2)) > 0) { ++ pos = strrchr(path, 'b'); ++ int1 = (int) strtol(pos + 1, NULL, 16); ++ int2 = (int) strtol(str2, NULL, 16); ++ snprintf(value, sizeof(value), ++ "/proc/bus/usb/%03d/%03d", int1, int2); ++ path[sizeof(value)-1] = '\0'; ++ add_env_key(device, "DEVICE", value); ++ } ++ ++ return 0; ++} ++ ++static int serio_handler(struct device *device) ++{ ++ char path[PATH_SIZE]; ++ char value[PATH_SIZE]; ++ ++ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); ++ path[sizeof(path)-1] = '\0'; ++ ++ if (read_file(path, "modalias", value, sizeof(value)) > 0) ++ add_env_key(device, "MODALIAS", value); ++ ++ if (read_file(path, "id/type", value, sizeof(value)) > 0) ++ add_env_key(device, "SERIO_TYPE", value); ++ ++ if (read_file(path, "id/proto", value, sizeof(value)) > 0) ++ add_env_key(device, "SERIO_PROTO", value); ++ ++ if (read_file(path, "id/id", value, sizeof(value)) > 0) ++ add_env_key(device, "SERIO_ID", value); ++ ++ if (read_file(path, "id/extra", value, sizeof(value)) > 0) ++ add_env_key(device, "SERIO_EXTRA", value); ++ ++ return 0; ++} ++ ++static int ccw_handler(struct device *device) ++{ ++ char path[PATH_SIZE]; ++ char value[PATH_SIZE], *tmp; ++ ++ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); ++ path[sizeof(path)-1] = '\0'; ++ ++ if (read_file(path, "modalias", value, sizeof(value)) > 0) ++ add_env_key(device, "MODALIAS", value); ++ ++ if (read_file(path, "cutype", value, sizeof(value)) > 0) { ++ value[4] = 0; ++ tmp = &value[5]; ++ add_env_key(device, "CU_TYPE", value); ++ add_env_key(device, "CU_MODEL", tmp); ++ } ++ ++ if (read_file(path, "devtype", value, sizeof(value)) > 0) { ++ if (value[0] == 'n') { ++ add_env_key(device, "DEV_TYPE", "0000"); ++ add_env_key(device, "DEV_MODEL", "00"); ++ } ++ else { ++ value[4] = 0; ++ tmp = &value[5]; ++ add_env_key(device, "DEV_TYPE", value); ++ add_env_key(device, "DEV_MODEL", tmp); ++ } ++ } ++ ++ return 0; ++} ++ ++static int modalias_handler(struct device *device) ++{ ++ char path[PATH_SIZE]; ++ char value[PATH_SIZE]; ++ ++ snprintf(path, sizeof(path), "%s%s", sysfs_path, device->path); ++ path[sizeof(path)-1] = '\0'; ++ ++ if (read_file(path, "modalias", value, sizeof(value)) > 0) ++ add_env_key(device, "MODALIAS", value); ++ ++ return 0; ++} ++ ++static int udev_scan_bus(const char *bus, int bus_handler(struct device *device)) ++{ ++ char base[PATH_SIZE]; ++ DIR *dir; ++ struct dirent *dent; ++ LIST_HEAD(device_list); ++ ++ snprintf(base, sizeof(base), "%s/bus/%s/devices", sysfs_path, bus); ++ base[sizeof(base)-1] = '\0'; ++ ++ dir = opendir(base); ++ if (!dir) ++ return -1; ++ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { ++ char devpath[PATH_SIZE]; ++ struct device *device; ++ ++ if (dent->d_name[0] == '.') ++ continue; ++ ++ if (read_link(base, dent->d_name, devpath, sizeof(devpath)) < 0) ++ continue; ++ ++ device = device_create(devpath, bus, makedev(0, 0)); ++ if (bus_handler) { ++ if (bus_handler(device) < 0) { ++ dbg("'%s' bus handler skipped event", devpath); ++ free(device); ++ continue; ++ } ++ } ++ ++ device_list_insert(&device_list, device); ++ } ++ closedir(dir); ++ exec_list(&device_list, NULL, NULL); ++ ++ return 0; ++} ++ ++static int udev_scan_devices(void) ++{ ++ char base[PATH_SIZE]; ++ DIR *dir; ++ struct dirent *dent; ++ ++ snprintf(base, sizeof(base), "%s/bus", sysfs_path); ++ base[sizeof(base)-1] = '\0'; ++ ++ dir = opendir(base); ++ if (!dir) ++ return -1; ++ ++ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { ++ if (dent->d_name[0] == '.') ++ continue; ++ if (dent->d_type != DT_DIR) ++ continue; ++ ++ /* add bus specific env values */ ++ if (strcmp(dent->d_name, "pci") == 0) ++ udev_scan_bus("pci", pci_handler); ++ else if (strcmp(dent->d_name, "usb") == 0) ++ udev_scan_bus("usb", usb_handler); ++ else if (strcmp(dent->d_name, "serio") == 0) ++ udev_scan_bus("serio", serio_handler); ++ else if (strcmp(dent->d_name, "ccw") == 0) ++ udev_scan_bus("ccw", ccw_handler); ++ else ++ udev_scan_bus(dent->d_name, modalias_handler); ++ } ++ closedir(dir); ++ ++ return 0; ++} ++ ++int main(int argc, char *argv[], char *envp[]) ++{ ++ LIST_HEAD(device_list); ++ int i; ++ ++ logging_init("udevcoldplug"); ++ udev_config_init(); sysfs_init(); ++ dbg("version %s", UDEV_VERSION); ++ ++ udev_log_str = getenv("UDEV_LOG"); ++ ++ /* disable all logging if not explicitely requested */ ++ if (udev_log_str == NULL) ++ udev_log_priority = 0; ++ ++ for (i = 1 ; i < argc; i++) { ++ char *arg = argv[i]; ++ ++ if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { ++ printf("Usage: udevcoldplug \n" ++ " --help print this help text\n\n"); ++ exit(0); ++ } else { ++ fprintf(stderr, "unknown option\n\n"); ++ exit(1); ++ } ++ } ++ ++ udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); ++ if (udevd_sock < 0) { ++ err("error getting socket"); ++ return 1; ++ } ++ ++ /* create nodes for already available devices */ ++ udev_scan_class(); ++ udev_scan_block(); ++ ++ /* synthesize events for bus devices ++ * may load modules or configure the device */ ++ udev_scan_devices(); ++ ++ if (udevd_sock >= 0) ++ close(udevd_sock); ++ logging_close(); ++ ++ return 0; ++} +--- udev-081/Makefile ++++ udev-081/Makefile +@@ -58,6 +58,7 @@ PROGRAMS = \ + udevmonitor \ + udevinfo \ + udevtest \ ++ udevsynthesize \ + udevstart + + HEADERS = \ diff --git a/recipes/udev/files/udevsynthesize.sh b/recipes/udev/files/udevsynthesize.sh new file mode 100644 index 0000000000..d58217c144 --- /dev/null +++ b/recipes/udev/files/udevsynthesize.sh @@ -0,0 +1,51 @@ +#!/bin/sh -e + +load_input_modules() { + for module in mousedev evdev joydev; do + modprobe -q $module || true + done +} + +if [ ! -e /sys/class/mem/null/uevent ]; then # <= 2.6.14 + /lib/udev/udevsynthesize + load_input_modules + exit 0 +fi + +# replace $IFS with something which is not likely to appear in a sysfs path, +# because some buggy drivers have spaces in their names +oldifs="$IFS" +IFS="|" + +for file in /sys/bus/*/devices/*/uevent /sys/class/*/*/uevent \ + /sys/block/*/uevent /sys/block/*/*/uevent; do + case "$file" in + */device/uevent) ;; # skip followed device symlinks + */\*/*) ;; + + */class/mem/*) # for /dev/null + first="$first${IFS}$file" ;; + + */block/md[0-9]*) + last="$last${IFS}$file" ;; + + *) + default="$default${IFS}$file" ;; + esac +done + +for file in $first${IFS}$default${IFS}$last; do + [ "$file" ] || continue + echo 'add' > "$file" || true +done + +IFS="$oldifs" + +case "$(uname -r)" in + 2.6.1[0-5]|2.6.1[0-5][!0-9]*) # <= 2.6.15 + load_input_modules + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-092/arm_inotify_fix.patch b/recipes/udev/udev-092/arm_inotify_fix.patch new file mode 100644 index 0000000000..4bd0d4d9b9 --- /dev/null +++ b/recipes/udev/udev-092/arm_inotify_fix.patch @@ -0,0 +1,17 @@ +Index: udev-092/udev_libc_wrapper.h +=================================================================== +--- udev-092.orig/udev_libc_wrapper.h 2006-07-26 21:55:06.000000000 +0100 ++++ udev-092/udev_libc_wrapper.h 2006-07-26 21:55:37.000000000 +0100 +@@ -58,9 +58,9 @@ + # define __NR_inotify_add_watch 152 + # define __NR_inotify_rm_watch 156 + #elif defined (__arm__) +-# define __NR_inotify_init 316 +-# define __NR_inotify_add_watch 317 +-# define __NR_inotify_rm_watch 318 ++# define __NR_inotify_init __NR_SYSCALL_BASE+316 ++# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 ++# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 + #elif defined (__sh__) + # define __NR_inotify_init 290 + # define __NR_inotify_add_watch 291 diff --git a/recipes/udev/udev-092/flags.patch b/recipes/udev/udev-092/flags.patch new file mode 100644 index 0000000000..492a39881c --- /dev/null +++ b/recipes/udev/udev-092/flags.patch @@ -0,0 +1,51 @@ +--- udev-089/Makefile.orig 2006-04-08 13:32:53.000000000 +0200 ++++ udev-089/Makefile 2006-04-08 13:34:27.000000000 +0200 +@@ -117,28 +117,28 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS = -Wl,-warn-common + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + +@@ -151,11 +151,11 @@ + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-092/init b/recipes/udev/udev-092/init new file mode 100644 index 0000000000..42cb8ea2ce --- /dev/null +++ b/recipes/udev/udev-092/init @@ -0,0 +1,227 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then + return + fi + + # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. + # /etc/udev/ is recycled as a temporary mount point because it's the only + # directory which is guaranteed to be available. + mount -n -o bind /dev /etc/udev + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then + umount /etc/udev + echo "udev requires tmpfs support, not started." + exit 1 + fi + + mkdir -p /dev/.static/dev + chmod 700 /dev/.static/ + # The mount options in busybox are non-standard... + if test -x /bin/mount.util-linux + then + /bin/mount.util-linux --move /etc/udev /dev/.static/dev + elif test -x /bin/busybox + then + busybox mount -n -o move /etc/udev /dev/.static/dev + else + echo "udev requires an identifiable mount command, not started." + umount /etc/udev + umount /dev + exit 1 + fi +} + +# I hate this hack. -- Md +make_extra_nodes() { + if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then + cp -a /lib/udev/devices/* /dev/ + fi + + [ -e /etc/udev/links.conf ] || return 0 + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue + case "$type" in + L) ln -s $arg1 /dev/$name ;; + D) mkdir -p /dev/$name ;; + M) mknod -m 600 /dev/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" ;; + esac + done +} + +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;; + esac + return 0 +} + +set_hotplug_handler() { + case "$(uname -r)" in + 2.6.1[0-4]|2.6.1[0-4][!0-9]*) HANDLER='/sbin/udevsend' ;; + esac + echo $HANDLER > /proc/sys/kernel/hotplug +} + +# shell version of /usr/bin/tty +my_tty() { + [ -x /bin/readlink ] || return 0 + [ -e /proc/self/fd/0 ] || return 0 + readlink --silent /proc/self/fd/0 || true +} + +warn_if_interactive() { + if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then + return + fi + + TTY=$(my_tty) + if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then + return + fi + + printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" + printf "has been run from an interactive shell.\n" + printf "It will probably not do what you expect, so this script will wait\n" + printf "60 seconds before continuing. Press ^C to stop it.\n" + printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" + sleep 60 +} + +############################################################################## + +PATH="/sbin:/bin:/usr/bin" + +[ -x /sbin/udevd ] || exit 0 + +# defaults +tmpfs_size="2M" +udev_root="/dev" +udevd_timeout=30 + +. /etc/udev/udev.conf + +if ! supported_kernel; then + echo "udev requires a kernel >= 2.6.12, not started." + exit 1 +fi + +if [ ! -e /proc/filesystems ]; then + echo "udev requires a mounted procfs, not started." + exit 1 +fi + +if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then + echo "udev requires tmpfs support, not started." + exit 1 +fi + +if [ ! -d /sys/class/ ]; then + echo "udev requires a mounted sysfs, not started." + exit 1 +fi + +if [ ! -e /proc/sys/kernel/hotplug ]; then + echo "udev requires hotplug support, not started." + exit 1 +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that +# the new /dev has been mounted and udevsynthesize has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. + +case "$1" in + start) + if [ -e "$udev_root/.udev/" ]; then + if mountpoint -q /dev/; then + TMPFS_MOUNTED=1 + else + echo ".udev/ already exists on the static $udev_root!" + fi + else + warn_if_interactive + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + + set_hotplug_handler + + if [ -z "$TMPFS_MOUNTED" ]; then + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc + fi + + # if this directory is not present /dev will not be updated by udev + mkdir -p /dev/.udev/ /dev/.udev/db/ /dev/.udev/queue/ /dev/.udevdb/ + # /dev/null must be created before udevd is started + make_extra_nodes + + echo "Synthesizing the initial hotplug events" + udevsynthesize + + # wait for the udevd childs to finish + echo "Waiting for /dev to be fully populated" + while [ -d /dev/.udev/queue/ ]; do + sleep 1 + udevd_timeout=$(($udevd_timeout - 1)) + if [ $udevd_timeout -eq 0 ]; then + # ps axf + break + fi + done + if [ $udevd_timeout -eq 0 ]; then + echo 'timeout' + fi + ;; + + stop) + echo "Stopping the hotplug events dispatcher" "udevd" + start-stop-daemon --stop --name udevd --quiet + ;; + + restart|force-reload) + echo "Stopping the hotplug events dispatcher" "udevd" + if start-stop-daemon --stop --name udevd --quiet ; then + exit 1 + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + ;; + + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-092/local.rules b/recipes/udev/udev-092/local.rules new file mode 100644 index 0000000000..5b926018f5 --- /dev/null +++ b/recipes/udev/udev-092/local.rules @@ -0,0 +1,31 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" + +# The first rtc device is symlinked to /dev/rtc +KERNEL=="rtc0", SYMLINK+="rtc" + +# Try and modprobe for drivers for new hardware +ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" diff --git a/recipes/udev/udev-092/permissions.rules b/recipes/udev/udev-092/permissions.rules new file mode 100644 index 0000000000..99e03b1036 --- /dev/null +++ b/recipes/udev/udev-092/permissions.rules @@ -0,0 +1,101 @@ +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" + +# IDE devices +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" + +# USB devices +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb_device", GROUP="plugdev", \ + SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc", GROUP="audio" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" + diff --git a/recipes/udev/udev-092/udev.rules b/recipes/udev/udev-092/udev.rules new file mode 100644 index 0000000000..72be706e84 --- /dev/null +++ b/recipes/udev/udev-092/udev.rules @@ -0,0 +1,102 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# SCSI devices +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" + +KERNEL=="buzzer", NAME="misc/buzzer" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware_helper" + +# Samsung UARTS +KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" + diff --git a/recipes/udev/udev-097/flags.patch b/recipes/udev/udev-097/flags.patch new file mode 100644 index 0000000000..492a39881c --- /dev/null +++ b/recipes/udev/udev-097/flags.patch @@ -0,0 +1,51 @@ +--- udev-089/Makefile.orig 2006-04-08 13:32:53.000000000 +0200 ++++ udev-089/Makefile 2006-04-08 13:34:27.000000000 +0200 +@@ -117,28 +117,28 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS = -Wl,-warn-common + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + +@@ -151,11 +151,11 @@ + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-097/init b/recipes/udev/udev-097/init new file mode 100644 index 0000000000..ff2ad8ef73 --- /dev/null +++ b/recipes/udev/udev-097/init @@ -0,0 +1,242 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then + return + fi + + # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. + # /etc/udev/ is recycled as a temporary mount point because it's the only + # directory which is guaranteed to be available. + mount -n -o bind /dev /etc/udev + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then + umount /etc/udev + echo "udev requires tmpfs support, not started." + exit 1 + fi + + mkdir -p /dev/.static/dev + chmod 700 /dev/.static/ + # The mount options in busybox are non-standard... + if test -x /bin/mount.util-linux + then + /bin/mount.util-linux --move /etc/udev /dev/.static/dev + elif test -x /bin/busybox + then + busybox mount -n -o move /etc/udev /dev/.static/dev + else + echo "udev requires an identifiable mount command, not started." + umount /etc/udev + umount /dev + exit 1 + fi +} + +create_dev_makedev() { + if [ -e /sbin/MAKEDEV ]; then + [ ! -e /dev/MAKEDEV ] || ln -s /sbin/MAKEDEV /dev/MAKEDEV + else + ln -s /bin/true /dev/MAKEDEV + fi +} + +# I hate this hack. -- Md +make_extra_nodes() { + if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then + cp -a /lib/udev/devices/* /dev/ + fi + + [ -e /etc/udev/links.conf ] || return 0 + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue + case "$type" in + L) ln -s $arg1 /dev/$name ;; + D) mkdir -p /dev/$name ;; + M) mknod -m 600 /dev/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" ;; + esac + done +} + +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[0-4]|2.6.1[0-4][!0-9]*) return 1 ;; + esac + return 0 +} + +load_input_modules() { + case "$(uname -r)" in + 2.6.1[0-5]|2.6.1[0-5][!0-9]*) ;; # <= 2.6.15 + *) return 0 + esac + + for module in mousedev evdev joydev; do + modprobe -q $module || true + done +} + +# shell version of /usr/bin/tty +my_tty() { + [ -x /bin/readlink ] || return 0 + [ -e /proc/self/fd/0 ] || return 0 + readlink --silent /proc/self/fd/0 || true +} + +warn_if_interactive() { + if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then + return + fi + + TTY=$(my_tty) + if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then + return + fi + + printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" + printf "has been run from an interactive shell.\n" + printf "It will probably not do what you expect, so this script will wait\n" + printf "60 seconds before continuing. Press ^C to stop it.\n" + printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" + sleep 60 +} + +############################################################################## + +[ -x /sbin/udevd ] || exit 0 + +PATH="/sbin:/bin:/usr/bin" + +# defaults +tmpfs_size="2M" +udev_root="/dev" + +if [ -e /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf +fi + +if ! supported_kernel; then + echo "udev requires a kernel >= 2.6.15, not started." + exit 1 +fi + +if [ ! -e /proc/filesystems ]; then + echo "udev requires a mounted procfs, not started." + exit 1 +fi + +if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then + echo "udev requires tmpfs support, not started." + exit 1 +fi + +if [ ! -d /sys/class/ ]; then + echo "udev requires a mounted sysfs, not started." + exit 1 +fi + +if [ ! -e /proc/sys/kernel/hotplug ]; then + echo "udev requires hotplug support, not started." + exit 1 +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that +# the new /dev has been mounted and udevsynthesize has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. + +udev_root=${udev_root%/} + +case "$1" in + start) + if [ -e "$udev_root/.udev/" ]; then + if mountpoint -q $udev_root/; then + TMPFS_MOUNTED=1 + else + echo ".udev/ already exists on the static $udev_root!" + fi + else + warn_if_interactive + fi + + echo > /proc/sys/kernel/hotplug + + if [ -z "$TMPFS_MOUNTED" ]; then + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc + fi + + # /dev/null must be created before udevd is started + make_extra_nodes + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + + # if this directory is not present /dev will not be updated by udev + mkdir -p /dev/.udev/db/ /dev/.udev/queue/ + + echo "Synthesizing the initial hotplug events" + udevtrigger + + load_input_modules + create_dev_makedev + + # wait for the udevd childs to finish + echo "Waiting for /dev to be fully populated" + if ! udevsettle; then + echo 'timeout' + fi + ;; + + stop) + echo "Stopping the hotplug events dispatcher" "udevd" + start-stop-daemon --stop --name udevd --quiet + ;; + + restart) + echo "Stopping the hotplug events dispatcher" "udevd" + if start-stop-daemon --stop --name udevd --quiet ; then + exit 1 + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + ;; + + reload) + udevcontrol reload_rules + ;; + + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-097/links.conf b/recipes/udev/udev-097/links.conf new file mode 100644 index 0000000000..ee26012039 --- /dev/null +++ b/recipes/udev/udev-097/links.conf @@ -0,0 +1,20 @@ +# This file does not exist. Please do not ask the debian maintainer about it. +# You may use it to do strange and wonderful things, at your risk. + +L fd /proc/self/fd +L stdin /proc/self/fd/0 +L stdout /proc/self/fd/1 +L stderr /proc/self/fd/2 +L core /proc/kcore +L sndstat /proc/asound/oss/sndstat + +D pts +D shm + +# Hic sunt leones. +M ppp c 108 0 +D loop +M loop/0 b 7 0 +D net +M net/tun c 10 200 + diff --git a/recipes/udev/udev-097/local.rules b/recipes/udev/udev-097/local.rules new file mode 100644 index 0000000000..5b926018f5 --- /dev/null +++ b/recipes/udev/udev-097/local.rules @@ -0,0 +1,31 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" + +# The first rtc device is symlinked to /dev/rtc +KERNEL=="rtc0", SYMLINK+="rtc" + +# Try and modprobe for drivers for new hardware +ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" diff --git a/recipes/udev/udev-097/permissions.rules b/recipes/udev/udev-097/permissions.rules new file mode 100644 index 0000000000..99e03b1036 --- /dev/null +++ b/recipes/udev/udev-097/permissions.rules @@ -0,0 +1,101 @@ +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" + +# IDE devices +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" + +# USB devices +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb_device", GROUP="plugdev", \ + SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc", GROUP="audio" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" + diff --git a/recipes/udev/udev-097/udev.rules b/recipes/udev/udev-097/udev.rules new file mode 100644 index 0000000000..27c4cb86ce --- /dev/null +++ b/recipes/udev/udev-097/udev.rules @@ -0,0 +1,102 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# SCSI devices +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" + +KERNEL=="buzzer", NAME="misc/buzzer" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh" + +# Samsung UARTS +KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" + diff --git a/recipes/udev/udev-100/flags.patch b/recipes/udev/udev-100/flags.patch new file mode 100644 index 0000000000..492a39881c --- /dev/null +++ b/recipes/udev/udev-100/flags.patch @@ -0,0 +1,51 @@ +--- udev-089/Makefile.orig 2006-04-08 13:32:53.000000000 +0200 ++++ udev-089/Makefile 2006-04-08 13:34:27.000000000 +0200 +@@ -117,28 +117,28 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS = -Wl,-warn-common + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + +@@ -151,11 +151,11 @@ + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-100/init b/recipes/udev/udev-100/init new file mode 100644 index 0000000000..ff2ad8ef73 --- /dev/null +++ b/recipes/udev/udev-100/init @@ -0,0 +1,242 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then + return + fi + + # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. + # /etc/udev/ is recycled as a temporary mount point because it's the only + # directory which is guaranteed to be available. + mount -n -o bind /dev /etc/udev + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then + umount /etc/udev + echo "udev requires tmpfs support, not started." + exit 1 + fi + + mkdir -p /dev/.static/dev + chmod 700 /dev/.static/ + # The mount options in busybox are non-standard... + if test -x /bin/mount.util-linux + then + /bin/mount.util-linux --move /etc/udev /dev/.static/dev + elif test -x /bin/busybox + then + busybox mount -n -o move /etc/udev /dev/.static/dev + else + echo "udev requires an identifiable mount command, not started." + umount /etc/udev + umount /dev + exit 1 + fi +} + +create_dev_makedev() { + if [ -e /sbin/MAKEDEV ]; then + [ ! -e /dev/MAKEDEV ] || ln -s /sbin/MAKEDEV /dev/MAKEDEV + else + ln -s /bin/true /dev/MAKEDEV + fi +} + +# I hate this hack. -- Md +make_extra_nodes() { + if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then + cp -a /lib/udev/devices/* /dev/ + fi + + [ -e /etc/udev/links.conf ] || return 0 + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue + case "$type" in + L) ln -s $arg1 /dev/$name ;; + D) mkdir -p /dev/$name ;; + M) mknod -m 600 /dev/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" ;; + esac + done +} + +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[0-4]|2.6.1[0-4][!0-9]*) return 1 ;; + esac + return 0 +} + +load_input_modules() { + case "$(uname -r)" in + 2.6.1[0-5]|2.6.1[0-5][!0-9]*) ;; # <= 2.6.15 + *) return 0 + esac + + for module in mousedev evdev joydev; do + modprobe -q $module || true + done +} + +# shell version of /usr/bin/tty +my_tty() { + [ -x /bin/readlink ] || return 0 + [ -e /proc/self/fd/0 ] || return 0 + readlink --silent /proc/self/fd/0 || true +} + +warn_if_interactive() { + if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then + return + fi + + TTY=$(my_tty) + if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then + return + fi + + printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" + printf "has been run from an interactive shell.\n" + printf "It will probably not do what you expect, so this script will wait\n" + printf "60 seconds before continuing. Press ^C to stop it.\n" + printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" + sleep 60 +} + +############################################################################## + +[ -x /sbin/udevd ] || exit 0 + +PATH="/sbin:/bin:/usr/bin" + +# defaults +tmpfs_size="2M" +udev_root="/dev" + +if [ -e /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf +fi + +if ! supported_kernel; then + echo "udev requires a kernel >= 2.6.15, not started." + exit 1 +fi + +if [ ! -e /proc/filesystems ]; then + echo "udev requires a mounted procfs, not started." + exit 1 +fi + +if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then + echo "udev requires tmpfs support, not started." + exit 1 +fi + +if [ ! -d /sys/class/ ]; then + echo "udev requires a mounted sysfs, not started." + exit 1 +fi + +if [ ! -e /proc/sys/kernel/hotplug ]; then + echo "udev requires hotplug support, not started." + exit 1 +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that +# the new /dev has been mounted and udevsynthesize has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. + +udev_root=${udev_root%/} + +case "$1" in + start) + if [ -e "$udev_root/.udev/" ]; then + if mountpoint -q $udev_root/; then + TMPFS_MOUNTED=1 + else + echo ".udev/ already exists on the static $udev_root!" + fi + else + warn_if_interactive + fi + + echo > /proc/sys/kernel/hotplug + + if [ -z "$TMPFS_MOUNTED" ]; then + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc + fi + + # /dev/null must be created before udevd is started + make_extra_nodes + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + + # if this directory is not present /dev will not be updated by udev + mkdir -p /dev/.udev/db/ /dev/.udev/queue/ + + echo "Synthesizing the initial hotplug events" + udevtrigger + + load_input_modules + create_dev_makedev + + # wait for the udevd childs to finish + echo "Waiting for /dev to be fully populated" + if ! udevsettle; then + echo 'timeout' + fi + ;; + + stop) + echo "Stopping the hotplug events dispatcher" "udevd" + start-stop-daemon --stop --name udevd --quiet + ;; + + restart) + echo "Stopping the hotplug events dispatcher" "udevd" + if start-stop-daemon --stop --name udevd --quiet ; then + exit 1 + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + ;; + + reload) + udevcontrol reload_rules + ;; + + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-100/links.conf b/recipes/udev/udev-100/links.conf new file mode 100644 index 0000000000..ee26012039 --- /dev/null +++ b/recipes/udev/udev-100/links.conf @@ -0,0 +1,20 @@ +# This file does not exist. Please do not ask the debian maintainer about it. +# You may use it to do strange and wonderful things, at your risk. + +L fd /proc/self/fd +L stdin /proc/self/fd/0 +L stdout /proc/self/fd/1 +L stderr /proc/self/fd/2 +L core /proc/kcore +L sndstat /proc/asound/oss/sndstat + +D pts +D shm + +# Hic sunt leones. +M ppp c 108 0 +D loop +M loop/0 b 7 0 +D net +M net/tun c 10 200 + diff --git a/recipes/udev/udev-100/local.rules b/recipes/udev/udev-100/local.rules new file mode 100644 index 0000000000..5b926018f5 --- /dev/null +++ b/recipes/udev/udev-100/local.rules @@ -0,0 +1,31 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" + +# The first rtc device is symlinked to /dev/rtc +KERNEL=="rtc0", SYMLINK+="rtc" + +# Try and modprobe for drivers for new hardware +ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" diff --git a/recipes/udev/udev-100/permissions.rules b/recipes/udev/udev-100/permissions.rules new file mode 100644 index 0000000000..99e03b1036 --- /dev/null +++ b/recipes/udev/udev-100/permissions.rules @@ -0,0 +1,101 @@ +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" + +# IDE devices +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" + +# USB devices +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb_device", GROUP="plugdev", \ + SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc", GROUP="audio" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" + diff --git a/recipes/udev/udev-100/udev.rules b/recipes/udev/udev-100/udev.rules new file mode 100644 index 0000000000..27c4cb86ce --- /dev/null +++ b/recipes/udev/udev-100/udev.rules @@ -0,0 +1,102 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# SCSI devices +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" + +KERNEL=="buzzer", NAME="misc/buzzer" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh" + +# Samsung UARTS +KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" + diff --git a/recipes/udev/udev-118/flags.patch b/recipes/udev/udev-118/flags.patch new file mode 100644 index 0000000000..13f20eb6a8 --- /dev/null +++ b/recipes/udev/udev-118/flags.patch @@ -0,0 +1,56 @@ +--- + Makefile | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +Index: udev-115/Makefile +=================================================================== +--- udev-115.orig/Makefile 2007-08-24 01:29:54.000000000 +0200 ++++ udev-115/Makefile 2007-09-20 17:21:45.000000000 +0200 +@@ -112,39 +112,39 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS += -Wl,-warn-common,--as-needed + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-118/init b/recipes/udev/udev-118/init new file mode 100644 index 0000000000..e44c675f2f --- /dev/null +++ b/recipes/udev/udev-118/init @@ -0,0 +1,171 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then + return + fi + + # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. + # /etc/udev/ is recycled as a temporary mount point because it's the only + # directory which is guaranteed to be available. + mount -n -o bind /dev /etc/udev + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs udev /dev; then + umount /etc/udev + echo "udev requires tmpfs support, not started." + exit 1 + fi + + mkdir -p /dev/.static/dev + chmod 700 /dev/.static/ + # The mount options in busybox are non-standard... + if test -x /bin/mount.util-linux + then + /bin/mount.util-linux --move /etc/udev /dev/.static/dev + elif test -x /bin/busybox + then + busybox mount -n -o move /etc/udev /dev/.static/dev + else + echo "udev requires an identifiable mount command, not started." + umount /etc/udev + umount /dev + exit 1 + fi +} + +make_extra_nodes() { + [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3 +# I hate this hack. -- Md + if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then + cp -a /lib/udev/devices/* /dev/ + fi + + [ -e /etc/udev/links.conf ] || return 0 + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue + case "$type" in + L) ln -s $arg1 /dev/$name ;; + D) mkdir -p /dev/$name ;; + M) mknod -m 600 /dev/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" ;; + esac + done +} + +supported_kernel() { + case "$(uname -r)" in + 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; + 2.6.1[0134]|2.6.1[01234][!0-9]*) return 1 ;; + esac + return 0 +} + +# shell version of /usr/bin/tty +my_tty() { + [ -x /bin/readlink ] || return 0 + [ -e /proc/self/fd/0 ] || return 0 + readlink --silent /proc/self/fd/0 || true +} + +############################################################################## + +PATH="/sbin:/bin:/usr/bin" + +[ -x /sbin/udevd ] || exit 0 + +# defaults +tmpfs_size="2M" + +. /etc/udev/udev.conf + +if ! supported_kernel; then + echo "udev requires a kernel >= 2.6.15, not started." + exit 1 +fi + +if [ ! -e /proc/filesystems ]; then + echo "udev requires a mounted procfs, not started." + exit 1 +fi + +if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then + echo "udev requires tmpfs support, not started." + exit 1 +fi + +if [ ! -d /sys/class/ ]; then + echo "udev requires a mounted sysfs, not started." + exit 1 +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that +# the new /dev has been mounted and udevsynthesize has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. +case "$1" in + start) + unmount_devpts + mount_tmpfs + [ -d /proc/1 ] || mount -n /proc + + # /dev/null must be created before udevd is started + make_extra_nodes + + # It's all over netlink now + if [ -e /proc/sys/kernel/hotplug ]; then + echo "" > /proc/sys/kernel/hotplug + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + + echo "Synthesizing the initial hotplug events" + udevtrigger + udevsettle + ;; + + stop) + echo "Stopping the hotplug events dispatcher" "udevd" + start-stop-daemon --stop --name udevd --quiet + ;; + + restart|force-reload) + echo "Stopping the hotplug events dispatcher" "udevd" + if start-stop-daemon --stop --name udevd --quiet ; then + exit 1 + fi + + echo "Starting the hotplug events dispatcher" "udevd" + udevd --daemon + ;; + + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-118/local.rules b/recipes/udev/udev-118/local.rules new file mode 100644 index 0000000000..5b926018f5 --- /dev/null +++ b/recipes/udev/udev-118/local.rules @@ -0,0 +1,31 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" + +# The first rtc device is symlinked to /dev/rtc +KERNEL=="rtc0", SYMLINK+="rtc" + +# Try and modprobe for drivers for new hardware +ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" diff --git a/recipes/udev/udev-118/openmoko/init b/recipes/udev/udev-118/openmoko/init new file mode 100644 index 0000000000..e8b2cc57f0 --- /dev/null +++ b/recipes/udev/udev-118/openmoko/init @@ -0,0 +1,177 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountkernfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +# This script is based on Debian's. + +COLDPLUG=no +COLDPLUG_TARBALL="/lib/udev/devices.tar.gz" + +for x in $(cat /proc/cmdline); do + case $x in + coldplug) + COLDPLUG=yes + ;; + esac +done + +# we need to unmount /dev/pts/ and remount it later over the tmpfs +unmount_devpts() { + if mountpoint -q /dev/pts/; then + umount -n -l /dev/pts/ + fi + + if mountpoint -q /dev/shm/; then + umount -n -l /dev/shm/ + fi +} + +# mount a tmpfs over /dev, if somebody did not already do it +mount_tmpfs() { + if grep -q "/dev tmpfs" /proc/mounts; then + return + fi + + if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs udev /dev; then + echo "udev requires tmpfs support, not started." + exit 1 + fi + + return 0 +} + +create_dev_makedev() { + if [ -e /sbin/MAKEDEV ]; then + ln -sf /sbin/MAKEDEV /dev/MAKEDEV + else + ln -sf /bin/true /dev/MAKEDEV + fi +} + +make_extra_nodes() { + ret=1 + if [ "$(echo /lib/udev/devices/*)" != "/lib/udev/devices/*" ]; then + cp -a /lib/udev/devices/* /$1/ + ret=0 + fi + + [ -e /etc/udev/links.conf ] || return $ret + + grep '^[^#]' /etc/udev/links.conf | \ + while read type name arg1; do + [ "$type" -a "$name" -a ! -e "/$1/$name" -a ! -L "/$1/$name" ] || continue + case "$type" in + L) ln -s $arg1 /$1/$name ;; + D) mkdir -p /$1/$name ;; + M) mknod -m 600 /$1/$name $arg1 ;; + *) echo "links.conf: unparseable line ($type $name $arg1)" >&2 ;; + esac + done + + return $ret +} + +############################################################################## + +[ -x /sbin/udevd ] || exit 0 + +PATH="/sbin:/bin" + +# defaults +tmpfs_size="2M" +udev_root="/dev" + +if [ -e /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf +fi + +############################################################################## + +# When modifying this script, do not forget that between the time that the +# new /dev has been mounted and udevadm trigger has been run there will be +# no /dev/null. This also means that you cannot use the "&" shell command. + +case "$1" in + start) + if [ -e "$udev_root/.udev/" ]; then + if mountpoint -q $udev_root/; then + TMPFS_MOUNTED=1 + else + echo ".udev/ already exists on the static $udev_root!" + fi + fi + + echo > /sys/kernel/uevent_helper + + if [ -z "$TMPFS_MOUNTED" ]; then + unmount_devpts + mount_tmpfs + else + # and clean up the database of the initramfs udev + rm -rf /dev/.udev/ + fi + + # /dev/null must be created before udevd is started + if ! make_extra_nodes "$udev_root"; then + COLDPLUG=yes + fi + if [ ! -f "$COLDPLUG_TARBALL" ]; then + COLDPLUG=yes + fi + + # if this directory is not present /dev will not be updated by udev + mkdir -p /dev/.udev/db/ + + echo "Startting the hotplug events dispatcher" + udevd --daemon + + mkdir -p /dev/.udev/queue/ /dev/.udev/rules.d/ + + create_dev_makedev + + if [ $COLDPLUG != "no" ]; then + echo "Synthesizing the initial hotplug events" + udevadm trigger + + # wait for the udevd childs to finish + echo "Waiting for /dev to be fully populated" + if udevadm settle; then + echo 'done' + else + echo 'timeout' + fi + fi + + ;; + + stop) + echo "Stopping the hotplug events dispatcher" + start-stop-daemon --stop --name udevd --quiet --oknodo + ;; + + restart) + echo "Stopping the hotplug events dispatcher" + start-stop-daemon --stop --name udevd --quiet --oknodo + + echo "Startting the hotplug events dispatcher" + udevd --daemon + ;; + + reload|force-reload) + udevadm control --reload_rules + ;; + + *) + echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/recipes/udev/udev-118/permissions.rules b/recipes/udev/udev-118/permissions.rules new file mode 100644 index 0000000000..99e03b1036 --- /dev/null +++ b/recipes/udev/udev-118/permissions.rules @@ -0,0 +1,101 @@ +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" + +# IDE devices +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" + +# USB devices +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb_device", GROUP="plugdev", \ + SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc", GROUP="audio" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" + diff --git a/recipes/udev/udev-118/udev.rules b/recipes/udev/udev-118/udev.rules new file mode 100644 index 0000000000..72be706e84 --- /dev/null +++ b/recipes/udev/udev-118/udev.rules @@ -0,0 +1,102 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# SCSI devices +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'export X=%k; export X=$${X#usbdev}; export B=$${X%%%%.*}; export D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" + +KERNEL=="buzzer", NAME="misc/buzzer" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware_helper" + +# Samsung UARTS +KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" + diff --git a/recipes/udev/udev-118/udevtrigger_add_devname_filtering.patch b/recipes/udev/udev-118/udevtrigger_add_devname_filtering.patch new file mode 100644 index 0000000000..87cafcaa9d --- /dev/null +++ b/recipes/udev/udev-118/udevtrigger_add_devname_filtering.patch @@ -0,0 +1,104 @@ +--- + udevtrigger.c | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +Index: udev-115/udevtrigger.c +=================================================================== +--- udev-115.orig/udevtrigger.c 2007-08-24 01:29:54.000000000 +0200 ++++ udev-115/udevtrigger.c 2007-09-21 18:45:28.000000000 +0200 +@@ -39,6 +39,8 @@ + LIST_HEAD(device_list); + LIST_HEAD(filter_subsystem_match_list); + LIST_HEAD(filter_subsystem_nomatch_list); ++LIST_HEAD(filter_kernel_match_list); ++LIST_HEAD(filter_kernel_nomatch_list); + LIST_HEAD(filter_attr_match_list); + LIST_HEAD(filter_attr_nomatch_list); + +@@ -218,6 +220,26 @@ + return 0; + } + ++static int kernel_filtered(const char *kernel) ++{ ++ struct name_entry *loop_name; ++ ++ /* skip devices matching the prohibited kernel device names */ ++ list_for_each_entry(loop_name, &filter_kernel_nomatch_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 1; ++ ++ /* skip devices not matching the listed kernel device names */ ++ if (!list_empty(&filter_kernel_match_list)) { ++ list_for_each_entry(loop_name, &filter_kernel_match_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 0; ++ return 1; ++ } ++ ++ return 0; ++} ++ + static int attr_filtered(const char *path) + { + struct name_entry *loop_name; +@@ -296,6 +318,9 @@ + if (dent2->d_name[0] == '.') + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -402,6 +427,9 @@ + if (!strcmp(dent2->d_name, "device")) + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -458,6 +486,8 @@ + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, ++ { "kernel-match", 1, NULL, 'k' }, ++ { "kernel-nomatch", 1, NULL, 'K' }, + {} + }; + +@@ -496,6 +526,12 @@ + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; ++ case 'k': ++ name_list_add(&filter_kernel_match_list, optarg, 0); ++ break; ++ case 'K': ++ name_list_add(&filter_kernel_nomatch_list, optarg, 0); ++ break; + case 'h': + printf("Usage: udevtrigger OPTIONS\n" + " --verbose print the list of devices while running\n" +@@ -504,6 +540,8 @@ + " marked as failed during a previous run\n" + " --subsystem-match=<subsystem> trigger devices from a matching subystem\n" + " --subsystem-nomatch=<subsystem> exclude devices from a matching subystem\n" ++ " --kernel-match=<subsystem> trigger devices from a matching kernel device name\n" ++ " --kernel-nomatch=<subsystem> exclude devices from a matching kernel device name\n" + " --attr-match=<file[=<value>]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=<file[=<value>]> exclude devices with a matching sysfs\n" +@@ -549,6 +587,8 @@ + exit: + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); ++ name_list_cleanup(&filter_kernel_match_list); ++ name_list_cleanup(&filter_kernel_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + diff --git a/recipes/udev/udev-118/vol_id_ld.patch b/recipes/udev/udev-118/vol_id_ld.patch new file mode 100644 index 0000000000..11126eef8d --- /dev/null +++ b/recipes/udev/udev-118/vol_id_ld.patch @@ -0,0 +1,17 @@ +--- + extras/volume_id/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: udev-115/extras/volume_id/Makefile +=================================================================== +--- udev-115.orig/extras/volume_id/Makefile 2007-09-20 18:17:59.000000000 +0200 ++++ udev-115/extras/volume_id/Makefile 2007-09-20 18:18:08.000000000 +0200 +@@ -44,7 +44,7 @@ + ifeq ($(strip $(VOLUME_ID_STATIC)),true) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) + else +- $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) ++ $(Q) $(LD) -Llib $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -lvolume_id $(LIB_OBJS) + endif + + # man pages diff --git a/recipes/udev/udev-124/flags.patch b/recipes/udev/udev-124/flags.patch new file mode 100644 index 0000000000..13f20eb6a8 --- /dev/null +++ b/recipes/udev/udev-124/flags.patch @@ -0,0 +1,56 @@ +--- + Makefile | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +Index: udev-115/Makefile +=================================================================== +--- udev-115.orig/Makefile 2007-08-24 01:29:54.000000000 +0200 ++++ udev-115/Makefile 2007-09-20 17:21:45.000000000 +0200 +@@ -112,39 +112,39 @@ + AR = $(CROSS_COMPILE)ar + RANLIB = $(CROSS_COMPILE)ranlib + +-CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 ++override CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 + WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +-CFLAGS += $(WARNINGS) ++override CFLAGS += $(WARNINGS) + + LDFLAGS += -Wl,-warn-common,--as-needed + + OPTFLAGS = -Os +-CFLAGS += $(OPTFLAGS) ++override CFLAGS += $(OPTFLAGS) + + ifeq ($(strip $(USE_LOG)),true) +- CFLAGS += -DUSE_LOG ++ override CFLAGS += -DUSE_LOG + endif + + # if DEBUG is enabled, then we do not strip + ifeq ($(strip $(DEBUG)),true) +- CFLAGS += -DDEBUG ++ override CFLAGS += -DDEBUG + endif + + ifeq ($(strip $(USE_GCOV)),true) +- CFLAGS += -fprofile-arcs -ftest-coverage ++ override CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS += -fprofile-arcs + endif + + ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux -lsepol +- CFLAGS += -DUSE_SELINUX ++ override CFLAGS += -DUSE_SELINUX + endif + + ifeq ($(strip $(USE_STATIC)),true) +- CFLAGS += -DUSE_STATIC ++ override CFLAGS += -DUSE_STATIC + LDFLAGS += -static + endif + diff --git a/recipes/udev/udev-124/init b/recipes/udev/udev-124/init new file mode 100644 index 0000000000..9e11f08989 --- /dev/null +++ b/recipes/udev/udev-124/init @@ -0,0 +1,60 @@ +#!/bin/sh -e + +### BEGIN INIT INFO +# Provides: udev +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Start udevd, populate /dev and load drivers. +### END INIT INFO + +export TZ=/etc/localtime + +[ -d /sys/class ] || exit 1 +[ -r /proc/mounts ] || exit 1 +[ -x /sbin/udevd ] || exit 1 +[ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf + +kill_udevd() { + if [ -x /sbin/pidof ]; then + pid=`/sbin/pidof -x udevd` + [ -n "$pid" ] && kill $pid + fi +} + +export ACTION=add +# propagate /dev from /sys +echo -n "Starting udev" + +# mount the tmpfs on /dev, if not already done +LANG=C awk "\$2 == \"/dev\" && \$4 == \"tmpfs\" { exit 1 }" /proc/mounts && { + mount -n -o mode=0755 -t tmpfs none "/dev" + mkdir -m 0755 /dev/pts + mkdir -m 0755 /dev/shm +} + +if [ -e /etc/dev.tar ]; then + (cd /; tar xf /etc/dev.tar) + not_first_boot=1 +fi + +# make_extra_nodes +kill_udevd > "/dev/null" 2>&1 + + # trigger the sorted events + echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug + /sbin/udevd -d + + /sbin/udevadm control env STARTUP=1 + if [ "$not_first_boot" != "" ];then + /sbin/udevadm trigger --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux --subsystem-nomatch=platform + (/sbin/udevadm settle --timeout=3; /sbin/udevadm control env STARTUP=)& + else + /sbin/udevadm trigger + /sbin/udevadm settle + (cd /; tar cf /etc/dev.tar dev) + fi + +echo +exit 0 diff --git a/recipes/udev/udev-124/local.rules b/recipes/udev/udev-124/local.rules new file mode 100644 index 0000000000..a4866923fd --- /dev/null +++ b/recipes/udev/udev-124/local.rules @@ -0,0 +1,32 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# Media automounting +SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" +SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" + +# Handle network interface setup +SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" +SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" + +# The first rtc device is symlinked to /dev/rtc +KERNEL=="rtc0", SYMLINK+="rtc" + +# Try and modprobe for drivers for new hardware +ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# Create a symlink to any touchscreen input device +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0" +SUBSYSTEM=="input", KERNEL=="event[0-9]*", SYSFS{modalias}=="ads7846", SYMLINK+="input/touchscreen0" diff --git a/recipes/udev/udev-124/noasmlinkage.patch b/recipes/udev/udev-124/noasmlinkage.patch new file mode 100644 index 0000000000..d58a7ea4de --- /dev/null +++ b/recipes/udev/udev-124/noasmlinkage.patch @@ -0,0 +1,45 @@ +diff -pru udev-124.orig/test-udev.c udev-124/test-udev.c +--- udev-124.orig/test-udev.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/test-udev.c 2008-07-07 14:43:37.000000000 +0100 +@@ -46,7 +46,7 @@ void log_message(int priority, const cha + } + #endif + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGALRM: +diff -pru udev-124.orig/udevd.c udev-124/udevd.c +--- udev-124.orig/udevd.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevd.c 2008-07-07 14:43:58.000000000 +0100 +@@ -87,7 +87,7 @@ void log_message(int priority, const cha + + #endif + +-static void asmlinkage udev_event_sig_handler(int signum) ++static void udev_event_sig_handler(int signum) + { + if (signum == SIGALRM) + exit(1); +@@ -798,7 +798,7 @@ static struct udevd_uevent_msg *get_netl + return msg; + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + switch (signum) { + case SIGINT: +diff -pru udev-124.orig/udevmonitor.c udev-124/udevmonitor.c +--- udev-124.orig/udevmonitor.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevmonitor.c 2008-07-07 14:44:24.000000000 +0100 +@@ -97,7 +97,7 @@ static int init_uevent_netlink_sock(void + return 0; + } + +-static void asmlinkage sig_handler(int signum) ++static void sig_handler(int signum) + { + if (signum == SIGINT || signum == SIGTERM) + udev_exit = 1; diff --git a/recipes/udev/udev-124/permissions.rules b/recipes/udev/udev-124/permissions.rules new file mode 100644 index 0000000000..940d163047 --- /dev/null +++ b/recipes/udev/udev-124/permissions.rules @@ -0,0 +1,119 @@ +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +# only needed for kernels < v2.6.18-rc1 +ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# devices needed to load the drivers providing them +KERNEL=="tun", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" +KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +# the aacraid driver is broken and reports that disks removable (see #404927) +SUBSYSTEM=="block", ATTRS{removable}=="1", \ + DRIVERS!="aacraid", GROUP="floppy" +# all block devices on these buses are "removable" +SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" + +# IDE devices +KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" +SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" + +# USB devices +KERNEL=="legousbtower*", MODE="0666" +KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ + MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ + ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +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=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="rtc|rtc[0-9]*", GROUP="audio" +KERNEL=="kqemu", MODE="0666" +KERNEL=="tun", MODE="0666", + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="lirc[0-9]*", GROUP="video" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" + diff --git a/recipes/udev/udev-124/run.rules b/recipes/udev/udev-124/run.rules new file mode 100644 index 0000000000..75d71375bb --- /dev/null +++ b/recipes/udev/udev-124/run.rules @@ -0,0 +1,14 @@ +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# ignore the events generated by virtual consoles +KERNEL=="ptmx", OPTIONS+="last_rule" +KERNEL=="console", OPTIONS+="last_rule" +KERNEL=="tty" , OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +KERNEL=="pty*", OPTIONS+="last_rule" +SUBSYSTEM=="vc", OPTIONS+="last_rule" + diff --git a/recipes/udev/udev-124/udev.rules b/recipes/udev/udev-124/udev.rules new file mode 100644 index 0000000000..a19d4a0bf6 --- /dev/null +++ b/recipes/udev/udev-124/udev.rules @@ -0,0 +1,116 @@ +# 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' +# %e the smallest number for that name which does not matches an existing node +# %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 +# + +# workaround for devices which do not report media changes +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ + ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ + OPTIONS+="all_partitions" + +# SCSI devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" + +# USB devices +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ + NAME="%c" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ + NAME="%c" +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm*", NAME="infiniband/%k" +KERNEL=="rdma_ucm", NAME="infiniband/%k" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" + +# device mapper creates its own device nodes, so ignore these +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="rfcomm[0-9]*", NAME="%k", GROUP="users", MODE="0660" + +# Firmware Helper +ACTION=="add", SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.sh" + +# Samsung UARTS +KERNEL=="s3c2410_serial[0-9]", NAME="ttySAC%n" + +# MXC UARTs +KERNEL=="ttymxc[0-4]", NAME="ttymxc%n" + diff --git a/recipes/udev/udev-124/udevtrigger_add_devname_filtering.patch b/recipes/udev/udev-124/udevtrigger_add_devname_filtering.patch new file mode 100644 index 0000000000..5182542461 --- /dev/null +++ b/recipes/udev/udev-124/udevtrigger_add_devname_filtering.patch @@ -0,0 +1,99 @@ +diff -pru udev-124.orig/udevtrigger.c udev-124/udevtrigger.c +--- udev-124.orig/udevtrigger.c 2008-06-12 06:24:30.000000000 +0100 ++++ udev-124/udevtrigger.c 2008-07-07 15:10:09.000000000 +0100 +@@ -42,6 +42,8 @@ static int dry_run; + LIST_HEAD(device_list); + LIST_HEAD(filter_subsystem_match_list); + LIST_HEAD(filter_subsystem_nomatch_list); ++LIST_HEAD(filter_kernel_match_list); ++LIST_HEAD(filter_kernel_nomatch_list); + LIST_HEAD(filter_attr_match_list); + LIST_HEAD(filter_attr_nomatch_list); + static int sock = -1; +@@ -331,6 +333,26 @@ static int attr_match(const char *path, + return 0; + } + ++static int kernel_filtered(const char *kernel) ++{ ++ struct name_entry *loop_name; ++ ++ /* skip devices matching the prohibited kernel device names */ ++ list_for_each_entry(loop_name, &filter_kernel_nomatch_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 1; ++ ++ /* skip devices not matching the listed kernel device names */ ++ if (!list_empty(&filter_kernel_match_list)) { ++ list_for_each_entry(loop_name, &filter_kernel_match_list, node) ++ if (fnmatch(loop_name->name, kernel, 0) == 0) ++ return 0; ++ return 1; ++ } ++ ++ return 0; ++} ++ + static int attr_filtered(const char *path) + { + struct name_entry *loop_name; +@@ -409,6 +431,9 @@ static void scan_subsystem(const char *s + if (dent2->d_name[0] == '.') + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -465,6 +490,9 @@ static void scan_block(void) + if (!strcmp(dent2->d_name,"device")) + continue; + ++ if (kernel_filtered(dent2->d_name)) ++ continue; ++ + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); +@@ -576,6 +604,8 @@ int udevtrigger(int argc, char *argv[], + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, ++ { "kernel-match", 1, NULL, 'k' }, ++ { "kernel-nomatch", 1, NULL, 'K' }, + { "env", 1, NULL, 'e' }, + {} + }; +@@ -622,6 +652,12 @@ int udevtrigger(int argc, char *argv[], + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; ++ case 'k': ++ name_list_add(&filter_kernel_match_list, optarg, 0); ++ break; ++ case 'K': ++ name_list_add(&filter_kernel_nomatch_list, optarg, 0); ++ break; + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" +@@ -632,6 +668,8 @@ int udevtrigger(int argc, char *argv[], + " --env=<KEY>=<value> pass an additional key (works only with --socket=)\n" + " --subsystem-match=<subsystem> trigger devices from a matching subystem\n" + " --subsystem-nomatch=<subsystem> exclude devices from a matching subystem\n" ++ " --kernel-match=<subsystem> trigger devices from a matching kernel device name\n" ++ " --kernel-nomatch=<subsystem> exclude devices from a matching kernel device name\n" + " --attr-match=<file[=<value>]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=<file[=<value>]> exclude devices with a matching sysfs\n" +@@ -701,6 +739,8 @@ int udevtrigger(int argc, char *argv[], + exit: + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); ++ name_list_cleanup(&filter_kernel_match_list); ++ name_list_cleanup(&filter_kernel_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + diff --git a/recipes/udev/udev-124/vol_id_ld.patch b/recipes/udev/udev-124/vol_id_ld.patch new file mode 100644 index 0000000000..11126eef8d --- /dev/null +++ b/recipes/udev/udev-124/vol_id_ld.patch @@ -0,0 +1,17 @@ +--- + extras/volume_id/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: udev-115/extras/volume_id/Makefile +=================================================================== +--- udev-115.orig/extras/volume_id/Makefile 2007-09-20 18:17:59.000000000 +0200 ++++ udev-115/extras/volume_id/Makefile 2007-09-20 18:18:08.000000000 +0200 +@@ -44,7 +44,7 @@ + ifeq ($(strip $(VOLUME_ID_STATIC)),true) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) + else +- $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) ++ $(Q) $(LD) -Llib $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -lvolume_id $(LIB_OBJS) + endif + + # man pages diff --git a/recipes/udev/udev-hostap-cs-vcc-workaround_1.0.bb b/recipes/udev/udev-hostap-cs-vcc-workaround_1.0.bb new file mode 100644 index 0000000000..4076cb2dd6 --- /dev/null +++ b/recipes/udev/udev-hostap-cs-vcc-workaround_1.0.bb @@ -0,0 +1,12 @@ +DESCRIPTION = "A hack to force VCC to 5v for hostap_cs cards. This will fry your \ +card one sweet day." +PR = "r1" + +SRC_URI = " file://50-hostap_cs.rules " + +do_install() { + install -d ${D}${sysconfdir}/udev/rules.d/ + install -m 0644 ${WORKDIR}/50-hostap_cs.rules ${D}${sysconfdir}/udev/rules.d/50-hostap_cs.rules +} + +PACKAGE_ARCH = "all" diff --git a/recipes/udev/udev-static-devices.bb b/recipes/udev/udev-static-devices.bb new file mode 100644 index 0000000000..f0aab5a6a2 --- /dev/null +++ b/recipes/udev/udev-static-devices.bb @@ -0,0 +1,22 @@ +DESCRIPTION = "Provide per-machine static nodes of /dev" +RDEPENDS = "udev" + +PR = "r0" + +SRC_URI = "file://udev_static_devices_tarball" + +FILES_${PN} += "${base_libdir}/udev/*" + +do_install () { + install -d ${D}${base_libdir}/udev/devices + if [ -s ${WORKDIR}/udev_static_devices_tarball ]; then + install -m 0644 ${WORKDIR}/udev_static_devices_tarball ${D}${base_libdir}/udev/devices.tar.gz + fi +} + +pkg_postinst () { + ROOT="$D" + if [ -f "$ROOT/lib/udev/devices.tar.gz" ]; then + tar -C "$ROOT/lib/udev" -zxf "$ROOT/lib/udev/devices.tar.gz" || exit $? + fi +} diff --git a/recipes/udev/udev-static-devices/om-gta01/udev_static_devices_tarball b/recipes/udev/udev-static-devices/om-gta01/udev_static_devices_tarball Binary files differnew file mode 100644 index 0000000000..97f397a468 --- /dev/null +++ b/recipes/udev/udev-static-devices/om-gta01/udev_static_devices_tarball diff --git a/recipes/udev/udev-static-devices/om-gta02/udev_static_devices_tarball b/recipes/udev/udev-static-devices/om-gta02/udev_static_devices_tarball Binary files differnew file mode 100644 index 0000000000..24e1a52c95 --- /dev/null +++ b/recipes/udev/udev-static-devices/om-gta02/udev_static_devices_tarball diff --git a/recipes/udev/udev-static-devices/udev_static_devices_tarball b/recipes/udev/udev-static-devices/udev_static_devices_tarball new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/recipes/udev/udev-static-devices/udev_static_devices_tarball diff --git a/recipes/udev/udev.inc b/recipes/udev/udev.inc new file mode 100644 index 0000000000..86f851db05 --- /dev/null +++ b/recipes/udev/udev.inc @@ -0,0 +1,72 @@ +DESCRIPTION ?= "udev is a program which dynamically creates and removes device nodes from \ +/dev/. It responds to /sbin/hotplug device events and requires a 2.6 kernel." +LICENSE = "GPL" + +SRC_URI += " \ + file://udev.rules \ + file://devfs-udev.rules \ + file://links.conf \ + file://permissions.rules \ + file://mount.sh \ + file://network.sh \ + file://local.rules \ + file://init" + +inherit update-rc.d autotools pkgconfig + +PARALLEL_MAKE = "" +UDEV_DEVFS_RULES ?= "0" +PKG_libvolume-id-dev = "libvolume-id-dev" + +INITSCRIPT_NAME = "udev" +INITSCRIPT_PARAMS = "start 04 S ." + +export CROSS = "${TARGET_PREFIX}" +export HOSTCC = "${BUILD_CC}" +export udevdir ?= "/dev" +export usrbindir := "${bindir}" +export usrsbindir := "${sbindir}" +export etcdir = "${sysconfdir}" +LD = "${CC}" +bindir = "/bin" +sbindir = "/sbin" + +UDEV_EXTRAS = "<override me>" +EXTRA_OEMAKE = "-e \ + 'EXTRAS=${UDEV_EXTRAS}' \ + 'STRIP=echo'" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts +} + +do_stage () { + autotools_stage_all + install -m 0644 ${S}/extras/volume_id/lib/libvolume_id.h ${STAGING_INCDIR} + oe_libinstall -C extras/volume_id/lib -so libvolume_id ${STAGING_LIBDIR} +} + +PACKAGES =+ "udev-utils libvolume-id libvolume-id-dev" +FILES_libvolume-id-dev = "${includedir}/libvolume_id.h ${libdir}/libvolume_id.a ${libdir}/libvolume_id.so ${libdir}/pkgconfig/libvolume_id.pc" +FILES_udev-utils = "${usrbindir}/udevinfo ${sbindir}/udevadm ${usrbindir}/udevtest" +FILES_libvolume-id = "${base_libdir}/libvolume_id.so.*" +FILES_${PN} += "${usrbindir}/* ${usrsbindir}/udevd" +FILES_${PN}-dbg += "${usrbindir}/.debug ${usrsbindir}/.debug" diff --git a/recipes/udev/udev_092.bb b/recipes/udev/udev_092.bb new file mode 100644 index 0000000000..d9f5cbaa68 --- /dev/null +++ b/recipes/udev/udev_092.bb @@ -0,0 +1,70 @@ +DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ +/dev/, handles hotplug events and loads drivers at boot time. It replaces \ +the hotplug package and requires a kernel not older than 2.6.12." +RPROVIDES_${PN} = "hotplug" + +PR = "r24" + +SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://noasmlinkage.patch;patch=1 \ + file://flags.patch;patch=1 \ + file://udevsynthesize.patch;patch=1 \ + file://udevsynthesize.sh \ + file://arm_inotify_fix.patch;patch=1 \ + file://mount.blacklist \ + " + +require udev.inc + +INITSCRIPT_PARAMS = "start 03 S ." + +FILES_${PN} += "${base_libdir}/udev/*" +FILES_${PN}-dbg += "${base_libdir}/udev/.debug" +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/ extras/run_directory/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} \ + ${D}${sysconfdir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${base_libdir}/udev/ + install -m 0755 ${S}/udevsynthesize ${D}${base_libdir}/udev/udevsynthesize + install -m 0755 ${WORKDIR}/udevsynthesize.sh ${D}${sbindir}/udevsynthesize +} + +pkg_postinst_append() { + + # Add the root partition to mount.blacklist to avoid a bug in the auto-mounter, + # causing confusion with fsck on boot + + while read dev mp fs junk + do + if test "$mp" = "/" + then + root_partition="$dev" + echo "$root_partition" >> $D${sysconfdir}/udev/mount.blacklist + fi + done < $D${sysconfdir}/fstab + +} + diff --git a/recipes/udev/udev_097.bb b/recipes/udev/udev_097.bb new file mode 100644 index 0000000000..a3dfa51a21 --- /dev/null +++ b/recipes/udev/udev_097.bb @@ -0,0 +1,75 @@ +DEFAULT_PREFERENCE = "-1" + +DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ +/dev/, handles hotplug events and loads drivers at boot time. It replaces \ +the hotplug package and requires a kernel not older than 2.6.15." +DESCRIPTION_libvolume-id = "libvolume_id shared library, \ +used to detect the type of a file system and read its metadata." +DESCRIPTION_libvolume-id-dev = "libvolume_id development headers, \ +needed to link programs with libvolume_id." + +PR = "r13" + +SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://noasmlinkage.patch;patch=1 \ + file://flags.patch;patch=1 \ + file://mount.blacklist \ + " + +require udev.inc + +INITSCRIPT_PARAMS = "start 03 S ." + +FILES_${PN} += "${base_libdir}/udev/*" +FILES_${PN}-dbg += "${base_libdir}/udev/.debug" +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/ extras/run_directory/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} \ + ${D}${sysconfdir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${base_libdir}/udev/ +} + +do_install_append_h2200() { + install -m 0644 ${WORKDIR}/50-hostap_cs.rules ${D}${sysconfdir}/udev/rules.d/50-hostap_cs.rules +} + +pkg_postinst_append() { + + # Add the root partition to mount.blacklist to avoid a bug in the auto-mounter, + # causing confusion with fsck on boot + + while read dev mp fs junk + do + if test "$mp" = "/" + then + root_partition="$dev" + echo "$root_partition" >> $D${sysconfdir}/udev/mount.blacklist + fi + done < $D${sysconfdir}/fstab + +} + + diff --git a/recipes/udev/udev_100.bb b/recipes/udev/udev_100.bb new file mode 100644 index 0000000000..ef08aa4636 --- /dev/null +++ b/recipes/udev/udev_100.bb @@ -0,0 +1,72 @@ +DEFAULT_PREFERENCE = "-1" +DEFAULT_PREFERENCE_slugos = "1" + +DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ +/dev/, handles hotplug events and loads drivers at boot time. It replaces \ +the hotplug package and requires a kernel not older than 2.6.15." +DESCRIPTION_libvolume-id = "libvolume_id shared library, \ +used to detect the type of a file system and read its metadata." +DESCRIPTION_libvolume-id-dev = "libvolume_id development headers, \ +needed to link programs with libvolume_id." + +PR = "r15" + +SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://noasmlinkage.patch;patch=1 \ + file://flags.patch;patch=1 \ + file://mount.blacklist \ + file://mount.sh \ + " + +require udev.inc + +INITSCRIPT_PARAMS = "start 03 S ." + +FILES_${PN} += "${base_libdir}/udev/*" +FILES_${PN}-dbg += "${base_libdir}/udev/.debug" +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/ extras/run_directory/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} \ + ${D}${sysconfdir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${base_libdir}/udev/ +} + +pkg_postinst_append() { + + # Add the root partition to mount.blacklist to avoid a bug in the auto-mounter, + # causing confusion with fsck on boot + + while read dev mp fs junk + do + if test "$mp" = "/" + then + root_partition="$dev" + echo "$root_partition" >> $D${sysconfdir}/udev/mount.blacklist + fi + done < $D${sysconfdir}/fstab + +} + diff --git a/recipes/udev/udev_118.bb b/recipes/udev/udev_118.bb new file mode 100644 index 0000000000..7fcd4c546c --- /dev/null +++ b/recipes/udev/udev_118.bb @@ -0,0 +1,72 @@ +DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ +/dev/, handles hotplug events and loads drivers at boot time. It replaces \ +the hotplug package and requires a kernel not older than 2.6.12." +RPROVIDES_${PN} = "hotplug" + +PR = "r5" + +DEFAULT_PREFERENCE = "-118" + +SRC_URI = "\ + http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://flags.patch;patch=1 \ + file://vol_id_ld.patch;patch=1 \ + file://udevtrigger_add_devname_filtering.patch;patch=1 \ + file://mount.blacklist \ +" + +require udev.inc + +INITSCRIPT_PARAMS = "start 03 S ." + +FILES_${PN} += "${base_libdir}/udev/*" +FILES_${PN}-dbg += "${base_libdir}/udev/.debug" +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_compile_prepend() { + sed -i s,asmlinkage,, *.c +} + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sysconfdir} \ + ${D}${sbindir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${base_libdir}/udev/ +} + +pkg_postinst_append() { + + # Add the root partition to mount.blacklist to avoid a bug in the auto-mounter, + # causing confusion with fsck on boot + + while read dev mp fs junk + do + if test "$mp" = "/" + then + root_partition="$dev" + echo "$root_partition" >> $D${sysconfdir}/udev/mount.blacklist + fi + done < $D${sysconfdir}/fstab +} + diff --git a/recipes/udev/udev_124.bb b/recipes/udev/udev_124.bb new file mode 100644 index 0000000000..76edb2fa6f --- /dev/null +++ b/recipes/udev/udev_124.bb @@ -0,0 +1,57 @@ +DESCRIPTION = "udev is a daemon which dynamically creates and removes device nodes from \ +/dev/, handles hotplug events and loads drivers at boot time. It replaces \ +the hotplug package and requires a kernel not older than 2.6.12." +RPROVIDES_${PN} = "hotplug" +PR = "r14" + +SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \ + file://noasmlinkage.patch;patch=1 \ + file://flags.patch;patch=1 \ + file://vol_id_ld.patch;patch=1 \ + file://udevtrigger_add_devname_filtering.patch;patch=1 \ + file://mount.blacklist \ + file://run.rules \ + " + +SRC_URI_append_h2200 = " file://50-hostap_cs.rules " +PACKAGE_ARCH_h2200 = "h2200" + +require udev.inc + +INITSCRIPT_PARAMS = "start 03 S ." + +FILES_${PN} += "${base_libdir}/udev/*" +FILES_${PN}-dbg += "${base_libdir}/udev/.debug" +UDEV_EXTRAS = "extras/firmware/ extras/scsi_id/ extras/volume_id/" +EXTRA_OEMAKE += "libudevdir=/lib/udev libdir=${base_libdir} prefix=" + +do_install () { + install -d ${D}${usrsbindir} \ + ${D}${sbindir} + oe_runmake 'DESTDIR=${D}' INSTALL=install install + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/udev + + install -d ${D}${sysconfdir}/udev/rules.d/ + + install -m 0644 ${WORKDIR}/mount.blacklist ${D}${sysconfdir}/udev/ + install -m 0644 ${WORKDIR}/local.rules ${D}${sysconfdir}/udev/rules.d/local.rules + install -m 0644 ${WORKDIR}/permissions.rules ${D}${sysconfdir}/udev/rules.d/permissions.rules + install -m 0644 ${WORKDIR}/run.rules ${D}${sysconfdir}/udev/rules.d/run.rules + install -m 0644 ${WORKDIR}/udev.rules ${D}${sysconfdir}/udev/rules.d/udev.rules + install -m 0644 ${WORKDIR}/links.conf ${D}${sysconfdir}/udev/links.conf + if [ "${UDEV_DEVFS_RULES}" = "1" ]; then + install -m 0644 ${WORKDIR}/devfs-udev.rules ${D}${sysconfdir}/udev/rules.d/devfs-udev.rules + fi + + install -d ${D}${sysconfdir}/udev/scripts/ + + install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh + install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts + + install -d ${D}${base_libdir}/udev/ +} + +do_install_append_h2200() { + install -m 0644 ${WORKDIR}/50-hostap_cs.rules ${D}${sysconfdir}/udev/rules.d/50-hostap_cs.rules +} |