(Illustration by Gaich Muramatsu)

Coda File System

Home Downloads Bugs Documentation
News Mailing lists FAQ Research

Scope:
 
WWW Mirrors: Carnegie Mellon University, USA Planetmirror, Australia
---------
  Next Previous Contents

6. Building Coda

As a file system, Coda has several major components that need to be built:

  • Kernel code on the client
  • LWP threading library
  • The cache manager Venus on the client
  • The fileserver
  • Utilities for client and server administration.

6.1 Building on Linux

Building the kernel module

We now have a reaonably 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.

First of all get the linux-coda-?.?.?.tgz archive from ftp://ftp.coda.cs.cmu.edu/pub/coda/src/. You can unpack this anywhere on your target system.

Prepare the kernel tree

You do need a kernel tree handy, to give the module header information. To get ready:

make oldconfig
make dep

In the top directory of linux-coda build the coda.o module:

make config  --- answer the questions
make coda.o
su
make install
depmod -a

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.

Building the LWP threading library

Get the lwp-x.x.tar.gz sources and untar them. Then run ./configure --prefix=/usr ; make ; make install

Building the userlevel code

Coda builds most easily on glibc systems. We do not actively maintain the libc variant anymore. You will need several libraries to link the Coda binaries, and include files from some of the lib???-devel packages. Readline and termcap are probably the most important ones.

To build:

  • Unpack coda-?.?.?.tgz.
  • ./configure --prefix=/usr
  • make (make coda for versions 4.6 and older)
  • make client-install
  • make server-install

6.2 Building on FreeBSD

Building a Whole Kernel

The Coda kernel files are in the FreeBSD -current kernel sources. All you need to do to get a Coda capable kernel is to build a configuration that includes Coda. The lines to enable Coda are not in the GENERIC. There are several Coda lines in the LINT file that you need to copy. In the i386/conf directory type:

grep -i coda LINT
It currently gives:
# Coda stuff:
options         CODA                    #CODA filesystem.
pseudo-device   vcoda   4               #coda minicache <-> venus comm.
Add these lines (or whatever the grep yields) to the GENERIC kernel configuration or your standard personal configuration. You might also want to turn on DDB and BPF.

I'll assume you call the new config file CODA. You type:

config CODA

Then cd to the build area and do a make:

cd ../../compile/CODA
make

Finally, as root install the kernel with:

make install 

Building an LKM

Alternatively, you could just build an lkm for Coda and insert it into the kernel. To do that you:

cd /usr/lkm/coda
and type:
make
make install

This will build coda_mod.o and copy it to /lkm. You load it by typing:

modload -v -e coda_mod -o /var/run/lkm.coda /lkm/coda_mod.o

Remember, when using an lkm:

  • You must boot /kernel not /kernel.old or /kernel.<something>
  • There are no symbols available for debugging.

Building Coda: The Package Way

cd /usr/ports/net/coda_client
make install
cd /usr/ports/net/coda_server
make install

NOTE: The client and server each need about 85Meg for the work area and another 15Meg to install. They are compiled -g for debugging.

Building the LWP threading library

Get the lwp-x.x.tar.gz sources and untar them. Then run ./configure --prefix=/usr/local ; make ; make install

Building Coda: The Bleading Edge Way

First, you need several external packages to build coda: gnu make, gdbm, readline, and perl.

You can grab any of our (latest) sources from ftp://ftp.coda.cs.cmu.edu/pub/coda/src. For this example, I'll assume that you have obtained sources for Coda release 4.6.6. NOTE: On our ftp site there are also beta, alpha, and less stable source releases available for the daring.

Untar the source into your favorite build area. (I am assuming this is /usr/coda.)

tar zxfv coda-4.6.6.tgz -C /usr/coda

Cd to /usr/coda and

mkdir obj
This is where we will build the binaries. Now cd into obj and type:
../coda-4.6.6/configure
This will use the gnu configure system to configure and to shadow the sources that were installed in /usr/coda/coda-4.6.6.

Finally, assuming you named the gnu make, gmake, type:

gmake coda

To install the client suite type:

gmake client-install

To install the server suite type:

gmake server-install

6.3 Building on NetBSD

Building a Whole Kernel

The Coda kernel files are in the NetBSD -current kernel sources. All you need to do to get a Coda capable kernel is to build a configuration that includes Coda. The lines to enable Coda may not be in your configuration. They should be in GENERIC, though they may be turned off. Enable them and/or copy them to your configuration file. They should look like.

file-system     CODA                     # Coda File System
pseudo-device   vcoda            4       # coda minicache <-> venus comm.
But whatever is in GENERIC will be more up to date.

I'll assume you call the new config file CODA. You type:

config CODA

Then cd to the build area and do a make

cd ../compile/CODA
make

Then just copy netbsd to root.

Building an LKM

Alternatively, you could just build an lkm for Coda and insert it into the kernel. To do that you:

cd /usr/sys/lkm/vfs/coda
and type:
make
make install

This will build coda.o and copy it to /usr/lkm. You load it by typing:

modload -v -e coda_lkmentry -o /var/run/lkm.coda /usr/lkm/coda.o

Remember, when using an lkm:

  • You must boot /netbsd not /netbsd.old or /netbsd.<something>
  • There are no symbols available for debugging.

Building Coda: The Package Way

cd /usr/pkgsrc/net/coda_client
make install
cd /usr/pkgsrc/net/coda_server
make install

NOTE: The client and server each need about 85Meg for the work area and another 15Meg to install. They are compiled -g for debugging.

Building the LWP threading library

Get the lwp-x.x.tar.gz sources and untar them. Then run ./configure --prefix=/usr/local ; make ; make install

Building Coda: The Bleading Edge Way

First, you need several external packages to build coda: gnu make, gdbm, readline, and perl.

You can grab any of our (latest) sources from ftp://ftp.coda.cs.cmu.edu/pub/coda/src. For this example, I'll assume that you have obtained sources for Coda release 4.6.6. NOTE: On our ftp site there are also beta, alpha, and less stable source releases available for the daring.

Untar the source into your favorite build area. (I am assuming this is /usr/coda.)

tar zxfv coda-4.6.6.tgz -C /usr/coda

Cd to /usr/coda and

mkdir obj
This is where we will build the binaries. Now cd into obj and type:
../coda-4.6.6/configure
This will use the gnu configure system to configure and to shadow the sources that were installed in /usr/coda/coda-4.6.6.

Finally, assuming you named the gnu make, gmake, type:

gmake coda

To install the client suite type:

gmake client-install

To install the server suite type:

gmake server-install

6.4 Building a Client on Windows 95

WARNING: The software provided to run Coda on Windows 95 is an early pre-alpha snapshot, made available to those interested. Coda runs kernel level code and priviliged processes which can cause damage to your system. Backup all data before playing with Coda.

Coda for Windows was made possible through a major effort by Michael Callahan mjc@stelias.com. Michael extended the DOS protected mode environment with memory mapping and TCP/IP socket support (this involves both Windows kernel support as well as low level support in DJGPP start libraries). He also wrote a kernel module for Coda. Michael's work was further debugged, extended and packaged by the Coda team.

Short rationale

Why DOS applications?? It would seem more straightforward to implement the Coda client cache manager, a user level program named Venus, as a Win32 application. Sadly on Windows 95 we ran into the following (fairly well known) problem. When a user application calls a Win32 file system call, the application may acquire a mutex in a win16 system dll. The request should reach the kernel, and make its way up to Venus. Venus is then unable to service the request because it cannot grab the mutex. Deadlock results. (See Schulman's, Unauthorized Windows 95, IDG.)

Implementing all of Venus as a kernel level cache manager seemed an invitation for disaster. Instead, by running the cache manager in a virtual DOS machine, as a DOS Protected Mode Interface application, one can bypass these problems, since such applications do not share the Windows dynamic libraries which gain the mutex. The price of following this path is high. There was no freely available socket support for such DPMI applications and no memory mapping support. These are provided by Michaels VXD's and standard library calls are now incorporated in the DJGPP toolchain.

Building the user level code

What do you need:

  1. a Linux machine with a few 100M of free space.
  2. download the tool chains made available under: ftp://ftp.coda.cs.cmu.edu/pub/tools/{95,win32}
  3. You need the rpms for:
    • djgpp package.
    • djgpp-win95ext.
    • cygwin.
    • libgdbm-nt.
    • gdb-djgpp a remote debugging environment for DPMI applications.
    • lwp-djgpp
    • lwp-nt, or build lwp for both dos and win32 from source.
  4. It is highly recommended to set up Samba to share Linux generated binaries with the Windows box.

Get the latest tarball of Coda sources. Example: ftp://ftp.coda.cs.cmu.edu/pub/coda/src/coda-?.?.?.tgz.

You can rebuild Venus under Linux with

./configure --target=windows95 
make
and the client utilities and server with
./configure --target=nt
The Venus built here is for NT and is not usable on Win95.

Building the kernel level code (VXDs)

What do you need:

Note:The 95DDK needs the VC2.0 linker, which is on the 95DDK in the directory MSVC20 (also get the files Link.err and DBI.DLL, that will be needed by the linker). You'll also need the latest MS assembler 6.11 which is on the 95DDK in the directory MASM611C.

The sources for the VxD's you will build are in: ftp://ftp.coda.cs.cmu.edu/pub/coda/src/win95-coda-5.2.0.zip. To build sock.vxd you'll need the header files provided by microsoft and can be found in VXDTDI.ZIP. You'll have to learn how to build VxDs, which can be done from Developer Studio:

  • Change the path of the Linker in all .mak files
  • In the MS-Studio environment (options) add:
    • executable path of the assembler 6.11
    • include path of the 95DDK inc32 (Inc32)
    • include path of the 95DDK inc16 (Inc16)
    • lib path of the 95DDK (lib)
    • include path where VXDTDI Headers are
    • include path of the 95DDK (Block/Inc)

Use the Developer Studio Project "95projects". Build the VXDs one by one. Build CodaStart for a more convenient way to stat Coda.

Installing Coda after build

  • Create the directories C:\usr\coda\{bin, etc, spool, venus.cache}.
  • Put Venus.exe Relay.exe, Mount.exe, Unmount.exe, sock.vxd, mc.vxd, mcstub.vxd, mmap.vxd in the directory called C:\usr\coda\bin.
  • Create the file C:\usr\coda\etc\vstab which includes a line like
    n:/dev/cfs0:<ip adress of server 1>,..,<ip adress of server n>,<cachesize>:1
    
    Use
    n:/dev/cfs0:128.2.209.213:100000:1
    
    to work with the CMU-testserver and mount on the N drive.
  • Add the two VXDs mcstub.vxd, mmap.vxd to the C:\Windows\System.ini file in the section 386Enh by typing "device=C:\usr\coda\bin\mcstub.vxd".
  • Add the path c:\usr\coda\bin to the PATH environment variable in c:\autoexec.bat.
  • Restart the computer.
  • The programs clog.exe, ctokens.exe, cunlog.exe, cfs.exe, hoard.exe, codacon.exe, venus-setup.bat will be build with the coda server for NT.

You are now at the point where the installer would have left you. To start Coda read the section Windows95: Starting and Configuring a Coda client.

6.5 Building and installing a Coda Server for NT

Note: At present there is no client kernel source code available yet. We will release some very experimental binaries soon. When are a little further with it, we will release the sources, of course.

You can however build a Venus (which you can with the supplied kernel Coda FSD for NT) and you can build a server.

Coda has alpha support for Coda servers running on NT and Windows 95. The Win32 binaries are constructed using the Cygnus Win32 kit, which effectively translates Unix system calls to Win32 calls.

We build the Win32 binaries on Linux workstations using a cross compiler, just for our convenience. At the moment this is not for the faint of heart, since quite a few things have to be done by hand. Of course we encourage playing and will try to help and fix bugs.

The build process

You will need:

  1. Get the cross compiling kit: ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/cygwin-b20_glibc-3.i386.rpm.
  2. ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/libgdbm-nt-1.7.3-3.i386.rpm. (These are rpms for RedHat 5.0. Sources are available of course.).
  3. Get the coda-?.?.? tar ball ftp://ftp.coda.cs.cmu.edu/pub/coda/src.
  4. Unpack & build
    ./configure --target=nt
    make coda
    
  5. drink coffee, ignore or, better even, fix the compiler warnings.

Native building should be possible; you'll have to make a few changes to configs/coda.m4 and create a new configs/Makeconfig.ntnative file; then run autoconf and get cracking. But don't you dare send us patches with ^M characters made by Windoze machines!

Manual configuration after building

  1. Install into an area for NT binaries on your Linux box still (drink coffee, ignore or better even fix the compiler warnings) Put the binaries in a suitable place using: make BINDIR=TARGET/bin SBINDIR=TARGET/bin server-install
  2. get samba running on that RH machine and export the build area for Coda.
  3. replace
    C:\cygwin\cygwin-b20\H-i586-cygwin32\bin\cygwin1.dll
    
    with the one from: ftp://ftp.coda.cs.cmu.edu/pub/coda/support/nt-patches or directly from cygnus. The version of cygwin1.dll must be from 01/15/99 or newer.
  4. get bash going. It can be started from the "Start" menu.
  5. organise your mountpoints for Cywin. You will find the root volume mounted on c:\. Change this to c:\coda by typing:
    umount /
    mount -b C:\coda  /
    
    The -b, for binary mounting is vital.
  6. For your convenience add the entry
    SET HOME=C:\Coda
    
    in the file cygnus.bat somewhere in the Cygwin path. You can also create the file .bashrc in the c:\coda directory which gets called, when the Cygwin shell gets started. We set the export path (described below) and cd to the home directory that way.
  7. Create some directories, create /bin/sh and export the path by typing:
    mkdir /bin /vice /rvm /vicepa /tmp
    touch /rvm/LOG
    touch /rvm/DATA
    cp //c/cygwin/cygwin-b20/H-i586-cygwin32/bin/bash /bin/sh
    export PATH=/bin:$PATH
    
  8. Install your Coda stuff build as described above. Suppose the coda-?.?.? area is a mapped drive on the NT machine with drive letter H: type in bash:
    cd //H/
    cp * /bin
    
    or use the Windows Explorer. The binary files might not have the extension .exe. In that case just change the name, but distinguish between bash shell scripts and binaries.

You are now at the point where the installer would have left you. To configure and start the server read the section Codaserv -- the server.


Next Previous Contents

---------
For more information send us mail.