<< | Thread Index | >> ]    [ << | Date Index | >> ]

To: "'Andreas Stagl'" <a.stagl,AT,gmx,DOT,at>
Subject: RE: Cipe on Debian
From: "Mark Smith" <mark.smith,AT,avcosystems,DOT,co,DOT,uk>
Date: Tue, 26 Aug 2003 10:55:27 +0100
Cc: "Cipe list \(E-mail\)" <cipe-l,AT,inka,DOT,de>
Importance: Normal
In-reply-to: <>

(Copied to list so that someone may fancy making a FAQ out of it)

Compiling CIPE on a Debian system

This information may be useful for those not running Debian as well, but
please be aware that this information is provided based on my own
experiences of compiling and recompiling CIPE on Debian only.  Insert
standard disclaimer here.  Some level of knowledge is assumed about handling
files, unpacking files, etc.  Do ask if something isn't clear.

There are a few simple steps that you need to perform to get the binary
module compiled as a package for your particular kernel.  Please note that
due to the uncountable combinations of both pre-packaged and patched
kernels, it is simply not feasible to provide pre-compiled binaries for
CIPE, which is why it needs to be built from source.

There are two approaches to this, based on whether you are using a
pre-packaged kernel, or one you have compiled yourself.  The latter is far
easier as you already have the kernel source, configuration, dependencies
and version needed for CIPE.

Stock kernel

For a stock kernel, you do need the matching kernel source before you can
compile CIPE.  This and the configuration are used to create the
dependencies and thus the module versions that are needed for CIPE to be
insertable without getting those near-famous unresolved symbols.  If that's
what you get, it's because either the source or the configuration does not
match your running kernel.

Unpack the kernel source and add a symbolic link so that /usr/src/linux
points to the correct source tree for the kernel you are compiling for.
This doesn't necessarily need to be the currently running kernel, but will
be the version CIPE will be compiled against.  Others may point out that you
don't need to do this, but it makes life marginally easier than specifying
the location - I didn't do that, so I won't include it here.  This is
intended for beginners needing to compile CIPE.

Once you have this, you need two pieces of information, which the kernel
package should have supplied.  One is the kernel config, usually found in
/boot as config-<flavour>, for example, "config-2.4.18-1-686".  The other is
the kernel version and package version.  Change directory to your unpacked
kernel source, as file references are usually relative to this directory.
If you already have a file ".config", rename it out of the way.  Edit
"Makefile" and set EXTRAVERSION to match the kernel you are compiling
against, eg


If you don't have /usr/src/linux/debian directory, we need to create it.
Run "make-kpkg" and when it starts asking you config questions, stop it with
CTRL-C.  If you have /usr/src/linux/.config, it'll use it and you won't get
a chance to stop the process.  At this point, you'll have a skeleton
directory with a changelog that starts:

  kernel-source-2.4.18-1-686 (10.00.Custom) unstable; urgency=low

Next, take a good look at the changelog that's hopefully been provided with
the kernel, usually found in
/usr/share/doc/kernel-image-<flavour>/changelog.gz.  The top line will read
something like:

  kernel-image-2.4.18-1-i386 (2.4.18-11) stable-security; urgency=high

This gives us important information about matching the package version of
CIPE against the package version of the kernel.  We can change the kernel
source changelog by copying the source version from the kernel image
changelog (2.4.18-11) over the kernel source changelog (10.00.Custom) as

  kernel-source-2.4.18-1-686 (2.4.18-11) unstable; urgency=low

This is the only line used by the CIPE build scripts, so it doesn't matter
to CIPE that the rest of the file isn't uptodate.  Now copy the config file,
for example /boot/config-2.4.18-1-686, to ".config".  Finally, run

  make oldconfig dep

This will create the configuration and dependency amd version information
needed for building modules against a specific kernel version.

Kernel with dependency information

If you have compiled your own kernel, or at some point followed the steps
above to create the dependency and version information that a module needs,
you can now get on with the reasonably simple process of building CIPE
itself.  If you've installed the Debian CIPE source, you should have
/usr/src/cipe.tar.gz which should be unpacked, resulting in
/usr/src/modules/cipe.  Change to this directory and run

debian/rules binary-modules

It'll hopefully run through all on it's own and create a package in /usr/src
based on your kernel version, for example

This package should then install without a problem and autostart any tunnels
you may already have configured in /etc/cipe/peers.  You can create and
install multiple such packages, and when you change kernel versions, perhaps
to go back to a working one when a new one fails, CIPE will pick the correct
daemon and module, based on your kernel version as reported by 'uname -r'.

This process has worked for me a number of times, if it doesn't work for
you, post to the list and I'll try to help you find out why, and if needed
I'll then revise these instructions.

Take care, and stay happy,

Mark Smith - Avco Systems Ltd
email: mark.smith,AT,avcosystems,DOT,co,DOT,uk
Tel: +44 (0)1784 430996 Fax: +44 (0)1784 431078

<< | Thread Index | >> ]    [ << | Date Index | >> ]