Kernel config

CONFIG_USB_CONFIGFS_SERIAL=y
CONFIG_USB_CONFIGFS_ACM=y
CONFIG_USB_CONFIGFS_OBEX=y
CONFIG_USB_CONFIGFS_NCM=y
CONFIG_USB_CONFIGFS_ECM=y
CONFIG_USB_CONFIGFS_ECM_SUBSET=y
CONFIG_USB_CONFIGFS_RNDIS=y
CONFIG_USB_CONFIGFS_EEM=y
CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_LB_SS=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y

Mass Storage

dd if=/dev/zero of=/tmp/storage1 bs=1M count=32
mkfs.vfat /tmp/storage1
mount -oloop /tmp/storage1 /mnt
echo test > /mnt/jacob
umount /mnt

mkdir /sys/kernel/config/usb_gadget/g2  -m 0770 
echo 0x2207 > /sys/kernel/config/usb_gadget/g2/idVendor 
echo 0x0006 > /sys/kernel/config/usb_gadget/g2/idProduct
mkdir /sys/kernel/config/usb_gadget/g2/strings/0x409   -m 0770 
echo "rockchip"  > /sys/kernel/config/usb_gadget/g2/strings/0x409/manufacturer
echo "rk3xxx"  > /sys/kernel/config/usb_gadget/g2/strings/0x409/product

mkdir /sys/kernel/config/usb_gadget/g2/functions/mass_storage.0
echo /tmp/storage1 > /sys/kernel/config/usb_gadget/g2/functions/mass_storage.0/lun.0/file

mkdir /sys/kernel/config/usb_gadget/g2/configs/c.1  -m 0770
mkdir /sys/kernel/config/usb_gadget/g2/configs/c.1/strings/0x409  -m 0770 
ln -s  /sys/kernel/config/usb_gadget/g2/functions/mass_storage.0 /sys/kernel/config/usb_gadget/g2/configs/c.1
echo 120 > /sys/kernel/config/usb_gadget/g2/configs/c.1/MaxPower
echo "mass storage" > /sys/kernel/config/usb_gadget/g2/configs/c.1/strings/0x409/configuration

echo "ff580000.usb" > /sys/kernel/config/usb_gadget/g2/UDC