$Id: INSTALL,v 1.64 1999/08/08 12:50:59 assar Exp $ ($Name: arla-0-27 $)

* Building arla

Arla is configured with autoconf.  Start the configuration process by
typing:

- `./configure' in the source directory, or
- `SRCDIR/configure' in the directory where you want to build arla.
  (this is the recommended way but requires a make that understands VPATH)

If you want to install somewhere different from the default
`/usr/arla' give `--prefix=PATH' as an argument to configure.  Note
that if you change your prefix from the default your kerberos
libraries may have problems that your kerberos/afs libraries are
unable to find what cell you belong to.

There are also some arla-specific arguments to configure:

  --with-arlacachedir=dir use dir as cachedir instead of $prefix/cache
  --with-arlaconffile=file use file for configuration instead of $prefix/etc/arla.conf
  --with-krb4=dir         use kerberos 4 in dir
  --with-krb4-lib=dir     use krb4-lib in dir
  --with-krb4-include=dir use krb4-include in dir
  --with-krbafs=dir       use cmu's krbafs lib (If you not are using kth-krb.
			  This is not needed when using kth-krb since
			  libkafs is included there.)
  --with-krb5=dir	  use kerberos 4 compat from kerberos 5 in dir
  --disable-mmap	  don't use mmap at all
  --enable-mmaptime       use mmap:ed time from /dev/kmem
                          (known to work in FreeBSD)
  --disable-dynamic-afs	  don't use loaded AFS library with AIX
  --enable-smp		  compile for SMP (currently only on Linux)
  --enable-knfs		  enable code to nfsmount AFS (*BSD only).
  --enable-kld		  build KLD modules (for FreeBSD[34]-current)
  --without-x		  don't build X code
  --with-pthreads=dir	  use the pthreads library in dir

By default configure will use gcc if it finds it.  If you want to use
a specific compiler or some special options you can specify that when
running configure.  Running in a sh-style shell, type:

  CC=my-compiler CFLAGS='magic-flags' ./configure

If you are stuck with a broken shell, try using the env program:

  env CC=my-compiler CFLAGS='magic-flags' ./configure

If there's no kernel support for your operating system, configure will
print a warning to that effect and only the user-level stuff will be
configured.

Solaris 2.7 (or Solaris 7)

On Solaris 2.7 the kernel itself can be either 32 bit or 64 bit.  The
xfs kernel module needs to be of the same type as the kernel.  You can
find out what type of kernel you have from `dmesg'.  It should say
something like:

If it says:

   SunOS Release 5.7 Version Generic [UNIX(R) System V Release 4.0]

that means it's a 32 bit kernel, but if it says:

   SunOS Release 5.7 Version Generic 64-bit [UNIX(R) System V Release 4.0]

then it's 64 bit.

To build a 32 bit arla you don't need to do anything special.  If you
however want a 64 bit one the magic incarnation of configure is:

CC='cc -xarch=v9' AS='as -xarch=v9' configure sparc64-sun-solaris2.7

Once configured has completed, just run `make'.

One common problem is the file lwp/process.S.  This has to be
preprocessed with the appropriate defines and then assembled.  If the
magic in lwp/make-process.o.sh.in for some reason fails, try doing it
by hand. Then figure out what should be added and send us a patch to
lwp/make-process.o.sh.in.

* Installing arla

Run `make install'.  It will create and populate these directories:

/usr/arla/bin		all binaries used
/usr/arla/cache		the cached files will be stored here
			(core-dumps from arlad as well)
/usr/arla/etc		configuration files:
			ThisCell, CellServDB, arla.conf
/usr/arla/lib		random libraries

If you're already part of an AFS cell, modify /usr/arla/etc/ThisCell
and make sure your cell is mentioned in /usr/arla/etc/CellServDB.  If
you don't have a cell you'll still be able to run as a client in the
cell `stacken.kth.se' and access all cells listed in CellServDB.

* Services

Everything works fine even if your /etc/services is not updated, but
programs will print warning messages.  To get rid of these, add the
contents of SRCDIR/conf/services to /etc/services.

  cat SRCDIR/conf/services >> /etc/services

* Starting arla

First try running arlad in test mode with `-t'.  If all goes well, it
should print some messages and then give you the prompt `arla>'.
There are very minimal commands for navigating the AFS space (ls, cd
and cat).  Type `help' to get a list of all the commands.

Run `arlad --help' for a list of the options supported.

If you have a kernel module you can try to load it and mount the
file system.  That's done somewhat differently depending on the
operating system:

Linux:

  The linux major device number has changed in arla 0.5. Please
  remove your old device and create a new one with the command
  below if you have used arla before 0.5.

  mknod /dev/xfs0 c 103 0
  insmod /usr/arla/bin/xfs.o
  /usr/arla/bin/arlad
  mkdir /afs
  mount -t xfs arla /afs

  These commands are executed by the script /usr/arla/bin/startarla so
  you might want to use that instead.  There's also a SysV-based init
  script called arla.init you can install into /etc/rc.d (or where
  your init files are located).

  If you are using Linux 2.1 or 2.2 and libc4, libc5 or glibc 2.0,
  you may want to enable the getcwd syscall, which works much better
  than the old way of doing getcwd. In order to do this, follow
  these steps:

  1. Copy /usr/arla/lib/libgetcwd.so.X (where X is the arla version)
     to /lib.
  2. Run "/sbin/ldconfig".
  3. Run "LD_PRELOAD=/lib/libgetcwd.so.0 /bin/pwd". If this fails
     with "/bin/pwd: can't load library '/lib/libgetcwd.so.0'" or
     some other error message, report this error.
  4. If the previous step went well, add this line to /etc/ld.so.preload:
     /lib/libgetcwd.so.0

  DO NOT load the file from /usr/arla/lib, since /usr probably is not
  part of the root partition of your system. If you do this, your system
  will probably not be able to boot, even in single user, since in most
  Linux installations, init, sh, mount and other programs are dynamically
  linked.

  If you use glibc 2.1 or later, the above method is unnecessary and
  the line /lib/libgetcwd.so.0 should be removed from /etc/ld.so.preload
  if present.

SunOS4:

  modload /usr/arla/bin/libxfs.o
  modstat
  mknod /dev/xfs0 c <C-major from modstat> 0
  mkdir /afs
  /usr/arla/bin/mount_xfs /afs /dev/xfs0
  /usr/arla/bin/arlad

{Net|Open}BSD:

  modload -e xfs_mod -o /var/tmp/symbols -p /usr/arla/bin/xfs_makedev /usr/arla/bin/xfs_mod.o
  mkdir /afs
  /usr/arla/bin/mount_xfs /dev/xfs0 /afs
  /usr/arla/bin/arlad

  (or should you be able to use /usr/arla/bin/startarla)

FreeBSD:
  
Do like in {Net|Open} except that after the first time (when /dev/xfs0
exists) you can skip the modload since the module with automatically
be loaded by mount_xfs assuming you have copied xfs_mod.o to /lkm with
something like the following commands:

  mkdir /lkm
  cp /usr/arla/bin/xfs_mod.o /lkm/xfs_mod.o
  
And mount_xfs will load the filesystem into the kernel.

As with under BSD's, /usr/arla/bin/startarla should do everything for you.

Solaris:

add a line to /etc/name_to_major with (138 should be any unused number)

  xfs 138

and another one to /etc/name_to_sysnum (105 is the preferred system
call number by Solaris < 7 and 73 for Solaris 7).  If that's already
used by Transarc AFS on your machine pick some other number.

  xfs 105

(or)

  xfs 73

You might have to reboot for these changes to take effect.  Then, type:

  modload xfs

You should probably add a file in /usr/kernel/drv/xfs.conf with:

  name="xfs" parent="pseudo" instance=0;

and then run:

  drvconfig -i xfs

Create a /dev link and a directory:

  ln -s "/devices/pseudo/xfs@0:" /dev/xfs0
  mkdir /afs

Now you can try mounting the file system and start the daemon:

  /usr/arla/bin/mount_xfs /dev/xfs0 /afs
  /usr/arla/bin/arlad

Note that if you are using a syscall other than 105, you have to use a
new kth-krb (with afssys.c 1.59 or newer) and set AFS_SYSCALL=xfs
before starting arlad.

If you want to, you can copy the xfs/solaris/xfs module to /kernel/fs
and xfs/solaris/bin/mount_xfs to /lib/fs/xfs/mount which enables you to
automatically load the xfs module when mounting the xfs file system.

AIX:

Create the device node:

  mknod /dev/xfs0 c 100 0

And add a line like the following to /etc/vfs:

  arla    8       none    none

Now you can try mounting the file system and start the daemon:

  /usr/arla/bin/xfs_load /usr/arla/bin/xfs
  /usr/arla/bin/mount_xfs /dev/xfs0 /afs
  /usr/arla/bin/arlad

Tru64 Unix (aka Digital Unix (aka OSF/1)):

Copy the xfs.mod to some of /subsys, /var/subsys, /sys/BINARY,
or /subsystems. Depending on what your kloadsrv thinks is the
right thing<tm>.

Load (configure) the module with sysconfig -c xfs

Query the module to see if it loaded ok and get the
character device and syscall number from it with:
sysconfig -q xfs

Create the char-device "mknod /dev/xfs0 c <MAJOR> 0"
where <MAJOR> is the number obtained above.

Create the afs directory: mkdir /afs

Mount the device and start the daemon: 
   /usr/arla/bin/mount_xfs /dev/xfs0 /afs
   /usr/arla/bin/arlad

It could look something like this:

datan:~# sysconfig -c xfs
datan:~# sysconfig -q xfs
syscall = 34
major = 68
debug = 255
datan:~# mknod /dev/xfs0 c 68 0
datan:~# mkdir /afs
datan:~# /usr/arla/bin/mount_xfs /dev/xfs0 /afs
datan:~# /usr/arla/bin/arlad 
datan:~# ls /afs | head
.stacken.kth.se
afs.brain.de
afs.hursley.ibm.com
afs1.scri.fsu.edu

* Tests

There are a number of tests in the `tests' directory.  Use a command
similar to the following to run them:

env WORKDIR=workdir ./run-tests 

where `workdir' is a temporary directory in AFS space where you have
read and write permission.  run-tests takes lots of options, try
`-help'.  You should probably start by running `-fast -all' and if you
have a lot of patience and time try `-all'.
