Friday, December 02, 2011

Setting up a driver as dkms in Debian 6

So I have this weird intel 4-port network card. It uses the igb driver. Now after switching from Ubuntu to Debian 6, I could not get any traffic over the ports. It seems the version delivered with Debian is too old to correctly support my card. So I decided to add the current driver, which can be downloaded here, as a dkms package. This means that the driver is automatically recompiled every time the kernel is updated. Here's how I did this:

  • first prepare the driver source. In this case, the tar.gz contains a src directory, so I moved everything from the src directory to the main directory: cd igb-3.2.10; mv src/* .
  • next, we need a dkms.conf file (place this inside the source code's tree), here's mine:
    PACKAGE_NAME="igb"
    PACKAGE_VERSION="3.2.10"
    CLEAN="make clean"
    BUILT_MODULE_NAME[0]="igb"
    DEST_MODULE_NAME[0]="igb"
    DEST_MODULE_LOCATION="/updates"
    AUTOINSTALL="yes"
  • from the directory where you extracted the source (and added the dkms.conf file), execute the command to 'add' this source as a dkms:dkms add -m igb -v 3.2.10
  • now build and install the source: dkms build -m igb -v 3.2.10; dkms install -m igb -v 3.2.10
  • finally, create the dsc and the .deb file: dkms mkdsc -m igb -v 3.2.10 --source-only; dkms mkdeb -m igb -v 3.2.10 --source-only
  • now we need to install the dkms on the local machine. But before we do that, we need to remove the created dkms from the system as it conflicts with the created package. mv the .deb file and install it: cp /var/lib/dkms/igb/3.2.10/deb/igb-dkms_3.2.10_all.deb ~; rm -r /var/lib/dkms/igb; dpkg -i ~/igb-dkms_3.2.10_all.deb

 

msp430-rf2500 & linux

I bought the msp430-rf2500. A development kit for the msp430 with a wireless 2.4 GHz transceiver. This is an USB programmer with 2 development boards containing an msp430F2274 microcontroller and a CC2500 transceiver. The USB programmer allows to communicate with the UART in the msp430. Under Windows this works fine. Under Linux however, it does not.
After searching high and low, I found a way to successfully connect to the UART without issues. I did this using Debian 6.0.3, kernel version 2.6.32-5-686.
Here's how:

  • disconnect the development board from the USB programmer
  • put the USB programmer (only the programmer!) in the USB port
  • use dmesg to find the device that it registered (/dev/ttyACM0 in my case).
  • now type (replacing ttyACM0 with the device name you found earlier): stty 9600 -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke -F /dev/ttyACM0
  • next open the port and start reading from it (for example using minicom, or cat /dev/ttyACM0)
  • and NOW you can put the development board in.

The issue seems to be that the UART is flooding the ACM device, which then decides to disconnect.
Happy hacking!