mdev once more

Natanael Copa natanael.copa at gmail.com
Thu Jul 5 13:43:40 UTC 2007


On Thu, 2007-07-05 at 15:08 +0300, Alex Kums wrote:
> Hi guys.
> 
> I cann't force mdev to work. My rootfs has a static /dev filesystem, and I 
> want to test how does mdev work.
> 
> I did as docs/mdev.txt suggests, after logging in with the following 
> script:
> 
> # cat /mnt/mkdev
> 
> #!/bin/sh
> 
> echo "Mounting sysfs"
> mount -t sysfs sysfs /sys
> echo "Echoing hotplug"
> echo /bin/mdev > /proc/sys/kernel/hotplug
> echo "mdev -s"
> mdev -s
> 
> echo "Mounting /dev"
> mount -t tmpfs mdev /dev
> echo "Creating /dev/pts"
> mkdir /dev/pts
> echo "Mounting pts"
> mount -t devpts devpts /dev/pts
> 
> # /mnt/mkdev
> Mounting sysfs
> Echoing hotplug
> mdev -s            # this takes few seconds
> Mounting /dev
> Creating /dev/pts
> Mounting pts
> 
> # ls /sys
> block    class       firmware  kernel     power
> bus      devices    fs            module
> # ls /dev/
> pts
> # ls /dev/pts
> #
> -----------------------------------------
> 
> There are no files in /dev and /dev/pts! Why ? 

Because you mount the tmpfs on /dev *after* mdev has created the
devices. If you unmount /dev you will find them. Try this:

# cat /mnt/mkdev
#!/bin/sh

echo "Mounting sysfs"
mount -t sysfs sysfs /sys

echo "Mounting /dev"
mount -t tmpfs mdev /dev

echo "Creating /dev/pts"
mkdir /dev/pts

echo "Mounting pts"
mount -t devpts devpts /dev/pts

echo "Echoing hotplug"
echo /bin/mdev > /proc/sys/kernel/hotplug

echo "mdev -s"
mdev -s



> My kernel is 2.6.20, and it 
> of course includes CONFIG_SYSFS, CONFIG_SYSFS_DEPRECATED and 
> CONFIG_HOTPLUG. Maybe I'm missing something ? :)
> 
> Thanks.






More information about the busybox mailing list