I've just started experimenting / working with a nano core and some serious work with linux. I wanted to test the usb gadget and make the nano core into a ethernet over usb.
So far I've managed to flash a custom rootfs using the instructions on: https://github.com/friendlyarm/sd-fuse_h3
which is the sd fuse git repository.
I've also looked into the Configfs and managed to create a script that will create a USB gadget with NCM function. I've created the script for init.d in the way it should be and placed it there in the rootfs and then use the sd fuse scripts to create an image to burn on to the sd card using linux dd command.
My nanopi core boots up from the SD card and I can see the script in /etc/init.d folder
The nanopi I can see has booted up automatic login for user 'pi'
The problem i'm facing is:
1. If I try executing the script, it throws permission denied errors when it tries to create folders for config/*
2. I've tried to change permission on the folders but user 'pi' is probably not allowed,
3. I tried sudo but sudo wont work and it gives an error: '/usr/bin/sudo must be owned by uid 0 and have the setuid bit set'
4. I tried to switch to super user using 'su' but that has not worked
5. I tried some solutions from the web for the setuid bit problem namely tried to run 'pkexec chmod a=rx,u+ws /usr/bin/sudo' (https://askubuntu.com/questions/584262/ ... id-bit-set) but that hasnt worked either.
6. tried to run modprobe g_ether but that hasnt worked either
7. I've tried also to give the script 777 permission before i made the img but that hasnt worked either

I'm not sure what can I try now.
Would really appreciate if someone can share any solution for this or atleast some other ways of getting around the problem.