aboutsummaryrefslogtreecommitdiffstats
path: root/udev
diff options
context:
space:
mode:
authorChris Larson <clarson@kergoth.com>2004-11-04 01:14:26 +0000
committerChris Larson <clarson@kergoth.com>2004-11-04 01:14:26 +0000
commite953321afa8bc455165fda55cd5590b090f8913d (patch)
tree21400dee30129002337ff97ef7887fbd01b9fc66 /udev
parent80963c310aa97f38a410746f648cc792a9c9b017 (diff)
downloadopenembedded-e953321afa8bc455165fda55cd5590b090f8913d.tar.gz
Unbork udev.
BKrev: 41898272KJeryTLaS0L10yiizH1lqQ
Diffstat (limited to 'udev')
-rw-r--r--udev/udev-042/init176
-rw-r--r--udev/udev_042.oe38
2 files changed, 214 insertions, 0 deletions
diff --git a/udev/udev-042/init b/udev/udev-042/init
index e69de29bb2..4e31881274 100644
--- a/udev/udev-042/init
+++ b/udev/udev-042/init
@@ -0,0 +1,176 @@
+#!/bin/sh -e
+
+PATH="/usr/sbin:/usr/bin:/sbin:/bin"
+
+UDEVSTART=/sbin/udevstart
+
+# default maximum size of the /dev ramfs
+ramfs_size="1M"
+
+[ -x $UDEVSTART ] || exit 0
+
+. /etc/udev/udev.conf
+
+case "$(uname -r)" in
+ 2.[012345].*)
+ echo "udev requires a kernel >= 2.6, not started."
+ exit 0
+ ;;
+esac
+
+if ! grep -q '[[:space:]]ramfs$' /proc/filesystems; then
+ echo "udev requires ramfs support, not started."
+ exit 0
+fi
+
+if [ ! -e /proc/sys/kernel/hotplug ]; then
+ echo "udev requires hotplug support, not started."
+ exit 0
+fi
+
+##############################################################################
+
+# we need to unmount /dev/pts/ and remount it later over the ramfs
+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 ramfs over /dev, if somebody did not already do it
+mount_ramfs() {
+ if grep -E -q "^[^[:space:]]+ /dev ramfs" /proc/mounts; then
+ return 0
+ fi
+
+ # /.dev is used by /sbin/MAKEDEV to access the real /dev directory.
+ # if you don't like this, remove /.dev/.
+ [ -d /.dev ] && mount --bind /dev /.dev
+
+ echo -n "Mounting a ramfs over /dev..."
+ mount -n -o size=$ramfs_size,mode=0755 -t ramfs none /dev
+ echo "done."
+}
+
+# I hate this hack. -- Md
+make_extra_nodes() {
+ 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 --mode=600 /dev/$name $arg1
+ ;;
+ *)
+ echo "unparseable line ($type $name $arg1)"
+ ;;
+ esac
+ done
+}
+
+##############################################################################
+
+if [ "$udev_root" != "/dev/" ]; then
+ echo "WARNING: udev_root != /dev/"
+
+case "$1" in
+ start)
+ if [ -e "$udev_root/.udev.tdb" ]; then
+ if mountpoint -q /dev/; then
+ echo "FATAL: udev is already active on $udev_root."
+ exit 1
+ else
+ echo "WARNING: .udev.tdb already exists on the old $udev_root!"
+ fi
+ fi
+ mount -n -o size=$ramfs_size,mode=0755 -t ramfs none $udev_root
+ echo -n "Creating initial device nodes..."
+ $UDEVSTART
+ echo "done."
+ ;;
+ stop)
+ start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
+ echo -n "Unmounting $udev_root..."
+ # unmounting with -l should never fail
+ if umount -l $udev_root; then
+ echo "done."
+ else
+ echo "failed."
+ fi
+ ;;
+ restart|force-reload)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+ exit 0
+fi # udev_root != /dev/
+
+##############################################################################
+# 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/.udev.tdb" ]; then
+ if mountpoint -q /dev/; then
+ echo "FATAL: udev is already active on $udev_root."
+ exit 1
+ else
+ echo "WARNING: .udev.tdb already exists on the old $udev_root!"
+ fi
+ fi
+ unmount_devpts
+ mount_ramfs
+ ACTION=add
+ echo -n "Creating initial device nodes..."
+ $UDEVSTART
+ make_extra_nodes
+ echo "done."
+# /etc/init.d/mountvirtfs start
+ ;;
+ stop)
+ start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
+ unmount_devpts
+ echo -n "Unmounting /dev..."
+ # unmounting with -l should never fail
+ if umount -l /dev; then
+ echo "done."
+ umount -l /.dev || true
+# /etc/init.d/mountvirtfs start
+ else
+ echo "failed."
+ fi
+ ;;
+ restart|force-reload)
+ start-stop-daemon --stop --exec /sbin/udevd --oknodo --quiet
+ echo -n "Recreating device nodes..."
+ ACTION=add
+ $UDEVSTART
+ make_extra_nodes
+ echo "done."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/udev/udev_042.oe b/udev/udev_042.oe
index e69de29bb2..01209744d3 100644
--- a/udev/udev_042.oe
+++ b/udev/udev_042.oe
@@ -0,0 +1,38 @@
+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"
+PR = "r1"
+
+SRC_URI = "http://kernel.org/pub/linux/utils/kernel/hotplug/udev-${PV}.tar.gz \
+ file://flags.patch;patch=1 \
+ file://tmpfs.patch;patch=1 \
+ file://noasmlinkage.patch;patch=1 \
+ file://init"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "udev"
+INITSCRIPT_PARAMS = "start 03 S ."
+
+export HOSTCC = "${BUILD_CC}"
+export udevdir ?= "/udev"
+export usrbindir := "${bindir}"
+export usrsbindir := "${sbindir}"
+export etcdir = "${sysconfdir}"
+LD = "${CC}"
+bindir = "/bin"
+sbindir = "/sbin"
+
+UDEV_EXTRAS = "extras/scsi_id/ extras/volume_id/"
+FILES_${PN} += "${usrbindir} ${usrsbindir}"
+EXTRA_OEMAKE = "-e \
+ 'EXTRAS=${UDEV_EXTRAS}' \
+ 'STRIP=echo'"
+
+do_install () {
+ install -d ${D}/${usrsbindir} \
+ ${D}/${sbindir}
+ oe_runmake 'DESTDIR=${D}' install
+ install -d ${D}/${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/udev
+}