openwrt - usb

 

有關 module:

  • kmod-usb-core                         <-- 必須
  • kmod-usb-ohci/uhci
  • kmod-usb2                              <--- EHCI
  • kmod-fs-ext4
  • usbutils

要有的 Kernel Modules:

  • ohci_hcd
  • usbcore

Load Module:

  • insmod usbcore
  • insmod ehci-hcd

 

讀 filesystem 的能力:

  • kmod-usb-storage                    <-- 提供 /etc/init.d/usb start, 令 /dev/sd* 出現
  • kmod-fs-ext4                           <-- ext2, ext3, ext4
  • mod-usb-storage-extras            <-- card readers
  • kmod-fs-msdos
  • kmod-fs-vfat                           <-- need to additionally install language packages

net:

  • kmod-fs-cifs
  • kmod-fs-nfs

 

 

Tools:

  • block-hotplug   <--  /etc/config/fstab
  • block-extroot   <--  rootfs on external storage

 


 

Mount

 

/etc/config/fstab

config mount
        option target   /mnt
        option device   /dev/sda1    # sda1 is ext3 partition
        option fstype   ext4        # but is mounted as ext4, since we have installed kmod-fs-ext4 only
        option options  rw,sync
        option enabled  1
        option enabled_fsck 1

mount -t ext4 /dev/sda1 /mnt -o rw,sync

/etc/init.d/fstab stop
/etc/init.d/fstab start

 


 

Disable writing when not mounted

 

touch /mnt/usbstorage/USB_DISK_NOT_PRESENT
chmod 444 /mnt/usbstorage -R

 

P.S. in your own scripts.

 


 

Virtual Disk

 

opkg install kmod-loop

insmod loop

opkg install kmod-loop

 


 

安裝 Package 在 USB-Stick:

/etc/opkg.conf
    dest usb /mnt/loopdisk

To install package:

    opkg -dest usb install package

To delete package:

    opkg -dest usb remove package

Creative Commons license icon Creative Commons license icon