The following document describes how to build capi support for your
linux kernel and how to compile the capi20 library needed to use it.

[SUSE: Suse has support for CAPI 2.0, most notably for the AVM Cards. Therefore,
       on Suse you should be able to get Capi working using YaST)
 Debian: There exist precompiled packages at http://wwww.ailis.de/~k/debian/]

Step 1) Patching your kernel

	Standardkernels below version 2.2.17 need the latest isdn4linux 
	isdn patches from ftp://ftp.suse.com/pub/isdn4linux/v2.2/isdn/isdn-*-tar.gz
	Kernels above 2.2.17 have capi support build in. 

Step 2) Configuring your kernel
        (if you use a vendor driver, like described below- otherwise
	 just select your card in Active ISDN cards, and activate Capi 2.0)

Activate:
    Code maturity level options  ---> 
	    [*] Prompt for development and/or incomplete code/drivers
    
    ISDN Subsystem / Active ISDN cards --->  
	    <M> Capi 2.0 support  
	    [*] CAPI2.0 Middleware support 
	    [*] CAPI2.0 filesystem support 

or edit .config and set:
	...
        CONFIG_EXPERIMENTAL=y
	...
        CONFIG_ISDN_CAPI=m
        CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
        CONFIG_ISDN_CAPI_MIDDLEWARE=y
        CONFIG_ISDN_CAPI_CAPI20=m
        CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
        CONFIG_ISDN_CAPI_CAPIFS=m
        CONFIG_ISDN_CAPI_CAPIDRV=m

Step 3) Compiling your new kernel

make dep clean bzImage modules modules_install

Step 4) Installing the capi4k-utils

Download the latest isdn4k-utils.*.tar.gz package from
ftp://ftp.cs.tu-berlin.de/pub/net/isdn/isdn4linux/utils/
and extract it.
To configure it, enter "make menuconfig", then make && make install
You should also run makedev.sh in the scripts/ directory to build
the device files in /dev/
This procedure should have installed libcapi20.so.* files in
/usr/lib or /usr/local/lib. These files are necessary to compile
capi20 applications, most notably caiviar.

Step 5) Installing additional drivers
If you have an AVM card. (Fritz, B1, etc.), download
the card drivers from ftp.avm.de/cardware. It's probably one of 
the *suse*.tar.gz files. Extract this file. 
Versions 7.2 and older also contains the source for the kernel capi modules, 
from version 7.3 only the fcpci.o module (with some of the sources) and the 
two rpms c4l-lib*.rpm and c4l-sys*.rpm are included. (As the kernel capi 
modules usually come with your kernel, anyway)
c4l-lib*.rpm contains the capi4linux libraries/binaries. If you installed 
capi2linux from source, you don't need this file.
c4l-sys*.rpm once more contains the capi kernel modules. You don't need
this file, too.
Therefore, all you should need to do is to copy the file src.drv/fcpci.o
(NOT the fcpci.o file from the root directory of the archive- that's a 
 precompiled version and usually not working) into your
kernel module directory (something like /lib/modules/2.4.*/kernel/drivers/
isdn/avmb1). make install does that automatically. 
After "make install", you should copy the <card>.conf file
into /etc/capi.conf. You may also call ./install, which will install
bootup scripts to call capiinit at boot, and as extract the 
above-mentioned rpms. (if make install worked, but ./install didn't- that's
ok, refer to troubleshooting below)

Step 5 Troubleshooting:
* Tim Weippert reports [1] that you sometimes have to edit the
  Makefiles so that the -I compiler options point to the right
  kernel directory. 
* You should make sure that the links /usr/include/linux and 
  /usr/include/asm are set and point to the right kernel source directories.  
* You don't have to call ./install, and in some cases, you shouldn't. If 
  you didn't, you'll have to write the bootup scripts yourself, however.
  (Write a script which calls "capiinit start" at boot, and insert/link it
   in /etc/rc.d/rc*.d/) (the capiinit tool is part of the isdn4linux
   distribution)
* In some cases, calling the ./install script breaks everything. In that case, 
  repeat the steps above (kernel compilation (most noticably: make modules_install)
  and the installation of isdn4linux).
* In one case (Driver Version 7.2), I had to change lines
  171, 180 and 196 in capifs.c from "#if 0" to "#if 1" to avoid compilation
  errors in src.sys.
* In another case (Driver Version 7.3, Kernel 2.4.17), I had to use a hexeditor
  to change the kernel version number in the files lib/fcpci-lib.o and 
  ./fcpci.o (change 2.4.10-4GB to 2.4.17^@4GB, where ^@ is the hex code 00) 
  _before_ compilation (!).

[6] Reboot
After booting the new kernel (and execution of the bootup script), the capi 
interface should be active.


[1] http://www.topf-sicret.de/help/capi20.html
[2] http://capi4linux.thepenguin.de/links.shtml
