aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox-initscripts/mdev.initd
blob: 74f1a4c2335649c7ea587eab338f86e1c65d6d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/sbin/runscript

depend() {
	provide dev
	need sysfs mdev-mount
	before checkfs fsck
	keyword novserver
}

start() {
	# check if udev is specified on cmd line
	if get_bootparam "udev"; then
		ewarn "Skipping mdev as udev requested in kernel cmdline"
		return 0
	fi
	
	ebegin "Starting busybox mdev"
	mkdir -p /dev

	# use mdev for hotplug
	echo "/sbin/mdev" > /proc/sys/kernel/hotplug
	
	# mdev -s will not create /dev/usb[1-9] devices with recent kernels
	# so we trigger hotplug events for usb for now
	for i in $(find /sys/devices -name 'usb[0-9]*'); do
		[ -e $i/uevent ] && echo add > $i/uevent
	done

	# create devices
	mdev -s
	eend $?
}

stop() {
	ebegin "Stopping busybox mdev"
	echo "" > /proc/sys/kernel/hotplug
	eend 
}