Annotation of /trunk/busybox/mdev.rc
Parent Directory | Revision Log
Revision 1113 -
(hide annotations)
(download)
Sun Aug 22 16:43:06 2010 UTC (14 years, 2 months ago) by niro
File size: 1902 byte(s)
Sun Aug 22 16:43:06 2010 UTC (14 years, 2 months ago) by niro
File size: 1902 byte(s)
-added
1 | niro | 1113 | #!/bin/sh |
2 | # $Header: /root/magellan-cvs/src/busybox/mdev.rc,v 1.1 2010-08-22 16:43:06 niro Exp $ | ||
3 | |||
4 | seed_dev() | ||
5 | { | ||
6 | # seed /dev with some things that we know we need | ||
7 | rc_print " Seeding /dev with needed nodes ..." | ||
8 | ( | ||
9 | [ ! -c /dev/console ] && mknod /dev/console c 5 1 | ||
10 | [ ! -c /dev/tty1 ] && mknod /dev/tty1 c 4 1 | ||
11 | [ ! -c /dev/null ] && mknod /dev/null c 1 3 | ||
12 | |||
13 | # create kmsg too, so udev can add its start-message to dmesg | ||
14 | [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11 | ||
15 | |||
16 | # copy over any persistant things | ||
17 | if [[ -d /lib/udev/devices ]] | ||
18 | then | ||
19 | cp -RPp /lib/udev/devices/* /dev 2>/dev/null | ||
20 | fi | ||
21 | |||
22 | # not provided by sysfs but needed | ||
23 | ln -snf /proc/self/fd /dev/fd | ||
24 | ln -snf fd/0 /dev/stdin | ||
25 | ln -snf fd/1 /dev/stdout | ||
26 | ln -snf fd/2 /dev/stderr | ||
27 | [[ -e /proc/kcore ]] && ln -snf /proc/kcore /dev/core | ||
28 | |||
29 | # create problematic directories | ||
30 | mkdir -p /dev/pts /dev/shm | ||
31 | ) | ||
32 | evaluate_retval | ||
33 | } | ||
34 | |||
35 | # main functions | ||
36 | start_devicemanager() | ||
37 | { | ||
38 | # create a ramdisk for populating mdev | ||
39 | rc_print "Mounting mdev at /dev ..." | ||
40 | # many video drivers needed exec access | ||
41 | fstype=ramfs | ||
42 | # tmpfs was suggested by Greg Kroah-Hartman | ||
43 | kernel_supports_fs tmpfs && fstype=tmpfs | ||
44 | # mount devtmpfs if supported | ||
45 | kernel_supports_fs devtmpfs && fstype=devtmpfs | ||
46 | mount -n -t ${fstype} mdev /dev -o exec,nosuid,mode=0755,size=1024 | ||
47 | evaluate_retval | ||
48 | |||
49 | # other eeded device nodes with udev | ||
50 | seed_dev | ||
51 | |||
52 | if [ -e /proc/sys/kernel/hotplug ] | ||
53 | then | ||
54 | rc_print " Using mdev for hotplug events ..." | ||
55 | echo "/sbin/mdev" > /proc/sys/kernel/hotplug | ||
56 | evaluate_retval | ||
57 | else | ||
58 | rc_print ${COLYELLOW}" Kernel was not compiled with hotplug support !" | ||
59 | print_status failure | ||
60 | fi | ||
61 | |||
62 | # load unix domain sockets if built as module | ||
63 | if [ -e /proc/modules ] | ||
64 | then | ||
65 | modprobe -q unix 2>/dev/null | ||
66 | fi | ||
67 | |||
68 | rc_print " Starting mdev ..." | ||
69 | /sbin/mdev -s | ||
70 | evaluate_retval | ||
71 | |||
72 | # same thing as /dev/.devfsd | ||
73 | touch /dev/.mdev | ||
74 | } | ||
75 | |||
76 | stop_devicemanager() | ||
77 | { | ||
78 | return 0 | ||
79 | } |