我想实现u盘设备的自动挂载,已经按照《mdev实现U盘或SD卡的自动挂载》一文配置了内核
以及busybox,mdev.config等设置,但是启动文件系统后,插上u盘,/dev目录下没有产生设备
节点,查看/sys/block目录是有uda1即u盘设备的,为什么不会在/dev下产生节点呢?如果在系统启动
前就插上u盘,启动系统后/dev下是有设备节点的,拔下u盘在插上,就不会产生了,为什么?
相关配置文件如下:rcS, fstab, mdev.conf
rcS文件
#!/bin/sh
# ---------------------------------------------
# Common settings
# ---------------------------------------------
HOSTNAME=ICONTROL_3I
VERSION=1.0.0
hostname $HOSTNAME
# ---------------------------------------------
# Prints execution status.
#
# arg1 : Execution status
# arg2 : Continue (0) or Abort (1) on error
# ---------------------------------------------
status ()
{
if [ $1 -eq 0 ] ; then
echo "[SUCCESS]"
else
echo "[FAILED]"
if [ $2 -eq 1 ] ; then
echo "... System init aborted."
exit 1
fi
fi
}
# ---------------------------------------------
# Get verbose
# ---------------------------------------------
echo ""
echo " System initialization..."
echo ""
echo " Hostname : $HOSTNAME"
echo " Filesystem : v$VERSION"
echo ""
echo ""
echo " Kernel release : `uname -s` `uname -r`"
echo " Kernel version : `uname -v`"
echo ""
# ---------------------------------------------
# MDEV Support
# (Requires sysfs support in the kernel)
# ---------------------------------------------
echo -n " Mounting /proc : "
mount -n -t proc /proc /proc
status $? 1
echo -n " Mounting /sys : "
mount -n -t sysfs sysfs /sys
status $? 1
echo -n " Mounting /dev : "
mount -n -t tmpfs mdev /dev
status $? 1
echo -n " Mounting /dev/pts : "
mkdir /dev/pts
mount -t devpts devpts /dev/pts
status $? 1
echo -n " Enabling hot-plug : "
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
status $? 0
echo -n " Populating /dev : "
mkdir /dev/input
mkdir /dev/snd
mdev -s
status $? 0
# ---------------------------------------------
# Mount the default file systems
# ---------------------------------------------
echo -n " Mounting other filesystems : "
mount -a
status $? 0
# ---------------------------------------------
# Set PATH
# ---------------------------------------------
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
export QT_QWS_FONTDIR=/usr/lib/fonts
export QWS_KEYBOARD=TTY:/dev/input/event0
export QWS_DISPLAY="LinuxFB:mmWidth154:mmHeight86:0"
# ---------------------------------------------
# Start other daemons
# ---------------------------------------------
echo -n " Starting syslogd : "
/sbin/syslogd
status $? 0
#echo -n " Starting telnetd : "
#/usr/sbin/telnetd
#status $? 0
# ---------------------------------------------
# Done!
# ---------------------------------------------
echo ""
echo "System initialization complete."
# ---------------------------------------------
# Start demo app
# ---------------------------------------------
#if [[ -x /etc/init.d/iControl ]]; then
# echo " Starting iControl Application..."
# /etc/init.d/iControl
# sleep 5
#fi
fstab文件
proc /proc proc defaults 0 0
none /dev/pts devpts mode=0622 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
mdev.conf文件
ub[a-z][0-9] 0:0 0660 @/etc/hotplug/usb/udisk_insert
ub[a-z] 0:0 0660 $/etc/hotplug/usb/udisk_remove