Installation procedure - BSD/OS 4.3
KAME project
$Id: INSTALL,v 1.32 2002/04/01 10:49:40 jinmei Exp $


You'll need to follow the steps below.  They can be separated into two major
sections - kernel build and userland build.

Be sure to perform "tree preparation" procedure, described in
../INSTALL, prior to taking the steps below.


0. applying diffs
=================
(the step needs to happen in ../INSTALL, step 2)

Part of the KAME source code tree is supplied as diffs, not the whole
source code.  Therefore, to make a complete KAME tree, the following
procedure is necessary.  NOTE: "cd" commands in the following examples
show the full pathname from the top of KAME tree.

0-1: Apply kernel diff
- Get the unpatched source code (SYS_SOURCE-4.3.tar.gz) from your BSD/OS
  source CD-ROM, tape or whatever
	% cd kame/bsdi4
	% mkdir sys
	% cd sys
	% gunzip -c < /cdrom/PACKAGES/SYS_SOURCE-4.3.tar.gz | tar xf -
- Apply patches
	% cd kame/bsdi4/sys
	% patch -f -p3 < ../sys.diff
- Remove files only used with NRL-based IPv6 support.
	% cd kame/bsdi4
	% make remove-nrl

0-2: Apply sysctl diff
- Get the unpatched source code (say, sysctl.tar.gz) from CD-ROM, tape or
  whatever
	% cd kame/bsdi4/sbin
	% gunzip -c < sysctl.tar.gz | tar xf -
	(we assume that the source tree is extracted under sbin/sysctl.)
- Apply patches
	% cd kame/bsdi4/sbin/sysctl
	(note that you aren't at the top directory, i.e. `bsdi4', as a
	 result of the above procedure(s). If so, please make sure to
	 go back to the top directory in advance).
	% patch -f -p4 < ../sysctl.diff

0-3: Apply ppp diff
- Get the unpatched source code (say, ppp.tar.gz) from CD-ROM, tape or
  whatever
	% cd kame/bsdi4/usr.bin
	% gunzip -c < ppp.tar.gz | tar xf -
	(we assume that the source tree is extracted under usr.bin/ppp.)
- Apply patches
	% cd kame/bsdi4/usr.bin/ppp
	(note that you aren't at the top directory, i.e. `bsdi4', as a
	 result of the above procedure(s). If so, please make sure to
	 go back to the top directory in advance).
	% patch -f -p4 < ../ppp.diff

0-4: please go back to ../INSTALL (top-level INSTALL document), step 3.


A. Backup
=========
The following procedure replaces, or overwrites, the following
files/directories:
	/bsd
	/usr/include
so you may want to back them up before going through the steps.

A-1. Backup your kernel file, if you need to.
	# cp /bsd /bsd.previous

A-2. Backup /usr/include directory, if you want an untouched tree to be
   preserved somewhere.
	# cd /usr
	# mkdir include.clean
	# cd include.clean
	# (cd ../include; tar Bpcf - . ) | tar Bpxf -


B. Kernel build
===============
Consult BSDI documentations for more detail.

B-0. It is assumed that you are in platform-specific directory (kame/bsdi4).
     If you are not, chdir to there.

B-1. Prepare symlinks in sys directory, as normal user.
	% make includes

B-2. Go down to sys/i386/conf.
	% cd sys/i386/conf

B-3. Make a kernel configuration file, and type "config CONFIGFILE".
     GENERIC.KAME should have commonly used IPv6 definitions, so you may want
     to copy the file to begin with.
	% cp GENERIC.KAME CONFIGFILE
	% vi CONFIGFILE
	% config CONFIGFILE

B-4. Build the kernel.  The process will make kernel file named "bsd".
	% cd ../../compile/CONFIGFILE
	% make depend
	% make

B-5. Copy the kernel file to root directory, as root.
	# cp bsd /


C. Userland build
=================
C-0. It is assumed that you are in platform-specific directory (kame/bsdi4).
     If you are not, chdir to there.

C-1. Prepare symlinks in sys directory, as normal user (same as B-1, so it
     is not necessary if you've performed B-1).
	% make includes

C-2. Invoke "make install-includes" as root.  This will populate KAME-ready
     include files into /usr/include.
	# make install-includes

C-3. As normal user (or root, if you prefer) perform "make".
	% make

C-4. As root, perform "make install".  This will install necessary userland
     tools into /usr/local/v6/{bin,sbin,whatever}.  This should not replace
     existing IPv4-only userland tools, so it is safe.
	# make install


D. Reboot
=========
D-1. Reboot with the command you like.
	# reboot


E. Configurations, in short
===========================
E-1. Most of configuration files are placed in /usr/local/v6/etc.
     You may want to copy those foo.sample files into non-sample (foo),
     edit as necessary.  You may also want to invoke /usr/local/v6/etc/rc.net6
     from /etc/rc.local. 

E-2. Commands modified by KAME project are placed in /usr/local/v6/{bin,sbin}.
     For daily use, you will need to add both of (or either of) them
     into your command search path (consult manpage for your favorite
     shell).  Make sure to make them used before /usr/bin or /usr/sbin,
     otherwise you end up using OS-supplied (hence not IPv6 nor IPsec capable)
     commands.

E-3. There are batch of documents installed into /usr/local/v6/man
     and /usr/local/v6/share/doc.  Please read them as necessary.
     If you wish to develop your own programs, we suggest you to read through
     supplied documents, RFCs, and other documents to learn how.

F(optional). Apply BSDI's official patches
===========================
If you want to apply official patches from BSDI to your KAME based
bsdi kernel, just apply the patches after building the KAME based
kernel source tree.  As of April 1st, 2002, we KAME team confirmed
that all the official patches (up to M430-003) could be applied
without any conflicts except followings:

in6_pcb.c.diff in M430-003
in6_src.c.diff in M430-003
udp_usrreq.c.diff in M430-003
  you can ignore these conflicts, since the KAME tree has already
  contained the diff.

ip6_output.c.diff in M430-003
nd6_nbr.c.diff in M430-003
udp6_outut.c.diff in M430-003
  you can ignore these patches or conflicts, since the KAME tree uses
  its own version of the original files for the patches, and the KAME
  version does not have the bug that the patches try to fix.

We also checked that the GENERIC.KAME kernel can be compiled on the
patched kernel tree.  If you still see any troubles on applying
official patches, please let us know.
