summaryrefslogtreecommitdiff
path: root/packages/busybox/busybox-1.2.2/busybox-mdev.sh
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2006-10-28 16:46:42 +0000
committerKoen Kooi <koen@openembedded.org>2006-10-28 16:46:42 +0000
commit636c4d45c334995c2fa1bdbd72617bdfab30e850 (patch)
tree7e287d663575ea2594c10573bf24a31f6078e12a /packages/busybox/busybox-1.2.2/busybox-mdev.sh
parentd92174e738d4e8a0674a9bc7c2d5a0e777e9d936 (diff)
busybox: add support files for 1.2.2
Diffstat (limited to 'packages/busybox/busybox-1.2.2/busybox-mdev.sh')
-rwxr-xr-xpackages/busybox/busybox-1.2.2/busybox-mdev.sh69
1 files changed, 69 insertions, 0 deletions
diff --git a/packages/busybox/busybox-1.2.2/busybox-mdev.sh b/packages/busybox/busybox-1.2.2/busybox-mdev.sh
new file mode 100755
index 0000000000..9744322fa9
--- /dev/null
+++ b/packages/busybox/busybox-1.2.2/busybox-mdev.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+MDEV=/sbin/mdev
+DESC="Busybox mdev setup"
+
+# Complain if thing's aren't right
+if [ ! -e /proc/filesystems ]; then
+ echo "mdev requires a mounted procfs, not started."
+ exit 1
+fi
+
+if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then
+ echo "mdev requires tmpfs support, not started."
+ exit 1
+fi
+
+if [ ! -d /sys/class/ ]; then
+ echo "mdev requires a mounted sysfs, not started."
+ exit 1
+fi
+
+if [ ! -e /proc/sys/kernel/hotplug ]; then
+ echo "mdev requires hotplug support, not started."
+ exit 1
+fi
+
+# We need to unmount /dev/pts/ and remount it later over the tmpfs
+if mountpoint -q /dev/pts/; then
+ umount -l /dev/pts/
+fi
+
+if mountpoint -q /dev/shm/; then
+ umount -l /dev/shm/
+fi
+
+# Create tmpfs for /dev
+echo "Creating tmpfs at /dev"
+mount -t tmpfs tmpfs /dev -o size=800k
+
+# Register mdev as hotplug event helper
+echo "$MDEV" > /proc/sys/kernel/hotplug
+
+# Populate /dev from /sys info
+echo "Populating /dev using mdev"
+$MDEV -s
+
+# Touch .udev to inform scripts that /dev needs no further setup
+touch /dev/.udev
+
+# Mount devpts
+TTYGRP=5
+TTYMODE=620
+mkdir -m 755 -p /dev/pts
+if [ ! -e /dev/ptmx ]; then
+ mknod -m 666 /dev/ptmx c 5 2
+fi
+mount -t devpts devpts /dev/pts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
+
+# Make shm directory
+mkdir -m 755 -p /dev/shm
+
+# Make extraneous links
+ln -sf /proc/self/fd /dev/fd
+ln -sf /proc/self/fd/0 /dev/stdin
+ln -sf /proc/self/fd/1 /dev/stdout
+ln -sf /proc/self/fd/2 /dev/stderr
+ln -sf /proc/kcore /dev/core
+ln -sf /proc/asound/oss/sndstat /dev/sndstat
+
+exit 0