Getting started with mdev

Rob Landley rob at
Thu Dec 14 22:41:14 UTC 2006

On Thursday 14 December 2006 4:58 pm, Trevor Harmon wrote:
> > IIRC there were a few files you should add to your static /dev:  
> > console,
> > null,
> Hmm... /dev/console is the only one I needed to boot and run BusyBox.

/dev/console is the only one used by the kernel _before_ execing init.  (In 
the 2.6.19 kernel, it's init/main.c line 768.)

> > <but i can't remember the rest>
> How would I find out what the rest are? Given that /dev is such an  
> important and fundamental part of Linux, it seems like this would be  
> written down somewhere. lists all known devices.

> > than you need to add /sys to your filsystem, and mount the sysfs there
> >
> >     mount -t sysfs none /sys
> >
> > once that is done you can run mdev in scan mode to populate /dev
> >
> >     mdev -s
> >
> > that should be it.
> That worked; thanks! I noticed that mdev created a lot of "standard"  
> entries in /dev, including null. I assume that means I don't have to  
> worry about manually creating them?

Yup.  There are entries for them under /sys, so mdev makes 'em.

> Also, what's the standard practice of having the above commands run  
> on every boot? Do I simply dump them into /etc/

Yup.  Personally, I mount a tmpfs on /dev so you don't have to worry about 
debris between boots.  (If mdev sees that a device already exists, it'll skip 
trying to create it, but mdev -s won't delete anything that's already there.  
Since tmpfs starts empty, they complement each other nicely.)

"Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away." - Antoine de Saint-Exupery

More information about the busybox mailing list