Disaggregate

Disaggregate Technical Web Log

Technical information and commentary on a variety of topics.
Category: General Technology

October 27, 2004

Migrating Broadcom bcm5700 from 2.4 to 2.6

Here's a technical note on how to migrate from a Broadcomm bcm5700 Ethernet driver under Linux 2.4.x (bcm5700.o) to a 2.6.x driver (bcm5700.ko). I did this migration on a Debian system based on an Asus A7V8X, and I've found that the documentation on how to do this is a little scanty.

To start, get the source of the Broadcom driver:

apt-get install bcm5700-source

This will install itself in /usr/src as a gzip file. As root, go to the /usr/src directory and unpack the file:

tar zxf bcm5700-source.tar.gz

This creates a directory modules, under which will be a directory bcm5700 which contains the source code.

The next step is to compile the bcm5700 source code. You don't need to be running 2.6.x to do this. You do need the current headers of your target kernel image. E.g., if you want bcm5700 to work for 2.6.8-1-k7, you will need the kernel headers for 2.6.8-1-k7. You don't need the source for the entire kernel.

To get the kernel headers, use

apt-get kernel-headers-2.6.8-1-k7

or whatever is appropriate for your target kernel. The headers will appear in your /usr/src directory as well.

You need to make /usr/src/linux point to these kernel headers. On my system, /usr/src/linux is simply a symlink to a real directory. I removed the old symlink (rm linux) and used

ln -s kernel-headers-2.6.8-1-k7 linux

to create the symlink. To compile the bcm5700.ko module, go to the /usr/src/linux directory and type

make-kpkg modules

This will make a Debian package in the /usr/src directory. You can then use

dpkg -i bcm5700-module-2.6.8_7.3.5-3+10.00.Custom_i386.deb

(or whatever the Debian is called on your sytsem) to install the driver. However, I could not figure out how to persuade make-kpkg to give the proper version to the Debian package; as you can see above it thinks it made a driver for 2.6.8, not 2.6.8-1-k7. This means that when I did the dpkg -i to install the Debian package, Debian failed partway through and put the bcm5700.ko file into /lib/modules/2.6.8, instead of it's proper place in /lib/modules/2.6.8-1-k7. No worries -- I copied the driver from there to /lib/modules/2.6.8-1-k7/kernel/drivers/net/bcm5700.ko, and I was ready to go.

That's it for creating the driver module. Fairly straightforward.

However, that doesn't mean that the driver actually loaded when I booted up the sytsem &mdash something else grabbed control of the Ethernet interface. See my next technical note, about migrating from Linux 2.4 and its system of /etc/modules.conf to Linux 2.6 and its system of /etc/modprobe.d, for details on how to resolve this little problem.

Posted by Moshe Yudkowsky at October 27, 2004 08:29 PM