5 # script to initialize /dev by using udev.
7 # Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
9 # Released under the GPL v2 only.
11 # This needs to be run at the earliest possible point in the boot
14 # Based on the udev init.d script
16 # Thanks go out to the Gentoo developers for proving
17 # that this is possible to do.
19 # Yes, it's very verbose, feel free to turn off all of the echo calls,
20 # they were there to make me feel better that everything was working
21 # properly during development...
34 # handle block devices and their partitions
35 for i in ${sysfs_dir}/block/*; do
37 export DEVPATH=${i#${sysfs_dir}}
41 # add each partition, on each device
43 if [ -f $j/dev ]; then
44 export DEVPATH=${j#${sysfs_dir}}
50 # all other device classes
51 for i in ${sysfs_dir}/class/*; do
53 if [ -f $j/dev ]; then
54 export DEVPATH=${j#${sysfs_dir}}
55 CLASS=`echo ${i#${sysfs_dir}} | \
56 cut --delimiter='/' --fields=3-`
66 # there are a few things that sysfs does not export for us.
67 # these things go here (and remember to remove them in
68 # remove_extra_nodes()
70 # Thanks to Gentoo for the initial list of these.
71 ln -snf /proc/self/fd $udev_root/fd
72 ln -snf /proc/self/fd/0 $udev_root/stdin
73 ln -snf /proc/self/fd/1 $udev_root/stdout
74 ln -snf /proc/self/fd/2 $udev_root/stderr
75 ln -snf /proc/kcore $udev_root/core
81 # don't use udev if sysfs is not mounted.
82 if [ ! -d $sysfs_dir/block ]; then
86 echo "mounting... ramfs at $udev_root"
87 mount -n -t ramfs none $udev_root
89 # propogate /udev from /sys
90 echo "Creating initial udev device nodes:"
92 # You can use the shell scripts above by calling run_udev or execute udevstart
93 # which does the same thing, but much faster by not using shell.
94 # only comment out one of the following lines.
98 echo "making extra nodes"
101 echo "udev startup is finished!"