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...
32 # handle block devices and their partitions
33 for i in ${sysfs_dir}/block/*; do
35 export DEVPATH=${i#${sysfs_dir}}
39 # add each partition, on each device
41 if [ -f $j/dev ]; then
42 export DEVPATH=${j#${sysfs_dir}}
48 # all other device classes
49 for i in ${sysfs_dir}/class/*; do
51 if [ -f $j/dev ]; then
52 export DEVPATH=${j#${sysfs_dir}}
53 CLASS=`echo ${i#${sysfs_dir}} | \
54 cut --delimiter='/' --fields=3-`
64 # there are a few things that sysfs does not export for us.
65 # these things go here (and remember to remove them in
66 # remove_extra_nodes()
68 # Thanks to Gentoo for the initial list of these.
69 ln -snf /proc/self/fd $udev_root/fd
70 ln -snf /proc/self/fd/0 $udev_root/stdin
71 ln -snf /proc/self/fd/1 $udev_root/stdout
72 ln -snf /proc/self/fd/2 $udev_root/stderr
73 ln -snf /proc/kcore $udev_root/core
79 # don't use udev if sysfs is not mounted.
80 if [ ! -d $sysfs_dir/block ]; then
84 echo "mounting... ramfs at $udev_root"
85 mount -n -t ramfs none $udev_root
87 # propogate /udev from /sys
89 export UDEV_NO_SLEEP=1
90 echo "Creating initial udev device nodes:"
93 echo "making extra nodes"
96 echo "udev startup is finished!"