]>
git.ipfire.org Git - thirdparty/systemd.git/blob - extras/start_udev
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...
33 export UDEV_NO_SLEEP
=1
35 # handle block devices and their partitions
36 for i
in ${sysfs_dir}/block
/*; do
38 export DEVPATH
=${i#${sysfs_dir}}
42 # add each partition, on each device
44 if [ -f $j/dev
]; then
45 export DEVPATH
=${j#${sysfs_dir}}
51 # all other device classes
52 for i
in ${sysfs_dir}/class
/*; do
54 if [ -f $j/dev
]; then
55 export DEVPATH
=${j#${sysfs_dir}}
56 CLASS
=`echo ${i#${sysfs_dir}} | \
57 cut --delimiter='/' --fields=3-`
67 # there are a few things that sysfs does not export for us.
68 # these things go here (and remember to remove them in
69 # remove_extra_nodes()
71 # Thanks to Gentoo for the initial list of these.
72 ln -snf /proc
/self
/fd
$udev_root/fd
73 ln -snf /proc
/self
/fd
/0 $udev_root/stdin
74 ln -snf /proc
/self
/fd
/1 $udev_root/stdout
75 ln -snf /proc
/self
/fd
/2 $udev_root/stderr
76 ln -snf /proc
/kcore
$udev_root/core
82 # don't use udev if sysfs is not mounted.
83 if [ ! -d $sysfs_dir/block
]; then
87 echo "mounting... ramfs at $udev_root"
88 mount
-n -t ramfs none
$udev_root
90 # propogate /udev from /sys
91 echo "Creating initial udev device nodes:"
93 # You can use the shell scripts above by calling run_udev or execute udevstart
94 # which does the same thing, but much faster by not using shell.
95 # only comment out one of the following lines.
99 echo "making extra nodes"
102 echo "udev startup is finished!"