First refer to these blogs to do some understanding: http://linux.chinaunix.net/techdoc/install/2009/11/18/1144936.shtml
Http://www.cnblogs.com/leaven/archive/2010/09/17/1828896.html, can also Baidu mdev.conf view other articles.
The kernel is sure to support Mdev and hotplug features.
Etc directory to have this file mdev.conf, the content is as follows (other similar):
SD[A-Z][0-9] 0:0 666 @/etc/hotplug/usb/udisk_insertsd[a-z] 0:0 666 $/etc/hotplug/usb/udisk_ REMOVEMMCBLK1P[0-9] 0:0 666 @/etc/hotplug/sd/sd_insertmmcblk1 0:0 666 $/etc/hotplug/sd/sd_remove
From the above can be seen dependent on four scripts, corresponding to the USB drive and SD card mount and uninstall.
Create the Udisk_insert and udisk_remove two scripts in the/ETC/HOTPLUG/USB directory with the following contents:
Udisk_insert:
#!/bin/shecho "Usbdisk insert!" >/dev/consoleif [-E "/dev/$MDEV"] ; then mkdir-p/mnt/usbdisk/$MDEV mo unt/dev/$MDEV/mnt/usbdisk/$MDEV fi
Udisk_remove:
#!/bin/shecho "Usbdisk remove!" >/dev/consoleumount-l/mnt/usbdisk/sd*rm-rf/mnt/usbdisk/sd*
Create the Sd_insert and sd_remove two scripts in the/ETC/HOTPLUG/SD directory with the following contents:
Sd_insert:
#!/bin/shecho "SD card insert!" >/dev/console if [-E "/dev/$MDEV"]; Then mkdir-p/mnt/sdcard/sd mount-rw/dev/$MDEV/mnt/sdcard/sd fi
Sd_remove:
#!/bin/shecho "SD card remove!" >/dev/consoleumount-l/mnt/sdcard/sd*rm-rf/mnt/sdcard/sd*
This enables automatic recognition of mounts and uninstalls.
Embedded Linux Implementation mdev SD card and USB stick automatic mount and unload method mdev.conf