mdev coldplugging

Natanael Copa natanael.copa at gmail.com
Wed Jul 19 12:57:36 UTC 2006


On Tue, 2006-07-18 at 07:19 -0400, Rob Landley wrote:
> On Monday 17 July 2006 5:47 pm, Natanael Copa wrote:

[ about mdev ]

> > It does not even look for NIC's. /sys/bus/*/devices*/
> 
> Since when do NICs have /dev entries?  (I admit they _should_, but that's not
> how Berkeley decided to add networking support in the late 70's.)

They don't. Thats the point. udev will load the correct module for my
NIC even though it does not have a /dev entry. mdev don't.

If I get time next week I'll take a closer look at it. I suspect I need
to patch mdev to first look for a modalias file and run modprobe if
found, and then do the /dev stuff. Next week.

> > mdev -s is cool. It creates lots more of /dev/ttyXX than udev. That does
> > not matter. I need to link a script to hd? devices that checks if its a
> > cdrom and create the necessary link(s).
> 
> That's why we added shellout support in /etc/mdev.conf.  Something like:
> 
> hd[a-z]  0:0 660 @ln -s $MDEV cdrom

I wrote an extrnal script that creats cdrom, cdrom0, cdrom1, cdrom2 etc,
when you "plug" it. It also removes so '*' should be used in mdev.conf. 

It also creates disk, disk0, disk1 etc and should be able to create
tape, tape0, tape1 etc (or whatever media type you plug on the IDE bus).

[ -f /proc/ide/$MDEV/media ] || exit

media=`cat /proc/ide/$MDEV/media`

case "$ACTION" in
        add)    num=`ls ${media}[0-9]* | wc -l`
                ln -sf $MDEV "$media`echo $num`"
                [ -e "$media" ] || ln -sf $MDEV "$media"
                ;;
        remove)
                # try to find the link and remove it
                for i in $media `ls ${media}[0-9]*` ; do
                        [ `readlink $i` = $MDEV ] && rm $i
                done
                ;;
esac

> > I did a test here. I ran mdev -s. I trigged all uevents in /sys with
> > mdev in /proc/sys/kernel/hotplug. I scanned /sys for modalias and loaded
> > the module (worked thanks to Yann's patch)
> 
> Did I already merge this patch?  If not poke me, but I leave for OLS in about
> 10 minutes... :)

You didn't. Could you please do?

I would really like to see it in 1.2.1. ;)

> > The goal is, whatever hardware you have on your system, it should just
> > work. Whatever hardware you plug, it should just work. (as long as you
> > have the useland tools installed)
> 
> Yup.  I'm all for it.  Let me know if I need to fix anything, or if you come
> up with a good config file for the examples directory.

I will test the above a bit, next week hopefully, and try to solve the
rest of the issues. (like loading the modules using modalias) If I come
up with something useable I'll share it here fo rinclusion in examples
dir.

> > It was more work than I thought...
> 
> Yeah, but less so with mdev than udev, I think.  Then again, I'm biased. :)

yes you are. :-) Udev from gentoo has all the necessary scripts/config
files. I just have to install the package and hardware is just found.

But I'll give mdev a try. It's *way* smaller.

Thanks!

--
Natanael Copa




More information about the busybox mailing list