summaryrefslogtreecommitdiffstats
path: root/abs/core/klibc-udev
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/klibc-udev')
-rw-r--r--abs/core/klibc-udev/50-udev-default.rules5
-rw-r--r--abs/core/klibc-udev/60-persistent-storage.rules47
-rw-r--r--abs/core/klibc-udev/64-device-mapper.rules4
-rw-r--r--abs/core/klibc-udev/64-md-raid.rules18
-rw-r--r--abs/core/klibc-udev/80-drivers.rules7
-rw-r--r--abs/core/klibc-udev/PKGBUILD91
-rw-r--r--abs/core/klibc-udev/disable-uid-gid-lookup.patch33
-rwxr-xr-xabs/core/klibc-udev/load-modules.sh57
-rw-r--r--abs/core/klibc-udev/udev-fix-klibc-build.patch48
-rw-r--r--abs/core/klibc-udev/udev_hook5
-rw-r--r--abs/core/klibc-udev/udev_install16
11 files changed, 257 insertions, 74 deletions
diff --git a/abs/core/klibc-udev/50-udev-default.rules b/abs/core/klibc-udev/50-udev-default.rules
new file mode 100644
index 0000000..8593c7b
--- /dev/null
+++ b/abs/core/klibc-udev/50-udev-default.rules
@@ -0,0 +1,5 @@
+# firmware class requests
+SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"
+
+# do not delete static device nodes
+ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove"
diff --git a/abs/core/klibc-udev/60-persistent-storage.rules b/abs/core/klibc-udev/60-persistent-storage.rules
new file mode 100644
index 0000000..d32a143
--- /dev/null
+++ b/abs/core/klibc-udev/60-persistent-storage.rules
@@ -0,0 +1,47 @@
+# do not edit this file, it will be overwritten on update
+
+# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path}
+# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
+
+# forward scsi device event to corresponding block device
+ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change"
+
+ACTION!="add|change", GOTO="persistent_storage_end"
+SUBSYSTEM!="block", GOTO="persistent_storage_end"
+
+# skip rules for inappropriate block devices
+KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|md*|btibm*", GOTO="persistent_storage_end"
+
+# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
+KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
+KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
+
+# ignore partitions that span the entire disk
+TEST=="whole_disk", GOTO="persistent_storage_end"
+
+# /sys/class/block will export this
+ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
+ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"
+
+# for partitions import parent information
+ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+
+# by-path (parent device path)
+ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p"
+ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
+ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+
+# skip unpartitioned removable media devices from drivers which do not send "change" events
+ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
+
+# probe filesystem metadata of optical drives which have a media inserted
+KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
+
+# probe filesystem metadata of disks
+KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
+
+# by-label/by-uuid links (filesystem metadata)
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+LABEL="persistent_storage_end"
diff --git a/abs/core/klibc-udev/64-device-mapper.rules b/abs/core/klibc-udev/64-device-mapper.rules
new file mode 100644
index 0000000..8154ef3
--- /dev/null
+++ b/abs/core/klibc-udev/64-device-mapper.rules
@@ -0,0 +1,4 @@
+# do not edit this file, it will be overwritten on update
+
+KERNEL=="device-mapper", NAME="mapper/control"
+
diff --git a/abs/core/klibc-udev/64-md-raid.rules b/abs/core/klibc-udev/64-md-raid.rules
new file mode 100644
index 0000000..e094ca7
--- /dev/null
+++ b/abs/core/klibc-udev/64-md-raid.rules
@@ -0,0 +1,18 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM!="block", GOTO="md_end"
+ACTION!="add|change", GOTO="md_end"
+
+# import data from a raid member and activate it
+#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}"
+# import data from a raid set
+KERNEL!="md*", GOTO="md_end"
+
+ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
+
+IMPORT{program}="vol_id --export $tempnode"
+OPTIONS+="link_priority=100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+LABEL="md_end"
diff --git a/abs/core/klibc-udev/80-drivers.rules b/abs/core/klibc-udev/80-drivers.rules
new file mode 100644
index 0000000..6f6fcc3
--- /dev/null
+++ b/abs/core/klibc-udev/80-drivers.rules
@@ -0,0 +1,7 @@
+# do not edit this file, it will be overwritten on update
+
+ACTION!="add", GOTO="drivers_end"
+
+DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/lib/udev/load-modules.sh $env{MODALIAS}"
+
+LABEL="drivers_end"
diff --git a/abs/core/klibc-udev/PKGBUILD b/abs/core/klibc-udev/PKGBUILD
index baad6d4..0775b05 100644
--- a/abs/core/klibc-udev/PKGBUILD
+++ b/abs/core/klibc-udev/PKGBUILD
@@ -1,58 +1,59 @@
-# $Id: PKGBUILD 5858 2008-07-21 18:47:23Z thomas $
+# $Id: PKGBUILD 23620 2009-01-11 14:11:40Z thomas $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
pkgname=klibc-udev
-pkgver=116
-pkgrel=13
-pkgdesc="udevd compiled under klibc"
+pkgver=135
+pkgrel=30
+pkgdesc="udev compiled for klibc"
arch=(i686 x86_64)
url="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
groups=('base')
depends=('coreutils' 'klibc' $(basename /lib/klibc-*.so .so))
license=('GPL')
-source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-$pkgver.tar.bz2 \
- udev_hook udev_install start_udev udev.rules load-modules.sh \
- vol_id-suspend2.patch)
-md5sums=('02c49d93ffda4a104c853c082138b835'
- 'bcfed63882660e7d33f367d722e0a5c9'
- '92b62124dd43d61a2e610c305bf95d15'
- '22741baf8f5d7d8bc88022b39bca74d8'
- 'f50bd6b378a5e75b2475bc67b32cb692'
- '1ecfeec15e88485e88f2e37f46861f2e'
- '80f75fc9a8fc32c7b8ff146d53bf579f')
+source=(http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-$pkgver.tar.bz2
+ udev-fix-klibc-build.patch
+ disable-uid-gid-lookup.patch
+ udev_hook
+ udev_install
+ 50-udev-default.rules
+ 60-persistent-storage.rules
+ 64-device-mapper.rules
+ 64-md-raid.rules
+ 80-drivers.rules
+ load-modules.sh)
+md5sums=('661b9df34e1304dad10f595d95b472bb'
+ 'c769a0440fc90ba0fee7a2ae2bf7d76f'
+ '89acd170a2771f81ca9e4b7920820555'
+ '042fd2ba6a0351bbae30da33ff492c03'
+ 'a3d81917e2bbe66f6c24486a86d4dc9c'
+ 'f9095dbad80fc93bcde60d7fe4572022'
+ '6625a4000069b9d46ae0ff9d9c2cebb7'
+ '258fea1c2b024f9755f905a21bd45a01'
+ 'e20efd69738bbbba35c49e7b63ee0212'
+ 'd42740d13b6bb5c5d90bfc2062019f58'
+ '5dd248da5d5fa3adfbe87309807ab734')
-build()
-{
- cd $startdir/src/udev-$pkgver
- patch -p1 -i ${startdir}/src/vol_id-suspend2.patch || return 1
- sed -i "s|USE_LOG = .*|USE_LOG = false|g" Makefile
+build() {
+ cd ${srcdir}/udev-$pkgver
+ patch -p1 -i ../udev-fix-klibc-build.patch || return 1
+ # uid/gid lookup fails to build on klibc due to incomplete headers
+ # we don't use this feature in klibc, simply omit it
+ patch -p1 -i ../disable-uid-gid-lookup.patch || return 1
- #I need to look at this... it appears the __CTYPE_NO_INLINE may be a klibc issue - aaron
- make VOLUME_ID_STATIC=true CC=klcc LD=klcc PROGRAMS="udevd udevsettle udevtrigger" \
- CFLAGS="$CFLAGS -U__CTYPE_NO_INLINE" \
- EXTRAS="extras/firmware extras/cdrom_id extras/ata_id \
- extras/edd_id extras/usb_id extras/volume_id" \
- || return 1
+ CC=klcc LD=klcc ./configure --prefix=""
+ make || return 1
- mkdir -p $startdir/pkg/lib/initcpio/udev
- install -m755 udevd $startdir/pkg/lib/initcpio/udev
- install -m755 udevtrigger $startdir/pkg/lib/initcpio/udev
- install -m755 udevsettle $startdir/pkg/lib/initcpio/udev
- install -m755 extras/firmware/firmware.sh $startdir/pkg/lib/initcpio/udev
- install -m755 extras/cdrom_id/cdrom_id $startdir/pkg/lib/initcpio/udev
- install -m755 extras/ata_id/ata_id $startdir/pkg/lib/initcpio/udev
- install -m755 extras/edd_id/edd_id $startdir/pkg/lib/initcpio/udev
- install -m755 extras/scsi_id/scsi_id $startdir/pkg/lib/initcpio/udev
- install -m755 extras/usb_id/usb_id $startdir/pkg/lib/initcpio/udev
- # broken atm
- install -m755 extras/volume_id/vol_id $startdir/pkg/lib/initcpio/udev
- #install -m755 extras/path_id/path_id $startdir/pkg/lib/initcpio/udev
- install -m755 $startdir/src/start_udev $startdir/pkg/lib/initcpio/udev
- install -m644 $startdir/src/udev.rules $startdir/pkg/lib/initcpio/udev
- install -m755 $startdir/src/load-modules.sh $startdir/pkg/lib/initcpio/udev
+ mkdir -p ${pkgdir}/lib/initcpio/udev
+ install -m755 udev/udevd ${pkgdir}/lib/initcpio/udev/ || return 1
+ install -m755 udev/udevadm ${pkgdir}/lib/initcpio/udev/ || return 1
+ install -m755 extras/path_id/path_id ${pkgdir}/lib/initcpio/udev/ || return 1
+ install -m755 extras/volume_id/vol_id ${pkgdir}/lib/initcpio/udev/ || return 1
+ install -m755 extras/firmware/firmware.sh ${pkgdir}/lib/initcpio/udev/ || return 1
+ for rules in 50-udev-default.rules 60-persistent-storage.rules 64-device-mapper.rules 64-md-raid.rules 80-drivers.rules; do
+ install -m644 ${srcdir}/${rules} ${pkgdir}/lib/initcpio/udev/ || return 1
+ done
+ install -m755 ${srcdir}/load-modules.sh ${pkgdir}/lib/initcpio/udev/ || return 1
- mkdir -p $startdir/pkg/lib/initcpio/install
- install -m644 $startdir/src/udev_install $startdir/pkg/lib/initcpio/install/udev
- mkdir -p $startdir/pkg/lib/initcpio/hooks/
- install -m644 $startdir/src/udev_hook $startdir/pkg/lib/initcpio/hooks/udev
+ install -D -m644 ${srcdir}/udev_install ${pkgdir}/lib/initcpio/install/udev || return 1
+ install -D -m644 ${srcdir}/udev_hook ${pkgdir}/lib/initcpio/hooks/udev || return 1
}
diff --git a/abs/core/klibc-udev/disable-uid-gid-lookup.patch b/abs/core/klibc-udev/disable-uid-gid-lookup.patch
new file mode 100644
index 0000000..578c3ee
--- /dev/null
+++ b/abs/core/klibc-udev/disable-uid-gid-lookup.patch
@@ -0,0 +1,33 @@
+diff -Nur udev-132.orig/udev/udev-util.c udev-132/udev/udev-util.c
+--- udev-132.orig/udev/udev-util.c 2008-11-06 02:56:15.000000000 +0100
++++ udev-132/udev/udev-util.c 2008-11-09 18:28:30.000000000 +0100
+@@ -126,6 +126,7 @@
+
+ uid_t util_lookup_user(struct udev *udev, const char *user)
+ {
++ /*
+ char *endptr;
+ int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
+ char buf[buflen];
+@@ -147,11 +148,13 @@
+ err(udev, "specified user '%s' unknown\n", user);
+ else
+ err(udev, "error resolving user '%s': %m\n", user);
++ */
+ return 0;
+ }
+
+ extern gid_t util_lookup_group(struct udev *udev, const char *group)
+ {
++ /*
+ char *endptr;
+ int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
+ char buf[buflen];
+@@ -173,6 +176,7 @@
+ err(udev, "specified group '%s' unknown\n", group);
+ else
+ err(udev, "error resolving group '%s': %m\n", group);
++ */
+ return 0;
+ }
+
diff --git a/abs/core/klibc-udev/load-modules.sh b/abs/core/klibc-udev/load-modules.sh
index f0961a7..3d52d6b 100755
--- a/abs/core/klibc-udev/load-modules.sh
+++ b/abs/core/klibc-udev/load-modules.sh
@@ -4,29 +4,48 @@
# - Aaron Griffin & Tobias Powalowski for Archlinux
[ $# -ne 1 ] && exit 1
+MODPROBE="/sbin/modprobe"
+RESOLVEALIAS="/bin/resolve-modalias"
+USEBLACKLIST="--use-blacklist"
+REPLACE="/bin/replace"
+MODDEPS="/bin/moddeps"
+
if [ -f /proc/cmdline ]; then
- for cmd in $(cat /proc/cmdline); do
- case $cmd in
- *=*) eval $cmd ;;
- esac
- done
+ for cmd in $(cat /proc/cmdline); do
+ case $cmd in
+ disablemodules=*) eval $cmd ;;
+ load_modules=off) exit ;;
+ esac
+ done
+ #parse cmdline entries of the form "disablemodules=x,y,z"
+ if [ -n "${disablemodules}" ]; then
+ BLACKLIST="$(${REPLACE} ${disablemodules} ',')"
+ fi
fi
-# get the real names from modaliases
-i="$(/bin/moddeps $1)"
-# add disablemodules= from commandline to blacklist
-k="$(/bin/replace "${disablemodules}" ',')"
-j="$(/bin/replace "${k}" '-' '_')"
+# sanitize the module names
+BLACKLIST="$(${REPLACE} "${BLACKLIST}" '-' '_')"
-if [ "${j}" != "" ] ; then
- for n in ${i}; do
- for o in ${j}; do
- if [ "$n" = "$o" ]; then
- exit 1
- fi
- done
- done
+if [ -n "${BLACKLIST}" ] ; then
+ # Try to find all modules for the alias
+ mods="$($RESOLVEALIAS /lib/modules/$(uname -r)/modules.alias $1)"
+ # If no modules could be found, try if the alias name is a module name
+ # In that case, omit the --use-blacklist parameter to imitate normal modprobe behaviour
+ [ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST=""
+ [ -z "${mods}" ] && exit
+ for mod in ${mods}; do
+ deps="$(${MODDEPS} ${mod})"
+ [ $? -ne 0 ] && continue
+ # If the module or any of its dependencies is blacklisted, don't load it
+ for dep in $deps; do
+ for blackmod in ${BLACKLIST}; do
+ [ "${blackmod}" = "${dep}" ] && continue 3
+ done
+ done
+ $MODPROBE $USEBLACKLIST ${mod}
+ done
+else
+ $MODPROBE $1
fi
-/sbin/modprobe $1
# vim: set et ts=4:
diff --git a/abs/core/klibc-udev/udev-fix-klibc-build.patch b/abs/core/klibc-udev/udev-fix-klibc-build.patch
new file mode 100644
index 0000000..7ac0917
--- /dev/null
+++ b/abs/core/klibc-udev/udev-fix-klibc-build.patch
@@ -0,0 +1,48 @@
+diff -Nur udev-128.orig/extras/Makefile.in udev-128/extras/Makefile.in
+--- udev-128.orig/extras/Makefile.in 2008-09-11 16:58:01.000000000 +0200
++++ udev-128/extras/Makefile.in 2008-09-18 12:03:09.000000000 +0200
+@@ -176,15 +176,11 @@
+ udev_prefix = @udev_prefix@
+ SUBDIRS = \
+ ata_id \
+- cdrom_id \
+ edd_id \
+ path_id \
+ firmware \
+- collect \
+ floppy \
+- fstab_import \
+ rule_generator \
+- scsi_id \
+ usb_id \
+ volume_id
+
+diff -Nur udev-128.orig/extras/volume_id/lib/libvolume_id-private.h udev-128/extras/volume_id/lib/libvolume_id-private.h
+--- udev-128.orig/extras/volume_id/lib/libvolume_id-private.h 2008-09-10 02:37:09.000000000 +0200
++++ udev-128/extras/volume_id/lib/libvolume_id-private.h 2008-09-18 12:07:57.000000000 +0200
+@@ -35,12 +35,8 @@
+ log_null(const char *format, ...) {}
+
+ #define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg)
+-#define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg)
+-#ifdef DEBUG
+-#define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg)
+-#else
++#define info(format, arg...) log_null(format, ##arg)
+ #define dbg(format, arg...) log_null(format, ##arg)
+-#endif
+
+ #if (__BYTE_ORDER == __LITTLE_ENDIAN)
+ #define le16_to_cpu(x) (x)
+diff -Nur udev-128.orig/extras/volume_id/lib/md5.c udev-128/extras/volume_id/lib/md5.c
+--- udev-128.orig/extras/volume_id/lib/md5.c 2008-09-10 02:18:59.000000000 +0200
++++ udev-128/extras/volume_id/lib/md5.c 2008-09-18 12:03:09.000000000 +0200
+@@ -21,7 +21,7 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+-#include <stdint.h>
++/*#include <stdint.h>*/
+ #include <string.h>
+ #include <endian.h>
+ #include <byteswap.h>
diff --git a/abs/core/klibc-udev/udev_hook b/abs/core/klibc-udev/udev_hook
index fc4c814..4d8212a 100644
--- a/abs/core/klibc-udev/udev_hook
+++ b/abs/core/klibc-udev/udev_hook
@@ -2,6 +2,9 @@
run_hook ()
{
msg -n ":: Loading udev..."
- /etc/start_udev
+ echo > /proc/sys/kernel/hotplug
+ /sbin/udevd --daemon
+ /sbin/udevadm trigger
+ /sbin/udevadm settle
msg "done."
}
diff --git a/abs/core/klibc-udev/udev_install b/abs/core/klibc-udev/udev_install
index 62d5b00..94dcd80 100644
--- a/abs/core/klibc-udev/udev_install
+++ b/abs/core/klibc-udev/udev_install
@@ -7,16 +7,14 @@ install ()
FILES=" /etc/udev/udev.conf"
SCRIPT="udev"
add_file /lib/initcpio/udev/udevd /sbin/udevd
- add_file /lib/initcpio/udev/udevtrigger /sbin/udevtrigger
- add_file /lib/initcpio/udev/udevsettle /sbin/udevsettle
- add_file /lib/initcpio/udev/udev.rules /etc/udev/rules.d/udev.rules
- add_file /lib/initcpio/udev/start_udev /etc/start_udev
+ add_file /lib/initcpio/udev/udevadm /sbin/udevadm
+ add_file /lib/initcpio/udev/50-udev-default.rules /lib/udev/rules.d/50-udev-default.rules
+ add_file /lib/initcpio/udev/60-persistent-storage.rules /lib/udev/rules.d/60-persistent-storage.rules
+ add_file /lib/initcpio/udev/64-device-mapper.rules /lib/udev/rules.d/64-device-mapper.rules
+ add_file /lib/initcpio/udev/64-md-raid.rules /lib/udev/rules.d/64-md-raid.rules
+ add_file /lib/initcpio/udev/80-drivers.rules /lib/udev/rules.d/80-drivers.rules
add_file /lib/initcpio/udev/firmware.sh /lib/udev/firmware.sh
- add_file /lib/initcpio/udev/cdrom_id /lib/udev/cdrom_id
- add_file /lib/initcpio/udev/ata_id /lib/udev/ata_id
- add_file /lib/initcpio/udev/usb_id /lib/udev/usb_id
- add_file /lib/initcpio/udev/edd_id /lib/udev/edd_id
- #add_file /lib/initcpio/udev/scsi_id /lib/udev/scsi_id
+ add_file /lib/initcpio/udev/path_id /lib/udev/path_id
add_file /lib/initcpio/udev/vol_id /lib/udev/vol_id
add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh
}