Getting started with mdev

Rob Landley rob at landley.net
Thu Dec 14 14:04:11 PST 2006


On Thursday 14 December 2006 12:09 am, Trevor Harmon wrote:
> Hi,
> 
> I need some help getting started with mdev. I tried to find some  
> documentation on it, but there doesn't seem to be much out there.

My fault.  What do you need?

> I started with an empty /dev, but that causes a failure on boot:  
> "Warning: unable to open an initial console."

You need /dev/console in your initramfs.  This is a funky kernel thing.  I 
don't know why they don't just create it, ask linux-kernel.  The default 
initramfs has one.

> I then manually created an entry for /dev/console, and that allows  
> the system to boot, but /dev still isn't being populated. All I see  
> is the /dev/console entry I created myself. And yet, the system seems  
> to be running fine otherwise.

Your init script needs to do:

  mount -t sysfs /sys /sys
  mdev -s

Also, I tend to do:
  mount -t tmpfs /dev /dev

Before calling mdev.  That's optional, but it gives you a writeable tmpfs 
instance, which you can "mount --move" from initramfs to your final root 
device, and doesn't have anything left over from last time if your / is 
writeable.

> I also note that there is no /sys directory, even though I have  
> CONFIG_SYSFS enabled in my kernel. Is this why mdev is not  
> populating /dev?

You have to mount it.

Did you run mdev?  "mdev -s" will scan /sys and create all the devices it 
finds under /dev.  "echo /sbin/mdev > /proc/sys/kernel/hotplug" should 
register the sucker so it'll get called each time a device is inserted or 
removed, so it can update /dev.

Rob
-- 
"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