USB gadget configuration through configfs on VIM3l

Hello,
I’ve been trying to use my khadas vim3l as a USB device who can both be used as a router and a mass storage device.
This is something I have already done on a rpi4 at my place using configfs with a bash script looking like this:
https://pastebin.com/raw/b1qTDrPd

Using the same script on vim3l on a 4.9 ubuntu i can only get the RNDIS gadget working and not the mass storage and neither of the two on a 5+ ubuntu image.

I think I am missing something somewhere but since it’s something very new for me I can’t find any solution.

I am hoping someone could help me find a solution.
Thank you.

Expect you will need to make sure the appropriate options are set in the kernel and rebuild if they aren’t there.
There’s more info in this thread How to get USB OTG port to work in Device mode?