1.内核中usb相关配置:
USB support │ │
│ │ <*> Support for Host-side USB
│ │ <*> EHCI HCD (USB 2.0) support
│ │ <*> Generic EHCI driver for a platform device │ │
│ │ <*> OXU210HP HCD support │ │
│ │ <*> ISP116X HCD support │ │
│ │ <*> FOTG210 HCD support │ │
│ │ < > MAX3421 HCD (USB-over-SPI) support │ │
│ │ <*> OHCI HCD (USB 1.1) support │ │
│ │ <*> Generic OHCI driver for a platform device │ │
│ │ <*> SL811HS HCD support
│ │ <*> USB Mass Storage support
2.USB热插拔配置:
> Device Drivers > Generic Driver Options >Generic Driver Options
│ │ [ * ] Support for uevent helper
打开之后会出现/proc/sys/kernel/hotplug设备,可解决hotplug不存在的问题 ;
3.buildroot中busybox有关mdev配置
buildroot中执行如下命令
#make busybox-menuconfig
选择
Linux System Utilities --->
[ * ]mdev
[ * ] Support /etc/mdev.conf
[ * ] Support subdirs/symlinks
[ * ] Support regular expressions substitutions when renaming device
[ * ] Support command execution at device addition/removal
[ * ] Support loading of firmwares
4. /etc/init.d/rcS中增加如下配置
echo /sbin/mdev > /proc/sys/kernel/hotplug
5.在/etc/下建立mdev.conf的文件,添加如下配置:
sd[a-z][0-9] 0:0 666 @(/etc/hotplug/insert.sh $MDEV $SUBSYSTEM)
sd[a-z] 0:0 666 $(/etc/hotplug/remove.sh $MDEV $SUBSYSTEM)
ub[a-z][0-9] 0:0 666 @(/etc/hotplug/insert.sh $MDEV $SUBSYSTEM)
ub[a-z] 0:0 666 $(/etc/hotplug/remove.sh $MDEV $SUBSYSTEM)
mmcblk[0-9]p[0-9] 0:0 666 @(/etc/hotplug/insert.sh $MDEV $SUBSYSTEM)
mmcblk[0-9] 0:0 666 $(/etc/hotplug/remove.sh $MDEV $SUBSYSTEM)
6.在/etc/下建立以下文件夹hotplug,并在hotplug目录下建立insert.sh和remove.sh文件,并填下如下脚本文件:
insert.sh:
if [ -n "$1" ] ; then
if [ -b /dev/$1 ]; then
if [ ! -d /media ]; then
mkdir -p /media
fi
if [ ! -d /media/$1 ]; then
mkdir -p /media/$1
fi
mount /dev/$1 /media/$1
if [ $? -ne 0 ]; then
rm -rf /media/$1
fi
fi
fi
remove.sh:
MOUNTS=$(mount | grep $1 | cut -d' ' -f3)
umount $MOUNTS
rm -rf $MOUNTS
重启设备,插入U盘可以自动挂载到/media目录,亲测可正常挂载和卸载;
挂载:
卸载:
最近编辑记录 hanzixi_angel (2021-06-23 18:32:59)
离线
# echo host > /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
# cat /sys/devices/platform/soc/1c13000.usb/musb-hdrc.1.auto/mode
b_idle
# lsusb
Bus 001 Device 001: ID 1d6b:0002
我的USB 怎么是idle状态呢?
离线
楼主知道v3s如何挂载nfs么
离线
楼主知道v3s如何挂载nfs么
正点原子有教程
离线
请问,有些u盘插入后没有后面的数字,就挂载不了,如插入u盘,只显示 sda,
这种情况怎么处理呢
最近编辑记录 yuess133 (2022-10-08 15:33:13)
离线
好文章 ,5.2用这个搞很舒服
离线