Project

General

Profile

strongSwan on Android » History » Version 1

Tobias Brunner, 12.04.2010 15:27
first part of the android documentation

1 1 Tobias Brunner
h1. strongSwan on Android
2 1 Tobias Brunner
3 1 Tobias Brunner
The IKEv2 daemon charon has been ported to "Google Android":http://www.android.com.
4 1 Tobias Brunner
5 1 Tobias Brunner
This document describes how to build strongSwan for Android 2.0 (using the emulator).
6 1 Tobias Brunner
7 1 Tobias Brunner
h2. Android Source Tree
8 1 Tobias Brunner
9 1 Tobias Brunner
You will need the complete Android source to build strongSwan. Instructions on how to download and build it can be found on the "Android website":http://source.android.com/download.
10 1 Tobias Brunner
11 1 Tobias Brunner
To checkout a specific branch or tag of the sources, specify it with the @-b@ parameter when using the @repo init@ command.
12 1 Tobias Brunner
13 1 Tobias Brunner
Since building the whole source tree takes quite a while you should probably start with this first:
14 1 Tobias Brunner
<pre>
15 1 Tobias Brunner
cd /path/to/android/source
16 1 Tobias Brunner
. build/envsetup.sh
17 1 Tobias Brunner
lunch 1
18 1 Tobias Brunner
make
19 1 Tobias Brunner
</pre>
20 1 Tobias Brunner
21 1 Tobias Brunner
h2. Android Kernel
22 1 Tobias Brunner
23 1 Tobias Brunner
The prebuilt kernel that is used for the emulator lacks some modules required for strongSwan to work correctly. It is therefore required to build a custom kernel. To get the current kernel config you can use the adb tool to download it from the running emulator. After starting the emulator use
24 1 Tobias Brunner
<pre>
25 1 Tobias Brunner
adb pull /proc/config.gz config.gz
26 1 Tobias Brunner
</pre>to copy the config to the current directory. Then enable the missing modules, this is mainly @CONFIG_XFRM_USER@ and @CONFIG_NET_KEY@ but might include other modules.
27 1 Tobias Brunner
Please compare your config to the list of [[KernelModules|required modules]] in this wiki (please note that some modules, especially all the IPv6 related modules, are not really required).
28 1 Tobias Brunner
29 1 Tobias Brunner
Clone the kernel sources and checkout an appropriate tag (check the version of the kernel in the emulator). For example:
30 1 Tobias Brunner
<pre>
31 1 Tobias Brunner
git clone git://android.git.kernel.org/kernel/common kernel
32 1 Tobias Brunner
cd kernel
33 1 Tobias Brunner
git checkout -t origin/android-goldfish-2.6.29
34 1 Tobias Brunner
</pre>
35 1 Tobias Brunner
You can then copy your config to this directory and compile the kernel sources using
36 1 Tobias Brunner
<pre>
37 1 Tobias Brunner
export ARCH=arm
38 1 Tobias Brunner
export CROSS_COMPILE=/path/to/android/source/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
39 1 Tobias Brunner
make oldconfig
40 1 Tobias Brunner
make
41 1 Tobias Brunner
</pre>
42 1 Tobias Brunner
43 1 Tobias Brunner
To start the emulator using your custom kernel use the following command:
44 1 Tobias Brunner
<pre>
45 1 Tobias Brunner
emulator -kernel /path/to/kernel/source/arch/arm/boot/zImage &
46 1 Tobias Brunner
</pre>