[Toybox] Pondering mdev...

Isaac ibid.ag at gmail.com
Tue Aug 20 21:24:59 PDT 2013


On Tue, Aug 20, 2013 at 03:08:37PM -0500, Rob Landley wrote:
> On 08/19/2013 11:13:15 PM, Isaac wrote:
> >Hello,
> >I've noticed that in mdev coldplug (mdev -s) is supported, but
> >hotplug is
> >TODO.
> >I also note that an optional (busybox) fourth field is not supported.
> >This is >dir/ to link  or =dir/ to move the device into /dev/dir/;
> >
> >mice		root:root 0766 =input/
> >#creates /dev/input/mice
> >
> >is one example.
> >Without these mdev creates a flat directory not grouped by subsystem.
> >
> >I'm thinking about poking at mdev and seeing if I can add these
> >features.
> >Any thoughts on this (higher priorities, hints as to how to proceed)?
> 
> These days mdev should depend on devtmpfs being there, so I'm not
> sure how much is left for it to do. That handles populating the
> directory, making entries show up and go away, getting permissions
> and even ownership right (albeit for a hardwired list of uid/gid
> that Greg KH thought was a good idea). The kernel is now handling
> firmware loading.

Unless you have to use an older kernel (I'm using 2.6.32 on one computer 
because ath5k doesn't work and madwifi-hal is the only driver that does, 
but it's abandoned now), want to use different permissions/gids, need to load
firmware for a proprietary driver (IIRC, the kconfig entry for userspace 
firmware loading claims that out-of-tree drivers need a hotplug helper; 
of course I haven't tested), 
or you use a set of paths that doesn't match the kernel default.

> 
> At the design level: what is mdev needed for?
 
The biggest reason to have a hotplug helper now is to autoload modules.

I guess that means modprobe is higher up.
(Do we want to use depmod when we use modprobe? The alternative is doing a 
file-by-file search, which is more complicated.)

And a different hotplug helper might be in order; shell-wise, someone 
might use something vaguely like this:

#!/bin/sh
[ -n "$MODALIAS" ] && { modprobe -bq "$MODALIAS" || env >>/var/log/nodriver }
#Read from disk to trigger enumeration of partitions-is this still needed?
if [ -n "${DEVNAME}" -a -n "${DEVTYPE}" ]
  case $DEVTYPE in
  disk)
  dd if=/dev/$DEVNAME of=/dev/null count=1
  ;;
  *) ;;
  esac
fi



Thanks,
Isaac Dunham

 1377059099.0


More information about the Toybox mailing list