I have a pretty outdated embedded linux driven system with v2.6.33.7 kernel, which came without USBNET and CDC_ETHER modules. I compiled those modules to be able to attach a certain USB-LAN stick, that works with the CDC driver, which is loaded by the USBNET module. Now I copied the modules to the folder /lib/modules/

It is possible to load the cdc_ether module using insmod but modprobe gives me an error.
After insmodding the usbnet module, dmesgshows:
usbnet: exports duplicate symbol usbnet_resume (owned by kernel).
Also if I try to unload the usbnet module I get the error:
FATAL: Module usbnet is builtin

After insmodding the cdc_ether module dmesg shows success:
eth1: register 'cdc_ether' at usb-mxc-ehci.0-1, CDC Ethernet Device, fc:8f:c4:06:e8:9c usbcore: registered new interface driver cdc_ether
If I start up cdc_ether module manually there is an ethernet adapter eth1 available to the system, which in turn can be sucessfully configured using ifconfig.

How is it possible to autoload the module when the stick gets plugged in? I have had a look at the udev driver rules, which seem to load kernel modules, and also at the modules.* files in /lib/modules/ ... no luck. What is the missing piece to get this working?

I just found out, looking in the compile time configuration file /proc/config.gz that the usbnet module was supposed to be builtin by the company that compiled my kernel as it is stated there CONFIG_USB_USBNET=y So I basically need to run the cdc_ether module when the stick is plugged in by a udev rule, right?

I was able to grab the modules.* files that have been built and put them into the old kernel folder /lib/modules/ The effect is, modprobe now knows the modules when trying to load them using modprobe.

Since usbnet module is built in, it runs right away from the startup. Only cdc_ether module needs to be started then. After getting modprobing to work I need hotplugging mechanism. For ease of coding I added cdc_ether to /etc/modules. The module is loaded at bootup. I had the network configuration file /etc/network/interfaces edited properly bit the new interface eth1 would never get its IP when it was brought up, because it was somehow already configured. So I added a udev rule which flushes the addresses of each eth-device that gets taken down.

#ACTION=="add",SUBSYSTEM=="usb",DRIVER=="cdc_ether",RUN+="/sbin/modprobe cdc_ether"
ACTION=="add",SUBSYSTEM=="net",RUN+="/sbin/ifup %k"
ACTION=="remove",SUBSYSTEM=="net",RUN+="/sbin/ifdown %k",RUN+="/sbin/ip addr flush %k"

I can't get the hotplug module loading to work, that's why I seem to have to stick with the loading at system startup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.