# Quick Beginnings

# Appendix A. Building AFS from Source Code

This chapter describes how to build AFS from source code.

## Loading the Source Files

Working on an AFS client machine, perform these steps to load the AFS source tree from the AFS Source Distribution.

1. Create and mount a volume for housing the AFS 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. On the local /cdrom directory, mount the CD-ROM that contains the AFS source files. For instructions on mounting CD-ROMs (either locally or remotely via NFS), consult the operating system documentation.

3. Copy the source files from the CD-ROM into the newly created volume.

          # cd /cdrom/src

          # cp -rp  *  /afs/.cellname/afs/src

## Compiling AFS Binaries Using the washtool Program

The AFS distribution includes the washtool program for managing a hierarchy of software development projects. The program builds project trees for program editing, compilation, and installation.

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 IBM AFS 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, copy the binary for the washtool program to the directory specified in the AFS Makefile, which is /afs/cellname/afs/sysname/dest/bin. If you prefer to store the program in a different directory, you can use the WASHTOOL variable on the make command line as described in Step 6.

   If there is a volume that houses the AFS binaries for each system type (as recommended), the conventional location for the washtool binary is the /afs/cellname/sysname/usr/afsws/bin directory. Use the following instruction to copy it.

          # cd  /afs/cellname/sysname/usr/afsws/bin

          # cp  washtool  /afs/.cellname/afs/sysname/dest/bin

   Otherwise, mount the (binary) AFS CD-ROM for this system type on the local /cdrom directory, and copy the washtool binary directly from it.

          # cd  /cdrom/sysname/bin

          # cp  washtool  /afs/.cellname/afs/sysname/dest/bin

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. Set the SYS_NAME variable to the appropriate system type name.

   If the washtool binary is not in the conventional directory (/afs/cellname/afs/sysname/dest/bin), set the WASHTOOL variable to the alternate full pathname of the binary.

          # cd /afs/.cellname/afs

          # make SYS_NAME=sysname [WASHTOOL=alternate_washtool_directory] install

© IBM Corporation 2000. All Rights Reserved