# Appendix A. Building OpenAFS from Source Code

This chapter describes how to build OpenAFS from source code.

## Loading the Source Files

Working on an AFS client machine, login to AFS as a administrative user, then perform these steps to load the OpenAFS source tree from the OpenAFS Source Distribution.

1. Create and mount a volume for housing the OpenAFS source tree. These instructions name the volume src.afs and mount it at the /afs/cellname/afs/src directory.

   Setting the -maxquota argument to 0 (zero) sets an unlimited quota on the volume, which enables you to copy all of the files into the volume without exceeding its quota. If you wish, you can set the volume's quota to a finite value after you complete the copying operation. At that point, use the vos examine command to determine how much space the volume is occupying. Then issue the fs setquota command to set a quota that is slightly larger.

          # vos create <machine name> <partition name> src.afs -maxquota 0
          # cd /afs/.cellname
          # mkdir afs
          # fs mkmount afs/src src.afs
          # vos release root.cell
          # fs checkvolumes

2. Download the latest stable OpenAFS source distribution (openafs-src.X.Y.Z.tar.gz) from openafs.org to the local /tmp directory.

3. In the local /tmp directory, unpack the source archive.

          # cd /tmp
          # gzip -dc openafs-src-X.Y.Z.tar.gz | tar xvf -

4. Copy the source files from the unpacked archive into the newly created volume.

          # cd /tmp/openafs-X.Y.Z
          # cp -rp  *  /afs/.cellname/afs/src

## Compiling OpenAFS Binaries Using Configure and Make

The OpenAFS distribution uses the autoconf program and Makefiles for compiling the OpenAFS software.

1. Create a subdirectory under the /afs/.cellname/afs directory for each system type for which you will build AFS binaries. Creating and mounting a volume for each system type is recommended, but you can also simply use the mkdir command. If you create a new volume, grant it an unlimited quota to avoid running out of space during the build process.

          # cd /afs/.cellname/afs

   If creating a new volume:

          # vos create <machine name> <partition name> sysname -maxquota 0
          # fs mkmount sysname sysname

   If not creating a new volume:

          # mkdir sysname

2. In the directory for each system type, create subdirectories called dest, dest/bin, and obj. If you plan to use the @sys variable in pathnames that refer to these directories, then you must use the conventional system names listed in the OpenAFS Release Notes.

          # cd sysname
          # mkdir dest
          # mkdir dest/bin
          # mkdir obj

3. Create the indicated directories and symbolic links in the /afs/.cellname/afs directory.

          # cd /afs/.cellname/afs
          # ln -s  @sys/dest  dest
          # ln -s  @sys/obj  obj
          # ln -s  .  PARENT
          # ln -s  src/Makefile  Makefile

   The following is an example directory listing for the /afs/.cellname/afs directory after completing the preceding steps. It includes two example system types.

          lrwxr-xr-x admin   12 Jun 18 11:26 Makefile->src/Makefile
          lrwxr-xr-x admin    1 Jun 18 11:26 PARENT -> .
          lrwxr-xr-x admin    9 Jun 18 11:25 dest -> @sys/dest
          lrwxr-xr-x admin    8 Jun 18 11:25 obj -> @sys/obj
          drwxrwxrwx admin 4096 Jun 18 11:24 rcs
          drwxrwxrwx admin 2048 Jun 18 11:27 rs_aix42
          drwxrwxrwx admin 2048 Jun 18 11:10 src
          drwxrwxrwx admin 2048 Jun 18 11:27 sun4x_56

4. (Optional) By default, the build procedure writes its results into a destination directory for each system type called /afs/.cellname/afs/sysname/dest. To write the results to a different destination directory, create a link from the dest directory to it.

          # cd /afs/.cellname/afs/sysname
          # ln -s full_path_of_alternate_directory dest

5. For each system type you plan to build, run the following commands on a machine of that system type:

          # cd  /afs/cellname/sysname
          # ../src/configure
          # make
          # make dest

6. Working in the /afs/.cellname/afs directory on a machine of the system type for which you are building AFS, issue the make install command.