Next Previous Contents

## 6. Configuring Kernels for use with Coda

Currently, Coda clients and servers are supported under Linux, FreeBSD and NetBSD.

The Coda servers may be run on unmodified kernels. The Coda `codasrv` process is user-level code that uses existing kernel services. The Venus client, however, requires some Coda-specific changes be made to the kernel. The kernel specific changes add Coda specific definitions to the Vnode layer in the kernel which are needed to satisfy the requirements of the Coda file system to the vfs layer in the kernel.

## 6.1 VFS Interface

In Unix systems, the code which translates user-generated system calls into file system requests is called the VFS Interface. Coda provides a VFS Interface by providing the necessary support for systems calls such as creat(), open(), stat(), etc.

Communication between Venus and the kernel occurs through a character device `/dev/cfs0` (part of Coda) which provides the kernel with access to Venus for handling the vsf<->vnode kernel interface. Please see Installing and Configuring a Coda Client for the major and minor device numbers specific to a supported platform.

The rest of this chapter will focus on integrating the Coda code that satisfies the Vnode interface into the kernels of supported platforms.

## 6.2 Configuring a Linux kernel

Coda may be configured as a module or hard-coded in a ``monolithic'' kernel. We have a reasonably flexible method to build kernel modules. You can build the module for a kernel which you are not running at the time of the build.

To build a custom coda kernel module you need to obtain the tarball from:

ftp://ftp.coda.cs.cmu.edu/pub/coda/linux/src/linux-coda-4.6.2.tgz

And follow the instructions in the rest of this file.

NOTE: The code here is always newer than or equal to:

- the kernel
- the big Coda tarball

### To Build 2.1 kernels modules

- Patch the kernel: For 2.1.10? kernels apply the 106patch. This will go to Linus shortly, so this patch may stop working. You must type the following:

  > `

  >     make oldconfig
  >     make dep
  >     make your-type-of-image and modules.

  > `

- In this directory build the coda.o module: type:

  > `

  >     make config  --- answer the questions
  >     make coda.o
  >     su
  >     make install

  > `

### To Build 2.0 kernel modules

- Prep the kernel by typing:

  > `

  >     cd /usr/src/linux-for-you
  >     make oldconfig
  >     make dep

  > `

- In this directory build the coda.o module by typing:

  > `

  >     make config  --- answer the questions
  >     make coda.o
  >     su
  >     make install

  > `

### NOTES

- If you build for a running kernel, you must still have a source tree for that Linux release, otherwise the headers cannot be found. However, that source tree doesn't need modversions.h etc.
- We don't actively maintain 2.0 code anymore. The 2.1 code is preferred, but not yet perfect.

## 6.3 Configuring a FreeBSD kernel

Currently, Coda works with the 2.2.x-STABLE kernels. Since a loadable module for Coda is not available, Venus support is compiled into the kernel. The Coda Development Group releases a pre-built GENERIC FreeBSD kernel with Coda Venus support. The only differences between the GENERIC FreeBSD kernel and the GENERIC Coda kernel is the addition of Coda Filesystem and the enabling of the kernel debugger.

For those who wish to compile their own kernel, go to:

ftp://ftp.coda.cs.cmu.edu/pub/coda/freebsd/<OS-VERSION>/i386/">

and get the Coda kernel patches:

`kernel-patch.cfs-4.4.1.gz`.

If you are patching a release earlier than 2.2.6, you will also need:

`kernel-patch.FreeBSD-4.4.0-2.2.5.gz`.

You should obtain the FreeBSD 2.x kernel sources and apply the `kernel-patch.cfs-4.4.1.gz` kernel patch. Suppose that the kernel source is in `/home/me/mysrc/sys` and the patch files, `kernel-patch.cfs-4.4.1.gz` and `kernel-patch.FreeBSD-4.4.0-2.2.5.gz`, are in `/home/me/mysrc`. Go to `/home/me/mysrc` and extract the Coda patch by typing:

> `

>     zcat kernel-patch.cfs-4.4.1.gz | patch -p4

> `

The -p4 is really necessary. If you are patching FreeBSD Release 2.2.5 or earlier, you also need to extract the "glue" code for Coda. Type:

> `

>     zcat kernel-patch.FreeBSD-4.4.0-2.2.5.gz | patch -p6

> `

At this point, the easiest thing to do is copy the GENERIC kernel configuration and modify it to include Coda:

> `

>             cd .../conf
>             cp GENERIC Coda

> `

The two lines that need to be added to the Coda configuration will look something like:

> `

>     options               CFS     #Coda File System
>     pseudo-device vcfs    4       # coda minicache <-> venus comm.

> `

Look at the LINT file in the configuration directory to find the most current version of these lines and copy them into the Coda configuration. You should also copy the line from LINT that enables the ddb debugger into the Coda configuration.

Now, all that you need to do is to `config` Coda and build it.

> `

>             config Coda
>             make

> `

Finally, you should install this new kernel by becoming root and typing:

> `

>             make install

> `

### Epilog

If you are looking for the above Generic Coda kernel, you can find it in the FreeBSD area on the Coda site. It is named `kernel.gz`

If you do not want to apply the Coda patch (above) and you are at FreeBSD release 2.2.6 or better, you can simply copy the `cfs/` directory from the Coda source tree to `/home/me/mysrc/sys`

> `

>     cd <coda sources-coda_release>/kernel-src/vfs/bsd44/
>     cp -rp cfs /home/me/mysrc/sys

> `

Don't forget to check `INSTALL` and `README` in the Coda FreeBSD ftp area for any last minute changes that may not have found their way into the Coda manual. Also, remember you only need a modified kernel for the client side of Coda, not the server side.

## 6.4 Configuring a NetBSD kernel

Currently, Coda only works with the 1.3/1.3.x kernels. Since a loadable module for Coda is not available, Venus support is compiled into the kernel. The Coda Development Group releases a pre-built GENERIC NetBSD kernel with Coda Venus support. The only difference between the GENERIC NetBSD kernel and the Coda kernel is the addition of Coda Filesystem.

For those who wish to compile their own kernel, go to:

ftp://ftp.coda.cs.cmu.edu/pub/coda/NetBSD/<OS-VERSION>/i386/">

and get the Coda kernel patches:

> `

>     kernel-patch.cfs-4.4.0.gz
>     kernel-patch.NetBSD-4.4.0-<OS-VERSION>.gz

> `

You should obtain the NetBSD 1.3/1.32 kernel sources and apply the coda patches. Suppose that the kernel source are in `/home/me/mysrc/sys` and the patch files, `kernel-patch.cfs-4.4.0.gz` and `kernel-patch.NetBSD-4.4.0-<OS-VERSION>.gz`, are in `/home/me/mysrc`. Go to `/home/me/mysrc` and extract the Coda patch by typing:

> `

>             zcat kernel-patch.cfs-4.4.0.gz | patch -p4

> `

The -p4 is really necessary. You also need to extract the "glue" code for Coda. Type:

> `

>     zcat kernel-patch.NetBSD-4.4.0-<OS-VERSION>.gz | patch -p6

> `

At this point, the easiest thing to do is to copy the GENERIC kernel configuration and modify it to include Coda, i.e.

> `

>     cd .../conf
>     cp GENERIC Coda

> `

The two lines that are need for to the Coda configuration will look something like:

> `

>     options               CFS     #Coda File System
>     pseudo-device vcfs    4       # coda minicache <-> venus comm.

> `

These should have been added to the GENERIC file by the above patches. Please verify that they went in correctly.

Now, all that you need to do is to `config` Coda and build it.

> `

>             config Coda
>             make

> `

Finally, copy the `netbsd` to `/` and reboot.

### Epilog

If you are looking for the above Generic Coda kernel, you can find it in the NetBSD area on the Coda site. It is named `netbsd-<RELEASE>.gz`

Don't forget to check `INSTALL` and `README` in the Coda NetBSD ftp site for any last minute changes that may not have found their way into the Coda manual. Also, remember you only need a modified kernel for the client side of Coda, not the server side.

Next Previous Contents