Installation procedure - BSD/OS 3.1
KAME project
$Id: INSTALL,v 1.16 2000/11/22 10:51:21 itojun 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
=================
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 (say, sys.tar.gz) from CD-ROM, tape or
  whatever
	% cd kame/bsdi3
	% gunzip -c < sys.tar.gz | tar xf -
- Apply patches
	% cd kame/bsdi3/sys
	% patch -f -p3 < ../sys.diff
- Make sys/i386/OBJ available by copying it, or symlinking it.
  The following examples assume that you have sys/i386/OBJ tree in
  /usr/src/sys/i386/OBJ.  Invoke
	% cd kame/bsdi3/sys/i386
	% (cd /usr/src/sys/i386; tar Bpcf - OBJ) | tar Bpxf -
  or
	% cd kame/bsdi3/sys/i386
	% ln -s /usr/src/sys/i386/OBJ

0-2: Apply sysctl diff
- Get the unpatched source code (say, sysctl.tar.gz) from CD-ROM, tape or
  whatever
	% cd kame/bsdi3/sbin
	% gunzip -c < sysctl.tar.gz | tar xf -
	(we assume that the source tree is extracted under sbin/sysctl.)
- Apply patches
	% cd kame/bsdi3/sbin/sysctl
	(note that you aren't at the top directory, i.e. `bsdi3', 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/bsdi3/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/bsdi3/usr.bin/ppp
	(note that you aren't at the top directory, i.e. `bsdi3', 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/bsdi3).
     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.v6 should have commonly used IPv6 definitions, so you may want to
     copy the file to begin with.
	% cp GENERIC.v6 CONFIGFILE
	% vi CONFIGFILE
	% config CONFIGFILE

B-4. Build the kernel.  The process will make kernel file named "netbsd".
	% 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/bsdi3).
     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.
	# fastboot


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. If you would like to use IPv6-ready inetd, you will need to stop using
     /usr/sbin/inetd and switch to /usr/local/v6/sbin/inetd.
     To do this, please replace the following section of /etc/rc:

>if [ -f /etc/inetd.conf ]; then
>	echo -n ' inetd';       inetd -u ${inetd_ignore:-internal}
>fi

     with this:

>if [ -f /etc/inetd.conf ]; then
>	echo -n ' inetd'
>	if [ -x /usr/local/v6/sbin/inetd ]; then
>		/usr/local/v6/sbin/inetd -u ${inetd_ignore:-internal}
>	else
>		inetd -u ${inetd_ignore:-internal}
>	fi
>fi

     Configuration file is placed in /etc/inetd.conf, but with enhanced syntax
     (it is backward compatible so do not be afraid).  Consult manpages
     for details.  You only need add lines for IPv6-ready daemons with "tcp6"
     or "udp6", like below:
>ftp	stream	tcp6	nowait	root	/usr/local/v6/libexec/ftpd	ftpd -l

E-3. 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-4. 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 writing this, we KAME team confirmed that
all the official patches can be applied without any conflicts and that
the GENERIC.v6 kernel can be compiled on the patched kernel
tree. However, if you see any troubles on applying official patches,
please let us know.
