您尚未登录。

楼主 # 2021-06-23 18:16:44

hanzixi_angel
会员
注册时间: 2020-09-21
已发帖子: 52
积分: 43.5

V3s linux5.2 U盘自动挂载配置

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目录,亲测可正常挂载和卸载;
挂载:
u-disk1.png
卸载:
u-disk2.png

最近编辑记录 hanzixi_angel (2021-06-23 18:32:59)

离线

#1 2022-06-03 18:04:48

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 236
积分: 309

Re: V3s linux5.2 U盘自动挂载配置

# 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状态呢?

离线

#2 2022-08-05 21:47:55

hahahah
会员
注册时间: 2022-06-15
已发帖子: 3
积分: 3

Re: V3s linux5.2 U盘自动挂载配置

楼主知道v3s如何挂载nfs么

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn