Add usb driver and related scripts to OpenWrt
Step 1: Add Kernel support
Openwrt compilation supports the USB automatic mount Function
Make menuconfig
1) Add USB support
Kernel modules-> USB Support-> <*> kmod-usb-core.
Kernel modules-> USB Support-> <*> kmod-usb-ohci.
Kernel modules-> USB Support-> <*> kmod-usb-uhci.
Kernel modules-> USB Support-> <*> kmod-usb-storage.
Kernel modules-> USB Support-> <*> kmod-usb-storage-extras.
Kernel modules-> USB Support-> <*> kmod-usb2.
2) Add SCSI support
Kernel modules-> Block Devices-> <*> kmod-scsi-core
3) add USB mounting
Base system-> <*> block-mount
4). Add an automatic mounting tool
Utilities-> Filesystem-> <*> badblocks
5). Add File System Support
Kernel modules-> Filesystems-> kmod-fs-ext4
Kernel modules-> Filesystems-> <*> kmod-fs-vfat
Kernel modules-> Filesystems-> <*> kmod-fs-ntfs
6). Add UTF8 encoding, CP437 encoding, ISO8859-1 Encoding
Kernel modules-> Native Language Support-> kmod-nls-cp437
Kernel modules-> Native Language Support-> kmod-nls-iso8859-1
Kernel modules-> Native Language Support-> kmod-nls-utf8
Utilities ---> disc ---> <*> fdisk .............................. ...... manipulate disk partition table
Utilities ---> <*> usbutils ................................. .. USB devices listing utilities
Step 2: Enable automatic mounting
Df should be able to see the mounted USB hard disk.
Below is a boot script for the vrousb to automatically mount the USB hard disk at startup.
Vim/etc/init. d/usbdisk
Write script:
#!/bin/sh /etc/rc.common
START=99
STOP=10
start() {
mount -t ext3 -o noatime /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
}
stop()
{
sync
umount /dev/scsi/host0/bus0/target0/lun0/part1
}
restart()
{
stop
start
}
Add executable permissions
Chmod 755/etc/init. d/usbdisk
Add to startup directory
Ln-s/etc/init. d/usbdisk/etc/rc. d/S99usbdisk
Step 3: Hot swapping support
Automatically mount the script and create a 30-usbmount file in/etc/hotplug. d/block,#! /Bin/shCase "$ ACTION" inAdd)For I in $ (ls/dev/| grep 'sd [a-z] [1-9] ')DoMkdir-p/mnt/$ IMount-o iocharset = utf8, rw/dev/$ I/mnt/$ IIf ["$? "-Ne 0]; thenMount-o rw/dev/$ I/mnt/$ IFiDone;;Remove)MOUNT = 'mount | grep-o '/mnt/sd [a-z] [1-9]'' For I in $ MOUNT DoUmount $ IDone;;Esac
Http://wenku.baidu.com/link? Url = Response ###]
[Related resources come from the network]