Adding udev support?

Rob Landley rob at landley.net
Fri Oct 28 08:37:58 UTC 2005


I'm thinking of adding some simple udev support to busybox.

It's actually pretty simple to just populate /dev from /sys, the following 
shell script fragment does so if you don't care about persistent naming, 
permissions, or the fact that a shellscript that invokes so many sub-programs 
runs pretty darn slow:

----
function makedev
{
  j=`echo "$1" | sed 's .*/\(.*\)/dev \1 '`
  minor=`cat "$1" | sed 's .*:  '`
  major=`cat "$1" | sed 's :.*  '`
  mknod tmpdir/"$j" $2 $major $minor
}

for i in `find /sys/block -name "dev"`
do
  makedev "$i" b
  echo -n b
done

for i in `find /sys/class -name "dev"`
do
  makedev "$i" c
  echo -n c
done
-----

We're not talking brain surgery here.

The majority of udev support is actually the config file parsing (to handle 
persistent naming and permissions and such).  I haven't made very extensive 
use of udev, nor read through the existing code, so I'm not sure how much of 
this is really necessary in an embedded setting, and how much can hide behind 
a CONFIG_ option.

Anybody else taken a look at this yet?

Rob



More information about the busybox mailing list