0

I'm using a buildroot-built Linux image with busybox, and mdev used to manage insertion and removal of USB devices.

As a test, I tried adding the following line to my /etc/mdev.conf file:

sd([a-z])([0-9]+)   root:root 660  =drive%1%2

As far as I understand, the %1 and %2 ought to capture the parenthesized tokens matched from the regular expression and substitute those in. However this isn't what happens.

However, when I insert a USB storage device, I instead get a file literally named /dev/drive%1%2 appearing among my devices, instead of say, /dev/drivea1.

What am I doing wrong, and could this have something to do with how Buildroot does the busybox configuration?

1 Answers1

4

You need to enable CONFIG_FEATURE_MDEV_RENAME_REGEXP in the busybox configuration, which is disabled in the default busybox configuration bundled with Buildroot.

To enable it, launch make busybox-menuconfig and go to Linux System Utilities -> mdev -> Support /etc/mdev.conf -> Support subdirs/symlinks -> Support regular expressions substitutions when renaming device.

Luca Ceresoli
  • 1,591
  • 8
  • 19