OpenWRT automatically mount support

添加USB相关支持Kernel modules —> USB Support —> <*> kmod-usb-core.  ##默认已经选了
Kernel modules —> USB Support —> <*> kmod-usb-ohci.  ##默认已选 old usb1.0
Kernel modules —> USB Support —> <*> kmod-usb-uhci.  ## usb1.1
Kernel modules —> USB Support —> <*> kmod-usb-storage.
Kernel modules —> USB Support —> <*> kmod-usb-storage-extras.
Kernel modules —> USB Support —> <*> kmod-usb2.  ##默认已经选了 usb2.0添加SCSI支持
Kernel modules —> Block Devices —> <*>kmod-scsi-core  ##默认已经选了 usb3.0添加USB挂载
Base system —> <*>block-mount添加文件系统支持
Kernel modules —> Filesystems —> <*> kmod-fs-ext4 (移动硬盘EXT4格式选择)
Kernel modules —> Filesystems —> <*> kmod-fs-vfat(FAT16 / FAT32 格式 选择)
Kernel modules —> Filesystems —> <*> kmod-fs-ntfs (NTFS 格式 选择)
退出保存 make V=99
自动挂载U盘:
编辑 /etc/hotplug.d/block/10-mount 写入以下内容#!/bin/ash

#!/bin/ash

dev=$DEVICENAME
echo "$DEVICENAME" | grep -q 'sd[a-z][1-9]'
if [ $? -ne 0 ]; then
    exit 0
fi
case "$ACTION" in
    add)
        mkdir -p /mnt/$dev
        mount -o nls=utf8,rw /dev/$dev /mnt/$dev
        if [ $? -ne 0 ]; then
            mount -o rw /dev/$dev /mnt/$dev
        fi
        ;;
    remove)
        umount /mnt/$dev && rm -r /mnt/$dev
        ;;
esac

Original link
Disclaimer: This article is the original article CSDN bloggers "linux_zhu", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https://blog.csdn.net/u011641885/article/details/46530327

Guess you like

Origin www.cnblogs.com/sudochen/p/12009247.html