summaryrefslogtreecommitdiffstats
path: root/abs/core/klibc-udev
diff options
context:
space:
mode:
authorJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
committerJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
commit0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch)
treec0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core/klibc-udev
downloadlinhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2
initial import
Diffstat (limited to 'abs/core/klibc-udev')
-rw-r--r--abs/core/klibc-udev/PKGBUILD58
-rw-r--r--abs/core/klibc-udev/klibc-remove-revert.patch111
-rwxr-xr-xabs/core/klibc-udev/load-modules.sh32
-rw-r--r--abs/core/klibc-udev/post-107.patch176
-rwxr-xr-xabs/core/klibc-udev/start_udev115
-rw-r--r--abs/core/klibc-udev/udev.rules187
-rw-r--r--abs/core/klibc-udev/udev_hook7
-rw-r--r--abs/core/klibc-udev/udev_install31
-rw-r--r--abs/core/klibc-udev/vol_id-suspend2.patch15
9 files changed, 732 insertions, 0 deletions
diff --git a/abs/core/klibc-udev/PKGBUILD b/abs/core/klibc-udev/PKGBUILD
new file mode 100644
index 0000000..baad6d4
--- /dev/null
+++ b/abs/core/klibc-udev/PKGBUILD
@@ -0,0 +1,58 @@
+# $Id: PKGBUILD 5858 2008-07-21 18:47:23Z thomas $
+# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
+
+pkgname=klibc-udev
+pkgver=116
+pkgrel=13
+pkgdesc="udevd compiled under 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')
+
+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
+
+ #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
+
+ 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 $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
+}
diff --git a/abs/core/klibc-udev/klibc-remove-revert.patch b/abs/core/klibc-udev/klibc-remove-revert.patch
new file mode 100644
index 0000000..8d9484f
--- /dev/null
+++ b/abs/core/klibc-udev/klibc-remove-revert.patch
@@ -0,0 +1,111 @@
+### Archlinux revert
+### revert this patch, crazy udev devs
+From: Kay Sievers <kay.sievers@suse.de>
+Date: Fri, 4 Aug 2006 22:02:58 +0000 (+0200)
+Subject: libvolume_id: read ufs2 label
+X-Git-Tag: 097
+X-Git-Url: http://www.kernel.org/git/?p=linux/hotplug/udev.git;a=commitdiff;h=eb82b76dedc1482b6434c46fee84d3ef13cb9648
+
+libvolume_id: read ufs2 label
+
+Taken from the FreeBSD HAL repository.
+---
+
+--- a/Makefile
++++ b/Makefile
+@@ -33,6 +33,9 @@ USE_GCOV = false
+ # include Security-Enhanced Linux support
+ USE_SELINUX = false
+
++# comile with klibc instead of glibc
++USE_KLIBC = false
++
+ # set this to create statically linked binaries
+ USE_STATIC = false
+
+@@ -139,6 +142,12 @@ ifeq ($(strip $(USE_GCOV)),true)
+ LDFLAGS += -fprofile-arcs
+ endif
+
++ifeq ($(strip $(USE_KLIBC)),true)
++ KLCC = /usr/bin/$(CROSS_COMPILE)klcc
++ CC = $(KLCC)
++ LD = $(KLCC)
++endif
++
+ ifeq ($(strip $(USE_SELINUX)),true)
+ UDEV_OBJS += udev_selinux.o
+ LIB_OBJS += -lselinux -lsepol
+--- a/README
++++ b/README
+@@ -69,6 +69,10 @@ Compile Options:
+ USE_SELINUX
+ If set to 'true', udev will be built with SELinux support
+ enabled. This is disabled by default.
++ USE_KLIBC
++ If set to 'true', udev is built and linked against klibc.
++ Default value is 'false'. KLCC specifies the klibc compiler
++ wrapper, usually located at /usr/bin/klcc.
+ EXTRAS
+ list of helper programs in extras/ to build.
+ make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id"
+--- a/extras/scsi_id/scsi_id.c
++++ b/extras/scsi_id/scsi_id.c
+@@ -402,7 +402,8 @@ static int set_options(int argc, char **
+ /*
+ * optind is a global extern used by getopt. Since we can call
+ * set_options twice (once for command line, and once for config
+- * file) we have to reset this back to 1.
++ * file) we have to reset this back to 1. [Note glibc handles
++ * setting this to 0, but klibc does not.]
+ */
+ optind = 1;
+ while (1) {
+--- a/test/simple-build-check.sh
++++ b/test/simple-build-check.sh
+@@ -23,6 +23,14 @@ make clean EXTRAS="$EXTRAS" >/dev/null
+ make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit
+ echo -e "\n\n"
+
++# klibc build
++if [ -n "$KLCC" -a -e "$KLCC" ]; then
++ echo KLCC: "$KLCC"
++ make clean EXTRAS="$EXTRAS" >/dev/null
++ make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KLCC="$KLCC" || exit
++ echo -e "\n\n"
++fi
++
+ # install in temporary dir and show it
+ TEMPDIR="`pwd`/.tmp"
+ rm -rf $TEMPDIR
+--- a/udev_libc_wrapper.c
++++ b/udev_libc_wrapper.c
+@@ -30,7 +30,7 @@
+
+ #include "udev.h"
+
+-#ifndef __GLIBC__
++#ifdef __KLIBC__
+ #define __OWN_USERDB_PARSER__
+ #endif
+
+--- a/udev_libc_wrapper.h
++++ b/udev_libc_wrapper.h
+@@ -105,7 +105,7 @@ static inline int inotify_add_watch(int
+ }
+ #else
+ /* needed until /usr/include/sys/inotify.h is working */
+-#ifndef __GLIBC__
++#ifdef __KLIBC__
+ #include <sys/inotify.h>
+ #else
+ static inline int inotify_init(void)
+@@ -117,7 +117,7 @@ static inline int inotify_add_watch(int
+ {
+ return syscall(__NR_inotify_add_watch, fd, name, mask);
+ }
+-#endif /* __GLIBC__ */
++#endif /* __KLIBC__ */
+ #endif /* __NR_inotify_init */
+
+ #ifndef IN_CREATE
diff --git a/abs/core/klibc-udev/load-modules.sh b/abs/core/klibc-udev/load-modules.sh
new file mode 100755
index 0000000..f0961a7
--- /dev/null
+++ b/abs/core/klibc-udev/load-modules.sh
@@ -0,0 +1,32 @@
+#! /bin/sh
+# Implement blacklisting for udev-loaded modules
+# Includes module checking
+# - Aaron Griffin & Tobias Powalowski for Archlinux
+[ $# -ne 1 ] && exit 1
+
+if [ -f /proc/cmdline ]; then
+ for cmd in $(cat /proc/cmdline); do
+ case $cmd in
+ *=*) eval $cmd ;;
+ esac
+ done
+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}" '-' '_')"
+
+if [ "${j}" != "" ] ; then
+ for n in ${i}; do
+ for o in ${j}; do
+ if [ "$n" = "$o" ]; then
+ exit 1
+ fi
+ done
+ done
+fi
+/sbin/modprobe $1
+
+# vim: set et ts=4:
diff --git a/abs/core/klibc-udev/post-107.patch b/abs/core/klibc-udev/post-107.patch
new file mode 100644
index 0000000..cb6e618
--- /dev/null
+++ b/abs/core/klibc-udev/post-107.patch
@@ -0,0 +1,176 @@
+From: Matthias Schwarzott <zzam@gentoo.org>
+Date: Thu, 22 Mar 2007 20:05:56 +0000 (+0100)
+Subject: write_cd_rules: set default link type to "by-id" for usb and ieee1394 devices
+X-Git-Url: http://git.kernel.org/?p=linux%2Fhotplug%2Fudev.git;a=commitdiff_plain;h=491a6a71ff685373422621f4b67f550806072d17
+
+write_cd_rules: set default link type to "by-id" for usb and ieee1394 devices
+---
+
+diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules
+index 1dbe6b7..bd951c5 100644
+--- a/extras/rule_generator/write_cd_rules
++++ b/extras/rule_generator/write_cd_rules
+@@ -53,7 +53,15 @@ fi
+ if [ "$1" ]; then
+ METHOD="$1"
+ else
+- METHOD='by-path'
++ case "$ID_BUS" in
++ usb|ieee1394)
++ METHOD='by-id'
++ ;;
++
++ *)
++ METHOD='by-path'
++ ;;
++ esac
+ fi
+
+ case "$METHOD" in
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Fri, 23 Mar 2007 16:17:18 +0000 (+0100)
+Subject: udevinfo: relax check for the correct device if looked up by name
+X-Git-Url: http://git.kernel.org/?p=linux%2Fhotplug%2Fudev.git;a=commitdiff_plain;h=be8594ab14f15203fcea4b2aa0115171472f3e43
+
+udevinfo: relax check for the correct device if looked up by name
+---
+
+diff --git a/udev_db.c b/udev_db.c
+index 00d68d6..7b8d02b 100644
+--- a/udev_db.c
++++ b/udev_db.c
+@@ -186,7 +186,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath)
+ size_t cur;
+ size_t count;
+
+- strlcpy(udev->dev->devpath, devpath, sizeof(udev->dev->devpath));
++ sysfs_device_set_values(udev->dev, devpath, NULL, NULL);
+ devpath_to_db_path(devpath, filename, sizeof(filename));
+
+ if (lstat(filename, &stats) != 0) {
+diff --git a/udevinfo.c b/udevinfo.c
+index 3f25be0..4b4876c 100644
+--- a/udevinfo.c
++++ b/udevinfo.c
+@@ -173,13 +173,17 @@ static void export_db(void) {
+ static int lookup_device_by_name(struct udevice *udev, const char *name)
+ {
+ LIST_HEAD(name_list);
++ int count;
+ struct name_entry *device;
+ int rc = -1;
+
+- if (udev_db_get_devices_by_name(name, &name_list) <= 0)
++ count = udev_db_get_devices_by_name(name, &name_list);
++ if (count <= 0)
+ goto out;
+
+- /* select the device that matches the dev_t of name */
++ info("found %i devices for '%s'", count, name);
++
++ /* select the device that seems to match */
+ list_for_each_entry(device, &name_list, node) {
+ char filename[PATH_SIZE];
+ struct stat statbuf;
+@@ -189,16 +193,18 @@ static int lookup_device_by_name(struct udevice *udev, const char *name)
+ continue;
+ info("found db entry '%s'", device->name);
+
++ /* make sure, we don't get a link of a differnt device */
+ strlcpy(filename, udev_root, sizeof(filename));
+ strlcat(filename, "/", sizeof(filename));
+ strlcat(filename, name, sizeof(filename));
+ if (stat(filename, &statbuf) != 0)
+ continue;
+- if (statbuf.st_rdev == udev->devt) {
+- info("found '%s', dev_t matches", udev->name);
+- rc = 0;
+- break;
++ if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) {
++ info("skip '%s', dev_t doesn't match", udev->name);
++ continue;
+ }
++ rc = 0;
++ break;
+ }
+ out:
+ name_list_cleanup(&name_list);
+From: Kay Sievers <kay.sievers@vrfy.org>
+Date: Fri, 23 Mar 2007 16:18:03 +0000 (+0100)
+Subject: don't write to sysfs files during test run
+X-Git-Url: http://git.kernel.org/?p=linux%2Fhotplug%2Fudev.git;a=commitdiff_plain;h=d2c9a56e0e624ed448aed8ad18460deed63973e1
+
+don't write to sysfs files during test run
+---
+
+diff --git a/udev_rules.c b/udev_rules.c
+index f8844a8..5078f2d 100644
+--- a/udev_rules.c
++++ b/udev_rules.c
+@@ -861,8 +861,9 @@ try_parent:
+ info("writing '%s' to sysfs file '%s'", value, attr);
+ f = fopen(attr, "w");
+ if (f != NULL) {
+- if (fprintf(f, "%s", value) <= 0)
+- err("error writing ATTR{%s}: %s", attr, strerror(errno));
++ if (!udev->test_run)
++ if (fprintf(f, "%s", value) <= 0)
++ err("error writing ATTR{%s}: %s", attr, strerror(errno));
+ fclose(f);
+ } else
+ err("error opening ATTR{%s} for writing: %s", attr, strerror(errno));
+From: Pozsar Balazs <pozsy@uhulinux.hu>
+Date: Fri, 23 Mar 2007 16:21:46 +0000 (+0100)
+Subject: udevsettle: read udev not kernel seqnum first
+X-Git-Url: http://git.kernel.org/?p=linux%2Fhotplug%2Fudev.git;a=commitdiff_plain;h=4e2b290821d083361260f8cdbe7c54886463673e
+
+udevsettle: read udev not kernel seqnum first
+---
+
+diff --git a/udevsettle.c b/udevsettle.c
+index 9e3e03b..f76ad71 100644
+--- a/udevsettle.c
++++ b/udevsettle.c
+@@ -110,9 +110,9 @@ int main(int argc, char *argv[], char *envp[])
+ goto exit;
+ }
+
+- /* read current kernel seqnum */
+- strlcpy(filename, sysfs_path, sizeof(filename));
+- strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename));
++ /* read current udev seqnum */
++ strlcpy(filename, udev_root, sizeof(filename));
++ strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
+ fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ goto exit;
+@@ -121,12 +121,12 @@ int main(int argc, char *argv[], char *envp[])
+ if (len <= 0)
+ goto exit;
+ seqnum[len] = '\0';
+- seq_kernel = strtoull(seqnum, NULL, 10);
+- info("kernel seqnum = %llu", seq_kernel);
++ seq_udev = strtoull(seqnum, NULL, 10);
++ info("udev seqnum = %llu", seq_udev);
+
+- /* read current udev seqnum */
+- strlcpy(filename, udev_root, sizeof(filename));
+- strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
++ /* read current kernel seqnum */
++ strlcpy(filename, sysfs_path, sizeof(filename));
++ strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename));
+ fd = open(filename, O_RDONLY);
+ if (fd < 0)
+ goto exit;
+@@ -135,8 +135,8 @@ int main(int argc, char *argv[], char *envp[])
+ if (len <= 0)
+ goto exit;
+ seqnum[len] = '\0';
+- seq_udev = strtoull(seqnum, NULL, 10);
+- info("udev seqnum = %llu", seq_udev);
++ seq_kernel = strtoull(seqnum, NULL, 10);
++ info("kernel seqnum = %llu", seq_kernel);
+
+ /* make sure all kernel events have arrived in the queue */
+ if (seq_udev >= seq_kernel) {
+
diff --git a/abs/core/klibc-udev/start_udev b/abs/core/klibc-udev/start_udev
new file mode 100755
index 0000000..8503bb9
--- /dev/null
+++ b/abs/core/klibc-udev/start_udev
@@ -0,0 +1,115 @@
+#! /bin/sh
+#
+# start_udev
+# script to initialize /dev by using udev.
+#
+# Modified for Archlinux by Tobias Powalowski <tpowa@archlinux.org>
+#
+# Inspired by:
+#
+# Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
+#
+# Released under the GPL v2 only.
+#
+# This needs to be run at the earliest possible point in the boot
+# process.
+#
+# Based on the udev init.d script
+#
+# Thanks go out to the Gentoo developers for proving
+# that this is possible to do.
+#
+# Yes, it's very verbose, feel free to turn off all of the echo calls,
+# they were there to make me feel better that everything was working
+# properly during development...
+
+prog=udev
+sysfs_dir=/sys
+bin=/sbin/udev
+udevd=/sbin/udevd
+udev_root="/dev"
+
+trigger_device_events ()
+{
+ /sbin/udevtrigger
+}
+
+wait_for_queue ()
+{
+ # disabled because it hangs network boot
+ #loop=20
+ #while ! [ "$loop" -gt 0 -a -d /dev/.udev/queue ]; do
+ # sleep 0.1;
+ # loop=$(($loop - 1))
+ #done
+ /sbin/udevsettle
+}
+
+make_extra_nodes ()
+{
+ # there are a few things that sysfs does not export for us.
+ # these things go here (and remember to remove them in
+ # remove_extra_nodes()
+ #
+ # Thanks to Gentoo for the initial list of these.
+ ln -sf /proc/self/fd $udev_root/fd
+ ln -sf /proc/self/fd/0 $udev_root/stdin
+ ln -sf /proc/self/fd/1 $udev_root/stdout
+ ln -sf /proc/self/fd/2 $udev_root/stderr
+ ln -sf /proc/kcore $udev_root/core
+}
+
+udev_init ()
+{
+# don't use udev if sysfs is not mounted.
+if [ ! -d $sysfs_dir/block ]; then
+ exit 1
+fi
+
+# Do not mount ramfs, we are already in ramfs
+#mount -t ramfs none $udev_root
+
+# propogate /udev from /sys
+#echo "Creating initial udev device nodes:"
+
+#echo "making extra nodes"
+make_extra_nodes
+
+# check if udevd is already running
+#echo "start udev daemon"
+/sbin/udevd --daemon
+
+case "$(uname -r)" in
+ 2.6.[0-9]|2.6.[0-9][!0-9]*) ;;
+ *) if [ -f "/sys/class/tty/console/uevent" ]; then
+ #echo "Kernel >= 2.6.15 and supports uevents"
+ # trigger the sorted events
+ echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
+ # catch events that are real fast
+ mkdir -p /dev/.udev/queue
+ else
+ # for older kernels without uevents will be removed when udevstart dies in udev
+ echo "Kernel does not support uevents, you need a kernel >= 2.6.15!"
+ exit 1
+ fi
+ ;;
+esac
+}
+
+udev_uevents ()
+{
+# configure all devices
+trigger_device_events
+# until we know how to do better, just wait for _all_ events to finish
+wait_for_queue
+}
+
+if [ $# -eq 0 ]; then
+udev_init
+udev_uevents
+fi
+
+[ "$1" = "init" ] && udev_init
+[ "$1" = "uevents" ] && udev_uevents
+
+exit 0
diff --git a/abs/core/klibc-udev/udev.rules b/abs/core/klibc-udev/udev.rules
new file mode 100644
index 0000000..22f422a
--- /dev/null
+++ b/abs/core/klibc-udev/udev.rules
@@ -0,0 +1,187 @@
+# Udev rules for Archlinux by Tobias Powalowski <tpowa@archlinux.org>
+#
+# This ruleset should provide a DevFS-compatible device tree.
+#
+# There are a number of modifiers that are allowed to be used in some
+# of the different fields. They provide the following subsitutions:
+#
+# %n the "kernel number" of the device.
+# For example, 'sda3' has a "kernel number" of '3'
+# %k the kernel name for the device.
+# %M the kernel major number for the device
+# %m the kernel minor number for the device
+# %b the bus id for the device
+# %c the string returned by the PROGRAM
+# %s{filename} the content of a sysfs attribute.
+# %% the '%' char itself.
+#
+# There are a number of modifiers that are allowed to be used in some of the
+# fields. See the udev man page for a full description of them.
+# global stuff
+#
+
+#####################################
+# Early rules - begin
+#####################################
+# wait for sysfs
+ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
+# Setting timeout for tape-devices (type 1) to 900 seconds
+# and 60 seconds for device types 0, 7 and 14
+SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60"
+SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900"
+#####################################
+# Early rules -end
+#####################################
+
+#####################################
+###### Hotplug rules - begin
+#####################################
+
+# Modaliases to load
+ACTION=="add", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/lib/udev/load-modules.sh $env{MODALIAS}"
+# SCSI addon modules
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/lib/udev/load-modules.sh sd_mod"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/lib/udev/load-modules.sh sd_mod"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/lib/udev/load-modules.sh sr_mod"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/lib/udev/load-modules.sh osst"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/lib/udev/load-modules.sh st"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/lib/udev/load-modules.sh st"
+ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[23689]", TEST!="[module/sg]", RUN+="/lib/udev/load-modules.sh sg"
+ACTION=="add", SUBSYSTEM=="mmc", RUN+="/lib/udev/load-modules.sh mmc_block"
+
+LABEL="hotplug_driver_loaded"
+
+# FIRMWARE
+ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="?*", RUN+="/lib/udev/firmware.sh"
+#####################################
+##### Hotplug rules - end
+#####################################
+
+#####################################
+###### CD/DVD symlinks - begin
+#####################################
+ACTION=="add", SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode"
+ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", IMPORT="/lib/udev/cdrom_id --export $tempnode"
+ACTION=="add", SUBSYSTEMS=="scsi", KERNEL=="scd[a-z]", IMPORT="/lib/udev/cdrom_id --export $tempnode"
+ENV{ID_CDROM}=="?*", SYMLINK+="cd/cdrom-%b"
+ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cd/cdrw-%b"
+ENV{ID_CDROM_DVD}=="?*", SYMLINK+="cd/dvd-%b"
+ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="cd/dvd-%b"
+#####################################
+###### CD/DVD symlinks - end
+#####################################
+
+#####################################
+##### PCMCIA rules - begin
+#####################################
+# PCMCIA devices:
+#
+
+# Very few CIS firmware entries (which we use for matching)
+# are so broken that we need to read out random bytes of it
+# instead of the manufactor, card or product ID. Then the
+# matching is done in userspace.
+ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/sbin/pcmcia-check-broken-cis.static"
+
+# However, the "weak" matching by func_id is only allowed _after_ modprobe
+# returns, so that "strong" matches have a higher priority.
+ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$devpath/allow_func_id_match'"
+
+# PCMCIA sockets:
+#
+# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work
+ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/lib/udev/load-modules.sh pcmcia"
+
+# if this is a PCMCIA socket which needs a resource database,
+# pcmcia-socket-startup sets it up
+ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/pcmcia-socket-startup.static"
+#####################################
+##### PCMCIA rules - end
+#####################################
+
+#######################################
+# Persistant block device stuff - begin
+#######################################
+# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name}
+# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
+
+# needed like this!!!
+ACTION!="add|change", GOTO="persistent_storage_end"
+#KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst"
+
+# type 8 devices are "Medium Changers"
+#KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+SUBSYSTEM!="block", GOTO="persistent_storage_end"
+
+# skip rules for inappropriate block devices
+# don't add dm-*!!!
+KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|md*", GOTO="persistent_storage_end"
+
+# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
+KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
+KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
+
+# ignore partitions that span the entire disk
+ATTR{whole_disk}=="*", GOTO="persistent_storage_end"
+
+# /sys/class/block will export this
+ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk"
+ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition"
+
+# for partitions import parent information
+ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"
+
+# by-id (hardware serial number)
+KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode"
+KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
+KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
+
+KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_SUBSYSTEMS}="ieee1394"
+KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="/lib/udev/usb_id --export %p"
+#KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode"
+#KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="/lib/udev/scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss"
+KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
+KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
+
+# libata compat (links like hd*)
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="/lib/udev/ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}"
+KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n"
+
+KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}"
+KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n"
+
+# by-path (shortest physical path) broken atm
+#ENV{DEVTYPE}=="disk", IMPORT{program}="/lib/udev/path_id %p"
+#ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
+#ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
+#KERNEL=="st*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}"
+
+KERNEL=="sr*|st*", GOTO="persistent_storage_end"
+KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end"
+
+# by-label/by-uuid (filesystem properties)
+IMPORT{program}="/lib/udev/vol_id --export $tempnode"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
+
+# BIOS Enhanced Disk Device
+ENV{DEVTYPE}=="disk", IMPORT{program}="/lib/udev/edd_id --export $tempnode"
+ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
+ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
+LABEL="persistent_storage_end"
+
+# md links hook into "change" events, when the array becomes available
+KERNEL!="md[0-9]*", GOTO="md_end"
+ACTION!="add|change", GOTO="md_end"
+
+ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
+IMPORT{program}="/lib/udev/vol_id --export $tempnode"
+OPTIONS="link_priority=100"
+ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
+ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}""
+
+LABEL="md_end"
+#####################################
+# Persistant block device stuff - end
+#####################################
diff --git a/abs/core/klibc-udev/udev_hook b/abs/core/klibc-udev/udev_hook
new file mode 100644
index 0000000..fc4c814
--- /dev/null
+++ b/abs/core/klibc-udev/udev_hook
@@ -0,0 +1,7 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Loading udev..."
+ /etc/start_udev
+ msg "done."
+}
diff --git a/abs/core/klibc-udev/udev_install b/abs/core/klibc-udev/udev_install
new file mode 100644
index 0000000..62d5b00
--- /dev/null
+++ b/abs/core/klibc-udev/udev_install
@@ -0,0 +1,31 @@
+# vim:set ft=sh:
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ 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/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/vol_id /lib/udev/vol_id
+ add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh
+}
+
+help ()
+{
+cat <<HELPEOF
+ This hook will use udev to create your root device node
+ and detect the needed modules for your root device.
+ It is recommended to use this hook instead of modload.
+HELPEOF
+}
diff --git a/abs/core/klibc-udev/vol_id-suspend2.patch b/abs/core/klibc-udev/vol_id-suspend2.patch
new file mode 100644
index 0000000..525e17e
--- /dev/null
+++ b/abs/core/klibc-udev/vol_id-suspend2.patch
@@ -0,0 +1,15 @@
+diff -Nur udev-103.orig/extras/volume_id/lib/linux_swap.c udev-103/extras/volume_id/lib/linux_swap.c
+--- udev-103.orig/extras/volume_id/lib/linux_swap.c 2006-10-20 14:43:35.000000000 +0200
++++ udev-103/extras/volume_id/lib/linux_swap.c 2006-10-29 17:15:19.000000000 +0100
+@@ -73,6 +73,11 @@
+ strcpy(id->type_version, "ulsuspend");
+ goto found_label;
+ }
++ if (memcmp(buf, "z", 1) == 0 || memcmp(buf, "Z", 1) == 0) {
++ id->type = "suspend";
++ strcpy(id->type_version, "suspend2");
++ goto found_label;
++ }
+ }
+ return -1;
+