libusbx

Yocto's libusbgx provide start/stop scripts to create gadgets from schema upon system start:

usbgx.service

gadget-start sh script:

examples

because ffs instances should be mounted and both descriptors and strings should be written to ep0. For more details about FunctionFS please refer to FunctionFS documentation in linux kernel repository.