Setting up the Beaglebone's usb0 interface on Debian's armmp kernel



The default images the Beagleboard project provides come with a preconfigured usb0 interface. I had been unable to replicate that with Debian's multiplatform armmp kernel, which is why I started building my own kernels. I recently found out that all one needs, however, is the g_ether module loaded (it doesn't autoload). I feel a bit silly about this because I intended to test this again on the armmp kernel a while ago, since the whole idea about Debian for me is cutting down on maintenance and minimising the custom stuff that takes so much time.

Since I'm not going to start tinkering with uBoot and initrds, and it doesn't work out of the box, I have added some code in /etc/rc.local that runs in the background:

(
  sleep 5
  modprobe g-ether
  sleep 5
  ip link set usb0 up
  ip addr add 192.168.7.2/24 dev usb0
  ip route add default via 192.168.7.1
) &

That makes the usb0 interface available pretty quickly after startup, and I sleep better knowing there is a backup interface when I mess up the Ethernet configuration, playing with VLANs and whatnot. The one downside to Debian's own kernel though is it claims a lot more space than a trimmed kernel (modules alone are 100 MB), and I haven't found a good way on Debian to compress modules yet - that's on the todo list.