Chapter 2. Using the Linux driver

Table of Contents
Compiling and installing the driver modules
Hardware drivers
Encap drivers
Wacky routing tricks

This chapter will tell you how to compile, install, and load Linux-ARCnet driver modules so you can get up and running.

Older versions of the driver (currently, version 3.02) are in the Linux kernel already; if you already have a 2.2 kernel or above, you probably already have Linux-ARCnet 3.02. However, since this document is about the 3.90 BETA driver, I'm going to just assume that you want that one.

If you'd rather use the driver built into your kernel, there's some reasonably up-to-date information included with your kernel: /usr/src/linux/Documentation/networking/arcnet.txt

Why isn't 3.90 BETA in the kernel? Well, first of all, it's still in BETA testing (although tests seem to show that it's more stable than the older versions on non-Intel platforms and multiprocessor systems). Secondly, there are some features still missing from this beta test, so there are a few things that the older driver does that the new one can't.

Compiling and installing the driver modules

The first step is to download the source code to the latest version of the driver. You can find that on my web page: http://www.worldvisions.ca/~apenwarr/arcnet/

The file should be called arcnet-3.90.tar.gz, or something similar if there's a newer version available.

Unpack the .tar.gz

Now, you want to unpack the archive into some useful directory. Assuming you downloaded arcnet-3.90.tar.gz into your home directory, do this:

cd /usr/src
tar -xzvf ~/arcnet-3.90.tar.gz
cd arcnet

This creates a directory called /usr/src/arcnet with the new files in it.

Edit the makefile

Before you compile the source code and build the driver modules, you need to set a couple of options in the Makefile to tell it about your system settings. These settings are right in the top few lines of Makefile.

First, you need to point it at your Linux kernel source code. This assumes, of course, that you have the Linux kernel source code. You do, right? If not, you need to read some documentation about how to compile your kernel source. Read the HOWTO documents at http://metalab.unc.edu/linux/ for more information about that.

Now that you've compiled, installed, and booted your kernel (I tested version 2.2.13; I don't know about any other versions) and you know where you left the source code for it, you need to edit the line

LINUXSRC=/usr/src/linux

in /usr/src/arcnet/Makefile. Replace /usr/src/linux with the directory where you have your kernel source. /usr/src/linux is a pretty typical place for it.

There is also another line to edit, which looks like this:

REQUIRE_RFC1201=-DCONFIG_ARCNET_REQUIRE_RFC1201

Here's the story: in older versions of the Linux-ARCnet driver, you could enable or disable the RFC1051 and ethernet-encap support when you configured your kernel, and then when you loaded the driver module, you always got all the encapsulations you requested (plus RFC1201, which you couldn't disable).

That's changed since version 3.80. Now, we always build all the encapsulation modules, and the supported encapsulations depend on which modules you load. You don't even have to have the standard RFC1201 if you don't want. So, people who don't read this documentation will probably try to install the driver and load the modules, like with older versions, and find out it won't work because they forgot to load the RFC1201 support.

To prevent this, the driver has a backwards compatibility mode called REQUIRE_RFC1201. If this is set (which is the default line you see above), then loading an ARCnet device driver module will automatically load the RFC1201 module as well. That makes it work like older versions of the driver.

On the other hand, since you're reading this documentation, you understand that you have to load RFC1201 separately, and there's a chance that you might not want RFC1201. That's why we made it a separate module in the first place. To make the RFC1201 module optional, comment out the line by inserting a number sign (#) in front of it.

After making your changes, save Makefile and move on to the next step.

Compile the modules

This is supposed to be really easy, as long as the Makefile is set up correctly. Just type:

make 2>&1 | tee make.out

And you should get output that looks like this:

gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o arcnet.o arcnet.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o rfc1201.o rfc1201.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o rfc1051.o rfc1051.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o arc-rawmode.o arc-rawmode.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o com90xx.o com90xx.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o com20020base.o com20020base.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o com20020.o com20020.c
gcc -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2
	-fomit-frame-pointer -pipe -fno-strength-reduce -m486
	-malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586
	-DMODULE -DMODVERSIONS
	-include /usr/src/linux/include/linux/modversions.h -DEXPORT_SYMTAB
	-DCONFIG_ARCNET_REQUIRE_RFC1201 -c -o com20020pci.o com20020pci.c

Note the suspicious lack of any error messages above. That's because, if it works, you won't get any error messages. If you do get error messages, double check your changes to Makefile, and if Makefile looks okay, e-mail me the make.out file you just created so I can see what went wrong.

Install the modules and run depmod

After compiling the modules, you need to install them on your system. Make sure you're running the same Linux kernel that you have source code for in /usr/src/linux. Then, as the superuser (root), type the following:

make install
depmod -a

Depmod might give you messages like this:

/lib/modules/2.2.13/net/arc-rimi.o: unresolved symbol(s)
/lib/modules/2.2.13/net/com90io.o: unresolved symbol(s)

That's okay for now. Those two modules are left over from your original kernel installation, and they aren't supported by the 3.90 ARCnet driver yet, so they don't get replaced. Unless you have one of the cards that needs those drivers (and you probably don't) this doesn't matter to you.

If you do have a RIM I or COM90xx card with I/O mapped buffers, you should e-mail me to try to convince me to work harder on updating those drivers so they work with the new ARCnet layer.

Load the modules and set up the interface

You load the driver modules like this. Note that after reading the following sections, you'll probably want to change this a bit to meet your exact needs. These commands should get you up and running fast, though.

insmod arcnet
insmod rfc1201
insmod rfc1051
insmod arc-rawmode
insmod com90xx		# NOTE: if you don't use a COM90xx card, you need
			# to change this line to something else.  Read the
			# later sections to find out exactly what.

ifconfig arc0 192.168.1.1

None of the above commands should give you an error, or something has gone wrong. If you can't figure it out, feel free to e-mail me or the linux-arcnet mailing list about it.

To unload the driver modules, you do something similar, only backwards:

ifconfig arc0 down
rmmod com90xx
rmmod arc-rawmode
rmmod rfc1051
rmmod rfc1201
rmmod arcnet