summaryrefslogtreecommitdiffstats
path: root/main/busybox-initscripts/mdev.initd
blob: 6638ec44898324c1f89d22f3f60f066494b17819 (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/device -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 
}