Our Linux kernel is 2.6.31 running on an embedded MIPS processor with busybox.
The initialisation script (rcS) starts mdev with:
echo "/sbin/stbhotplug" > /proc/sys/kernel/hotplug
mdev -s
Can anyone tell me what the Linux utility mdev does?
It looks like it does auto hot plugging as the stbhotplug is a script that handle ethernet interfaces.
Also, the rootfs we have been given only has a console device i.e. /dev/console
is the only file in /dev
.
However, when the system is running, the /dev
directory is full of device files (e.g. /dev/mtd
, etc.).
The reason I ask is that occasionally we get an error whereby it is reported that /dev/ubi_ctrl
is not found or /dev/ubi1
is not found.
How or when does Linux create these devices?
Thanks.
mdev is a light-weight alternative to udev for usage in embedded devices. Both handle the creation of device files in
/dev
and starting of actions when certain events happen.Here is a link to the mdev primer.
mdev
basically callsmknod
for a set of pre-configured device files.If you have a choice, use instead:
which automatically mounts the special devtmpfs filesystem under
/dev
, and allows modules to automatically create their own device files oninsmod
, as shown at: https://stackoverflow.com/questions/5970595/how-to-create-a-device-node-from-the-init-module-code-of-a-linux-kernel-module/45531867#45531867This is what Buildroot and most distros currently do by default.