diff options
Diffstat (limited to 'meta/packages/busybox/busybox-1.9.1/busybox-mdev.sh')
-rwxr-xr-x | meta/packages/busybox/busybox-1.9.1/busybox-mdev.sh | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/packages/busybox/busybox-1.9.1/busybox-mdev.sh b/meta/packages/busybox/busybox-1.9.1/busybox-mdev.sh new file mode 100755 index 0000000000..9744322fa9 --- /dev/null +++ b/meta/packages/busybox/busybox-1.9.1/busybox-mdev.sh | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/bin/sh | ||
2 | MDEV=/sbin/mdev | ||
3 | DESC="Busybox mdev setup" | ||
4 | |||
5 | # Complain if thing's aren't right | ||
6 | if [ ! -e /proc/filesystems ]; then | ||
7 | echo "mdev requires a mounted procfs, not started." | ||
8 | exit 1 | ||
9 | fi | ||
10 | |||
11 | if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then | ||
12 | echo "mdev requires tmpfs support, not started." | ||
13 | exit 1 | ||
14 | fi | ||
15 | |||
16 | if [ ! -d /sys/class/ ]; then | ||
17 | echo "mdev requires a mounted sysfs, not started." | ||
18 | exit 1 | ||
19 | fi | ||
20 | |||
21 | if [ ! -e /proc/sys/kernel/hotplug ]; then | ||
22 | echo "mdev requires hotplug support, not started." | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | # We need to unmount /dev/pts/ and remount it later over the tmpfs | ||
27 | if mountpoint -q /dev/pts/; then | ||
28 | umount -l /dev/pts/ | ||
29 | fi | ||
30 | |||
31 | if mountpoint -q /dev/shm/; then | ||
32 | umount -l /dev/shm/ | ||
33 | fi | ||
34 | |||
35 | # Create tmpfs for /dev | ||
36 | echo "Creating tmpfs at /dev" | ||
37 | mount -t tmpfs tmpfs /dev -o size=800k | ||
38 | |||
39 | # Register mdev as hotplug event helper | ||
40 | echo "$MDEV" > /proc/sys/kernel/hotplug | ||
41 | |||
42 | # Populate /dev from /sys info | ||
43 | echo "Populating /dev using mdev" | ||
44 | $MDEV -s | ||
45 | |||
46 | # Touch .udev to inform scripts that /dev needs no further setup | ||
47 | touch /dev/.udev | ||
48 | |||
49 | # Mount devpts | ||
50 | TTYGRP=5 | ||
51 | TTYMODE=620 | ||
52 | mkdir -m 755 -p /dev/pts | ||
53 | if [ ! -e /dev/ptmx ]; then | ||
54 | mknod -m 666 /dev/ptmx c 5 2 | ||
55 | fi | ||
56 | mount -t devpts devpts /dev/pts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE | ||
57 | |||
58 | # Make shm directory | ||
59 | mkdir -m 755 -p /dev/shm | ||
60 | |||
61 | # Make extraneous links | ||
62 | ln -sf /proc/self/fd /dev/fd | ||
63 | ln -sf /proc/self/fd/0 /dev/stdin | ||
64 | ln -sf /proc/self/fd/1 /dev/stdout | ||
65 | ln -sf /proc/self/fd/2 /dev/stderr | ||
66 | ln -sf /proc/kcore /dev/core | ||
67 | ln -sf /proc/asound/oss/sndstat /dev/sndstat | ||
68 | |||
69 | exit 0 | ||