linux gadget u盤(Mass storage)
1. kernel config
Device Drivers --->
[*] USB support --->
<*> USB Gadget Support
<*> USB Gadget functions configurable through configfs
[*] Mass storage
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_F_MASS_STORAGE=y
The Mass Storage Gadget acts as a USB Mass Storage disk drive.
As its storage repository it can use a regular file or a block
device (in much the same way as the "loop" device driver),
specified as a module parameter or sysfs option.
2. prepare a disk partition or loop device
2.1 loop device
dd if=/dev/zero of=/virtualfs bs=1024 count=307200 //300M
losetup /dev/loop0 /virtualfs
we create loop device on rootfs and choose loop device to test usb speed, since roofs is mounted on DDR and DDR speed is very fast.
3. start usb-storage
mkdir /etc/configfs
export CONFIGFS_HOME=/etc/configfs
mount none $CONFIGFS_HOME -t configfs
mkdir $CONFIGFS_HOME/usb_gadget/g2
cd $CONFIGFS_HOME/usb_gadget/g2
echo 0x2222 > idVendor
echo 0x1111 > idProduct
mkdir strings/0x409
echo 20200210 > strings/0x409/serialnumber
echo 999 > strings/0x409/manufacturer
echo 888 > strings/0x409/product
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo mass_storage > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPowerN
mkdir functions/mass_storage.usb0
echo /dev/loop0 >functions/mass_storage.usb0/lun.0/file
ln -s functions/mass_storage.usb0 configs/c.1
echo 500000.dwc3 > UDC
Note, if use disk partition
echo /dev/mmcblk0 >functions/mass_storage.usb0/lun.0/file
4. test
4.1 start usb storage
# ./usb-storage.sh
500000+0 records in
500000+0 records out
[ 88.768811] Mass Storage Function, version: 2009/09/11
[ 88.793798] LUN: removable file: (no medium)
#
# [ 143.501920] configfs-gadget gadget: super-speed config #1: c
4.2 plugin usb device into PC
format it,
相關文章
- Linux U盤啟動盤製作工具Linux
- linux的u盤的掛載Linux
- 48.Linux-普通U盤以及多分割槽U盤自動掛載Linux
- 固態u盤和普通u盤哪個好 固態u盤和普通u盤的區別
- 車載U盤和普通U盤哪個好 車載U盤和普通U盤的區別
- Linux 上製作多啟動 U 盤Linux
- 在U盤下安裝ubuntu20.04,從U盤啟動Linux系統UbuntuLinux
- 在Linux系統下製作U盤啟動盤Linux
- u盤安裝 oracle-linux redhat-linuxOracleLinuxRedhat
- VMwareWorkstation設定U盤啟動(或U盤使用)
- Linux:掛載外部U盤,移動資料Linux
- U盤安裝Linux紅帽子6.4系統Linux
- u盤製作系統盤
- Linux USB ECM Gadget 驅動介紹Linux
- 指令碼實現U盤自動掛載(linux)指令碼Linux
- Linux:從LiveCD到自啟動U盤薦Linux
- UltraISO製作U盤啟動盤AI
- u盤製作系統盤工具
- 如何對U盤檔案資料加密,U盤加密方法教程分享加密
- 在u盤上安裝linux 打造你的portable linux system.Linux
- linux如何系統掛載u盤複製檔案Linux
- win10使用U盤安裝Linux系統教程Win10Linux
- LINUX下掛載U盤,中文亂碼的問題Linux
- Linux Mint (應用軟體:U盤格式化工具)Linux
- U盤安裝中標麒麟linux V6.0教程Linux
- U盤啟動安裝Redhat Enterprise Linux 6.4RedhatLinux
- win10如何禁止使用u盤_win10怎麼禁用u盤Win10
- u盤3.0和2.0哪個好 u盤3.0和2.0的區別
- Linux製作系統啟動盤以及掛載和解除安裝U盤Linux
- USB gadget functionfsFunctionNFS
- U盤做系統教程
- u盤破解WiFi密碼WiFi密碼
- win10u盤啟動盤要多大容量_win10系統u盤啟動盤需要多少gWin10
- U盤如何製作win10安裝盤|win10安裝U盤製作方法Win10
- 移動U盤怎麼設定密碼 U盤加密最簡單方法密碼加密
- 不用U盤怎麼重灌系統 無u盤電腦重灌系統教程
- 有效防止u盤洩密的方法,u盤防洩密軟體推薦
- 快閃記憶體盤和普通u盤哪個好 快閃記憶體盤和u盤的區別記憶體