<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE>The Coda HOWTO: Building Coda </TITLE> <LINK HREF="coda-howto-5.html" REL=previous> <LINK HREF="coda-howto.html#toc6" REL=contents> </HEAD> <BODY> Next <A HREF="coda-howto-5.html">Previous</A> <A HREF="coda-howto.html#toc6">Contents</A> <HR> <H2><A NAME="s6">6. Building Coda </A></H2> <P> <P>As a file system, Coda has several major components that need to be built: <P> <UL> <LI> Kernel code on the client</LI> <LI> The cache manager Venus on the client</LI> <LI> The fileserver</LI> <LI> Utilities for client and server administration.</LI> </UL> <P> <H2><A NAME="ss6.1">6.1 Building on Linux </A> </H2> <P> <P> <H3>Building the kernel module </H3> <P> <A NAME="Modules"></A> <P>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. <P>First of all get the linux-coda-?.?.?.tgz archive from <CODE>ftp://ftp.coda.cs.cmu.edu/pub/coda/src/</CODE>. You can unpack this anywhere on your target system. <P> <P> <P><B>Prepare the kernel tree</B> <P>You do need a kernel tree handy, to give the module header information. To get ready: <BLOCKQUOTE><CODE> <PRE> make oldconfig make dep </PRE> </CODE></BLOCKQUOTE> <P>In the top directory of linux-coda build the coda.o module: <BLOCKQUOTE><CODE> <PRE> make config --- answer the questions make coda.o su make install depmod -a </PRE> </CODE></BLOCKQUOTE> <P> <P><B>Notes</B> <UL> <LI> 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. </LI> <LI> We don't actively maintain 2.0 code anymore. The 2.1 code is preferred, but not yet perfect. </LI> </UL> <P> <P> <P> <H3>Building the userlevel code </H3> <P> <P>Coda builds most easily on <EM>glibc</EM> systems. We do not actively maintain the <CODE>libc</CODE> 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. <P>To build: <UL> <LI>Unpack <CODE>coda-?.?.?.tgz</CODE>. </LI> <LI>./configure --prefix=/usr</LI> <LI> make (make coda for versions 4.6 and older)</LI> <LI> make client-install</LI> <LI> make server-install</LI> </UL> <P> <P> <H2><A NAME="ss6.2">6.2 Building on FreeBSD </A> </H2> <P> <P> <H3>Building a Whole Kernel </H3> <P> <P>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: <BLOCKQUOTE><CODE> <PRE> grep -i coda LINT </PRE> </CODE></BLOCKQUOTE> It currently gives: <BLOCKQUOTE><CODE> <PRE> # Coda stuff: options CODA #CODA filesystem. pseudo-device vcoda 4 #coda minicache <-> venus comm. </PRE> </CODE></BLOCKQUOTE> Add these lines (or whatever the <CODE>grep</CODE> yields) to the GENERIC kernel configuration or your standard personal configuration. You might also want to turn on DDB and BPF. <P>I'll assume you call the new config file CODA. You type: <BLOCKQUOTE><CODE> <PRE> config CODA </PRE> </CODE></BLOCKQUOTE> <P>Then <CODE>cd</CODE> to the build area and do a <CODE>make</CODE>: <BLOCKQUOTE><CODE> <PRE> cd ../../compile/CODA make </PRE> </CODE></BLOCKQUOTE> <P>Finally, as root install the kernel with: <BLOCKQUOTE><CODE> <PRE> make install </PRE> </CODE></BLOCKQUOTE> <P> <H3>Building an LKM </H3> <P> <P>Alternatively, you could just build an lkm for Coda and insert it into the kernel. To do that you: <BLOCKQUOTE><CODE> <PRE> cd /usr/lkm/coda </PRE> </CODE></BLOCKQUOTE> and type: <BLOCKQUOTE><CODE> <PRE> make make install </PRE> </CODE></BLOCKQUOTE> <P>This will build coda_mod.o and copy it to /lkm. You load it by typing: <BLOCKQUOTE><CODE> <PRE> modload -v -e coda_mod -o /var/run/lkm.coda /lkm/coda_mod.o </PRE> </CODE></BLOCKQUOTE> <P>Remember, when using an lkm: <UL> <LI> <EM>You must boot /kernel not /kernel.old or /kernel.<something></EM></LI> <LI> <EM>There are no symbols available for debugging.</EM></LI> </UL> <P> <H3>Building Coda: The Package Way </H3> <P> <BLOCKQUOTE><CODE> <PRE> cd /usr/ports/net/coda_client make install cd /usr/ports/net/coda_server make install </PRE> </CODE></BLOCKQUOTE> <P><B>NOTE:</B> The client and server each need about 85Meg for the work area and another 15Meg to install. They are compiled -g for debugging. <P> <H3>Building Coda: The Bleading Edge Way </H3> <P> <P>First, you need several external packages to build coda: <CODE>gnu make</CODE>, <CODE>gdbm</CODE>, <CODE>readline</CODE>, and <CODE>perl</CODE>. <P>You can grab any of our (latest) sources from <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/src">ftp://ftp.coda.cs.cmu.edu/pub/coda/src</A>. For this example, I'll assume that you have obtained sources for Coda release 4.6.6. <B>NOTE:</B> On our ftp site there are also beta, alpha, and less stable source releases available for the daring. <P>Untar the source into your favorite build area. (I am assuming this is <CODE>/usr/coda</CODE>.) <BLOCKQUOTE><CODE> <PRE> tar zxfv coda-4.6.6.tgz -C /usr/coda </PRE> </CODE></BLOCKQUOTE> <P><CODE>Cd</CODE> to <CODE>/usr/coda</CODE> and <BLOCKQUOTE><CODE> <PRE> mkdir obj </PRE> </CODE></BLOCKQUOTE> This is where we will build the binaries. Now <CODE>cd</CODE> into <CODE>obj</CODE> and type: <BLOCKQUOTE><CODE> <PRE> ../coda-4.6.6/configure </PRE> </CODE></BLOCKQUOTE> This will use the gnu configure system to configure and to shadow the sources that were installed in /usr/coda/coda-4.6.6. <P>Finally, <EM>assuming you named the gnu make, gmake</EM>, type: <BLOCKQUOTE><CODE> <PRE> gmake coda </PRE> </CODE></BLOCKQUOTE> <P>To install the client suite type: <BLOCKQUOTE><CODE> <PRE> gmake client-install </PRE> </CODE></BLOCKQUOTE> <P>To install the server suite type: <BLOCKQUOTE><CODE> <PRE> gmake server-install </PRE> </CODE></BLOCKQUOTE> <P> <H2><A NAME="ss6.3">6.3 Building on NetBSD </A> </H2> <P> <P> <H3>Building a Whole Kernel </H3> <P> <P>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. <BLOCKQUOTE><CODE> <PRE> file-system CODA # Coda File System pseudo-device vcoda 4 # coda minicache <-> venus comm. </PRE> </CODE></BLOCKQUOTE> But whatever is in GENERIC will be more up to date. <P>I'll assume you call the new config file CODA. You type: <BLOCKQUOTE><CODE> <PRE> config CODA </PRE> </CODE></BLOCKQUOTE> <P>Then <CODE>cd</CODE> to the build area and do a <CODE>make</CODE> <BLOCKQUOTE><CODE> <PRE> cd ../compile/CODA make </PRE> </CODE></BLOCKQUOTE> <P>Then just copy <CODE>netbsd</CODE> to root. <P> <H3>Building an LKM </H3> <P> <P>Alternatively, you could just build an lkm for Coda and insert it into the kernel. To do that you: <BLOCKQUOTE><CODE> <PRE> cd /usr/sys/lkm/vfs/coda </PRE> </CODE></BLOCKQUOTE> and type: <BLOCKQUOTE><CODE> <PRE> make make install </PRE> </CODE></BLOCKQUOTE> <P>This will build coda.o and copy it to /usr/lkm. You load it by typing: <BLOCKQUOTE><CODE> <PRE> modload -v -e coda_lkmentry -o /var/run/lkm.coda /usr/lkm/coda.o </PRE> </CODE></BLOCKQUOTE> <P>Remember, when using an lkm: <UL> <LI> <EM>You must boot /netbsd not /netbsd.old or /netbsd.<something></EM></LI> <LI> <EM>There are no symbols available for debugging.</EM></LI> </UL> <H3>Building Coda: The Package Way </H3> <P> <BLOCKQUOTE><CODE> <PRE> cd /usr/pkgsrc/net/coda_client make install cd /usr/pkgsrc/net/coda_server make install </PRE> </CODE></BLOCKQUOTE> <P>NOTE: The client and server each need about 85Meg for the work area and another 15Meg to install. They are compiled -g for debugging. <P> <H3>Building Coda: The Bleading Edge Way</H3> <P> <P>First, you need several external packages to build coda: <CODE>gnu make</CODE>, <CODE>gdbm</CODE>, <CODE>readline</CODE>, and <CODE>perl</CODE>. <P>You can grab any of our (latest) sources from <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/src">ftp://ftp.coda.cs.cmu.edu/pub/coda/src</A>. For this example, I'll assume that you have obtained sources for Coda release 4.6.6. <B>NOTE:</B> On our ftp site there are also beta, alpha, and less stable source releases available for the daring. <P>Untar the source into your favorite build area. (I am assuming this is <CODE>/usr/coda</CODE>.) <BLOCKQUOTE><CODE> <PRE> tar zxfv coda-4.6.6.tgz -C /usr/coda </PRE> </CODE></BLOCKQUOTE> <P><CODE>Cd</CODE> to <CODE>/usr/coda</CODE> and <BLOCKQUOTE><CODE> <PRE> mkdir obj </PRE> </CODE></BLOCKQUOTE> This is where we will build the binaries. Now <CODE>cd</CODE> into <CODE>obj</CODE> and type: <BLOCKQUOTE><CODE> <PRE> ../coda-4.6.6/configure </PRE> </CODE></BLOCKQUOTE> This will use the gnu configure system to configure and to shadow the sources that were installed in /usr/coda/coda-4.6.6. <P>Finally, <EM>assuming you named the gnu make, gmake</EM>, type: <BLOCKQUOTE><CODE> <PRE> gmake coda </PRE> </CODE></BLOCKQUOTE> <P>To install the client suite type: <BLOCKQUOTE><CODE> <PRE> gmake client-install </PRE> </CODE></BLOCKQUOTE> <P>To install the server suite type: <BLOCKQUOTE><CODE> <PRE> gmake server-install </PRE> </CODE></BLOCKQUOTE> <P> <H2><A NAME="ss6.4">6.4 Building a Client on Windows 95 </A> </H2> <P> <P> <P><B>WARNING:</B> 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. <P>Coda for Windows was made possible through a major effort by Michael Callahan <CODE>mjc@stelias.com</CODE>. 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. <P><B>Short rationale</B> <P>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.) <P>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. <P> <P> <H3>Building the user level code </H3> <P> <P>What do you need: <P> <OL> <LI>a Linux machine with a few 100M of free space.</LI> <LI>download the tool chains made available under: <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/tools/">ftp://ftp.coda.cs.cmu.edu/pub/tools/{95,win32}</A> </LI> <LI>You need the rpms for: <UL> <LI> djgpp package.</LI> <LI> djgpp-win95ext.</LI> <LI> cygwin.</LI> <LI> libgdbm-nt.</LI> <LI> gdb-djgpp a remote debugging environment for DPMI applications. </LI> </UL> </LI> <LI>It is highly recommended to set up Samba to share Linux generated binaries with the Windows box. </LI> </OL> <P>Get the latest tarball of Coda sources. Example: <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/src/">ftp://ftp.coda.cs.cmu.edu/pub/coda/src/coda-?.?.?.tgz.</A> <P>You can rebuild Venus under Linux with <BLOCKQUOTE><CODE> <PRE> ./configure --host=windows95 make </PRE> </CODE></BLOCKQUOTE> and the client utilities and server with <BLOCKQUOTE><CODE> <PRE> ./configure --host=nt </PRE> </CODE></BLOCKQUOTE> The Venus built here is for NT and is not usable on Win95. <P> <H3>Building the kernel level code (VXDs) </H3> <P> <P>What do you need: <UL> <LI> Visual C++ 5.0 (with Internet Explorer).</LI> <LI> MS assembler 6.11. </LI> <LI> The Win95 DDK (comes with professional MSDN). </LI> <LI> You also need to download a collection of header files vxdtdi.zip for networking from. <A HREF="ftp://ftp.microsoft.com/developr/drg/WinSock/MS-Extensions/VXDTDI.ZIP">ftp://ftp.microsoft.com/developr/drg/WinSock/MS-Extensions/VXDTDI.ZIP.</A> </LI> </UL> <P><B>Note:</B>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. <P>The sources for the VxD's you will build are in: <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/src/win95-coda-5.2.0.zip">ftp://ftp.coda.cs.cmu.edu/pub/coda/src/win95-coda-5.2.0.zip.</A> 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: <P> <UL> <LI> Change the path of the Linker in all .mak files</LI> <LI> In the MS-Studio environment (options) add: <UL> <LI> executable path of the assembler 6.11</LI> <LI> include path of the 95DDK inc32 (Inc32)</LI> <LI> include path of the 95DDK inc16 (Inc16)</LI> <LI> lib path of the 95DDK (lib)</LI> <LI> include path where VXDTDI Headers are</LI> <LI> include path of the 95DDK (Block/Inc)</LI> </UL> </LI> </UL> <P>Use the Developer Studio Project "95projects". Build the VXDs one by one. Build CodaStart for a more convenient way to stat Coda. <P> <H3>Installing Coda after build </H3> <P> <UL> <LI> Create the directories C:\usr\coda\{bin, etc, spool, venus.cache}. </LI> <LI> 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. </LI> <LI> Create the file C:\usr\coda\etc\vstab which includes a line like <BLOCKQUOTE><CODE> <PRE> /coda:/dev/cfs0:<ip adress of server 1>,..,<ip adress of server n>,<cachesize>:1 </PRE> </CODE></BLOCKQUOTE> Use <BLOCKQUOTE><CODE> <PRE> /coda:/dev/cfs0:128.2.209.213:100000:1 </PRE> </CODE></BLOCKQUOTE> to work with the CMU-testserver. </LI> <LI> Create the file C:\usr\coda\venus.cache\myhost which includes your IP adress.</LI> <LI> 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". </LI> <LI> Add the path <CODE>c:\usr\coda\bin</CODE> to the PATH environment variable in <CODE>c:\autoexec.bat</CODE>.</LI> <LI> Restart the computer. </LI> <LI> 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.</LI> </UL> <P>You are now at the point where the installer would have left you. To start Coda read the section <A HREF="coda-howto-3.html#sec-win95-start-conf">Windows95: Starting and Configuring a Coda client</A>. <P> <P> <H2><A NAME="ss6.5">6.5 Building and installing a Coda Server for NT </A> </H2> <P> <P><B>Note:</B> 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. <P>You can however build a Venus (which you can with the supplied kernel Coda FSD for NT) and you can build a server. <P>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. <P>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. <P> <H3>The build process</H3> <P> <P> <P>You will need: <OL> <LI> Get the cross compiling kit: <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/cygwin-b20_glibc-3.i386.rpm">ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/cygwin-b20_glibc-3.i386.rpm.</A> </LI> <LI> <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/libgdbm-nt-1.7.3-3.i386.rpm">ftp://ftp.coda.cs.cmu.edu/pub/tools/win32/libgdbm-nt-1.7.3-3.i386.rpm.</A> (These are rpms for RedHat 5.0. Sources are available of course.). </LI> <LI> Get the coda-?.?.? tar ball <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/src">ftp://ftp.coda.cs.cmu.edu/pub/coda/src.</A> </LI> <LI> Unpack & build <BLOCKQUOTE><CODE> <PRE> ./configure --host=nt make coda </PRE> </CODE></BLOCKQUOTE> </LI> <LI> drink coffee, ignore or, better even, fix the compiler warnings.</LI> </OL> <P>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! <P> <P> <H3>Manual configuration after building</H3> <P> <P> <OL> <LI> 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 </LI> <LI> get samba running on that RH machine and export the build area for Coda. </LI> <LI> replace <BLOCKQUOTE><CODE> <PRE> C:\cygwin\cygwin-b20\H-i586-cygwin32\bin\cygwin1.dll </PRE> </CODE></BLOCKQUOTE> with the one from: <A HREF="ftp://ftp.coda.cs.cmu.edu/pub/coda/support/nt-patches">ftp://ftp.coda.cs.cmu.edu/pub/coda/support/nt-patches</A> or directly from cygnus. The version of cygwin1.dll must be from 01/15/99 or newer. </LI> <LI> get bash going. It can be started from the "Start" menu. </LI> <LI> organise your mountpoints for Cywin. You will find the root volume mounted on <CODE>c:\</CODE>. Change this to <CODE>c:\coda</CODE> by typing: <BLOCKQUOTE><CODE> <PRE> umount / mount -b C:\coda / </PRE> </CODE></BLOCKQUOTE> The -b, for binary mounting is vital. </LI> <LI>For your convenience add the entry <BLOCKQUOTE><CODE> <PRE> SET HOME=C:\Coda </PRE> </CODE></BLOCKQUOTE> in the file <CODE>cygnus.bat</CODE> somewhere in the Cygwin path. You can also create the file <CODE>.bashrc</CODE> in the <CODE>c:\coda</CODE> 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. </LI> <LI>Create some directories, create <CODE>/bin/sh</CODE> and export the path by typing: <BLOCKQUOTE><CODE> <PRE> 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 </PRE> </CODE></BLOCKQUOTE> </LI> <LI>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: <BLOCKQUOTE><CODE> <PRE> cd //H/ cp * /bin </PRE> </CODE></BLOCKQUOTE> or use the Windows Explorer. The binary files might not have the extension <CODE>.exe</CODE>. In that case just change the name, but distinguish between bash shell scripts and binaries.</LI> </OL> <P>You are now at the point where the installer would have left you. To configure and start the server read the section <A HREF="coda-howto-3.html#codasrv">Codaserv -- the server</A>. <P> <HR> Next <A HREF="coda-howto-5.html">Previous</A> <A HREF="coda-howto.html#toc6">Contents</A> </BODY> </HTML>