Add usb driver and related scripts to OpenWrt

Source: Internet
Author: User

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]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.