world leader in high performance signal processing
Trace: » mdev

Busybox's Mini Dev (mdev)

Busybox's mdev is a bare bones program for dynamically managing /dev/ such as:

  • naming conventions
    • symlinks / subdirs / etc…
  • permissions
  • ownership
  • executing helper scripts automatically

All default ADI boards will program /sbin/mdev into /sys/kernel/hotplug at boot as well as install a simple /etc/mdev.conf. At boot, the default /etc/rc will also run mdev -s to handle the initial population step (aka coldplugging).

Example Configs

Default ADI mdev.conf

Here is the default mdev.conf that we use with ADI boards.

file: vendors/AnalogDevices/common/mdev.conf

scm failed with exit code 1:
file does not exist in git

We handle some common things like:

  • placing sound device nodes in snd/ like ALSA needs
  • placing input device nodes in input/ like input framework expects
  • sticking the tun device in net/ like tun documentation shows

For all these nodes, we also:

  • 0:0: set the owner/group to root (uid/gid of 0)
  • 0664: set permissions so to let everyone to read by default

Automatic Device Mounting

If you want to automatically run a script whenever storage devices (such as USB disks) are connected, then you can do something like so:

([hs]d[a-z])([0-9]+)	root:disk	660	@/sbin/mount-helper-plug.sh

Conversely, if you want to run a script whenever storage devices are removed, you can do something like so:

([hs]d[a-z])([0-9]+)	root:disk	660	$/sbin/mount-helper-unplug.sh

The device name that mdev matched against will be passed in via the environment variable $MDEV.

mdev Documentation

Here is the full mdev docs from upstream.

scm failed with exit code 1: