Quick Kernel Module Action
From Codawiki
| Table of contents |
Word of Wisdom
You do not generally need to compile Coda kernel module yourself. It is already included with the standard Linux or FreeBSD kernel. (By the way, the Coda server does not need the kernel module, only Coda clients do).
To quickly test whether you already have the module, run modprobe coda on Linux, or kldstat -m coda on FreeBSD. If you see an affirmative output (or no output at all), you have the module.
Sometimes you will want to compile it yourself, however. The case may be that you already have a working Coda client (tested with the included module), but you want the latest bugfixes or module source that compiles with no build-time errors on new kernels (Linux 2.6 interface changes greatly even between minor revisions, such as 2.6.x and 2.6.x+1). Or it may be that you use a Linux distribution that does not include the Coda module (such as Red Hat) -- so when you have to compile the module anyway, use the latest version.
Obtaining the Module
For Linux, simply run:
cvs -d :pserver:anonymous@coda.cs.cmu.edu:/coda-src checkout linux-coda
As the FreeBSD coda module is maintained as part of the FreeBSD CVS tree, you can update your local src/sys tree using cvsup to download the latest source.
Compiling the Module
For Linux:
You first have to have kernel headers present on the system. The best way to check that you do (for 2.6 Linux kernels) is to do ls -al /lib/modules/`uname -r`/build. If that file is a directory or a symlink to an existing directory, you're all set. If not, install your kernel headers.
In the module source (the directory you obtained from CVS in the previous step), enter the directory appropriate for your kernel, such as linux2.6, and type make; the build procedure will figure everything on its own and compile the module.
If you need more help, some can be found at coda-howto-6.html (http://www.coda.cs.cmu.edu/doc/html/coda-howto-6.html).
For FreeBSD:
cd /usr/src/sys/modules/coda make
It is important that your Coda kernel module be synchronized with the version of the kernel you are running, both in terms of KPI (programming interface) and ABI (binary interface). As such, it is recommended that, if you update the Coda module source, you also update your entire kernel to be synchronized with it. Since FreeBSD builds the code module as part of its normal kernel build, it is therefore also sufficient do:
cd /usr/src make buildkernel KERNCONF=YOURCONFIG
Loading the Module
For Linux:
The compiled module will be named coda.ko (for linux 2.6) or coda.o (for older versions).
To load the coda module file into the kernel, you can run insmod coda.ko. Even better, you can copy the coda.ko module to the proper modules directory on your system, which will make it available to the command modprobe, to /etc/modules and to modutils package:
mkdir -p /lib/modules/`uname -r`/kernel/fs/coda/ cp coda.ko /lib/modules/`uname -r`/kernel/fs/coda/ depmod -a modprobe coda
Note that the module would automatically be loaded by the venus client cache manager at startup, if you do not load it yourself beforehand in some way (such as using file /etc/modules or the modprobe command).
For FreeBSD:
To install the module from the module build directory, run:
make install
If you have rebuilt the entire kernel with buildkernel, you can install from /usr/src with:
make installkernel KERNCONF=YOURCONFIG
To configure the module to load automatically at boot, add the following line to /boot/loader.conf:
coda_load="YES"
