我想实现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
Yaoming Qin:
你用的什么板子,什么sdk,实际上ti的sdk是可以自动生成节点的,不需要做修改。
micheal:
回复 Yaoming Qin:
用的是AM3505,参考AM3517EVM,自己开发的板子,
SDK:ti-sdk-am3517-evm-05.02.00.00-Linux-x86-Install
USB使用的OTG模式,没有外设usb芯片,通过otg访问u盘,
必须手动mdev -s命令,在/dev下才会出现节点
Yaoming Qin:
回复 micheal:
1. 请使用AM35x最新的kernel,在最新的kernel上,对otg的driver有改进
2. 请使用mini-A的usb 口来接otg口。
micheal:
回复 Yaoming Qin:
请给一个SDK的下载地址
Yaoming Qin:
回复 micheal:
arago-project.org/…/projects