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