Power & Source of Big Ideas

Initializing g_cdc at boot time?

Moderators: chensy, FATechsupport

The following commands allow me to use IP-over-USB instead of a serial connection:
su
modprobe -r g_mass_storage
modprobe g_cdc
ifconfig usb0 netmask 255.255.255.0 192.168.13.2

However, I'm not sure how to cause this to happen a boot time. I use Raspbian and Gentoo, but I've never used sun8xi before and I'm unsure of the init system. I don't understand where the init scheme is deciding to load g_mass_storage, so I don't know how to tell it to load g_cdc instead. I can probably figure out the static IP init myself.
DanClemmensen wrote:
The following commands allow me to use IP-over-USB instead of a serial connection:
su
modprobe -r g_mass_storage
modprobe g_cdc
ifconfig usb0 netmask 255.255.255.0 192.168.13.2

However, I'm not sure how to cause this to happen a boot time. I use Raspbian and Gentoo, but I've never used sun8xi before and I'm unsure of the init system. I don't understand where the init scheme is deciding to load g_mass_storage, so I don't know
how to tell it to load g_cdc instead. I can probably figure out the static IP init myself.


Most of available systems are Debian (systemd) compatible:

Recompile kernel with build-in support or:
- blacklist g_mass_storage (check /etc/modprobe.d/blacklist.conf)
- add g_cdc to /etc/modules
Thanks, Igor.
I had figured out a variant of this. Since g_mass_storage is loaded during init, not during boot, I was able to keep it from loading by removing its entry from the modprobe.d directory. I added g_cdc to /etc/modules as you suggested.

To initialize the usb0 link, I added a static IP config to the file /etc/network/interfaces

I then configured my main Linux machine for IP forwarding and masquerade and plugged the NanoPi Duo into a USB port on the main machine. The the usb0 interface came up: I can ssh to it, and it can access the Internet.

I installed xorg and (after some fiddly configuration) used ssh -Y to connect, and I can run X GUI apps on the NanoPi with the windows showing up on my screen.

My goal is to be able to start with an unused NanoPi Duo and a pristine MicroSD image, then mount the image on my main Linux machine, run a script to modify the image and write it to a MicroSD card, and boot the NanoPi without needing anything except a single USB cable.

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 2 guests