<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wikilegacy.armadeus.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JeremieS</id>
	<title>ArmadeusWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wikilegacy.armadeus.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=JeremieS"/>
	<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Special:Contributions/JeremieS"/>
	<updated>2026-06-12T01:27:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11734</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11734"/>
		<updated>2013-03-18T16:09:10Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Touchscreen handling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note| If you are using &#039;&#039;&#039;Armadeus BSP 5.2&#039;&#039;&#039; version or less, you must modify Qt FTP URL in &#039;&#039;buildroot/package/qt/qt.mk&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Replace line16:&lt;br /&gt;
QT_SITE    = http://get.qt.nokia.com/qt/source&lt;br /&gt;
# By:&lt;br /&gt;
QT_SITE    = ftp://ftp.qt-project.org/qt/source/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
&lt;br /&gt;
===Qt configuration===&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                [*] tslib&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Linux configuration===&lt;br /&gt;
&lt;br /&gt;
To use a touchscreen, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the driver corresponding to your touchscreen in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Touchscreens  ---&amp;gt;&lt;br /&gt;
            --- Touchscreens&lt;br /&gt;
            &amp;lt; &amp;gt;   ADS7846/TSC2046/AD7873 and AD(S)7843 based touchscreens&lt;br /&gt;
            &amp;lt; &amp;gt;   AD7877 based touchscreens&lt;br /&gt;
            &amp;lt; &amp;gt;   AD7879 based touchscreens: AD7879-1 I2C Interface&lt;br /&gt;
            ...&lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Embedded system configuration===&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/input/eventX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/input/eventX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== VNC ==&lt;br /&gt;
&lt;br /&gt;
* You can have a VNC server linked to a Qt application.&lt;br /&gt;
&lt;br /&gt;
=== Qt configuration ===&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the VNC server option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-gfx-vnc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the VNC server option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers ---&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                  [ ] Qt Virtual Framebuffer&lt;br /&gt;
                  [*] VNC&lt;br /&gt;
                  [ ] multiscreen&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run a VNC server on embedded system ===&lt;br /&gt;
&lt;br /&gt;
* When you execute a Qt application, run it with the following options:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ./application -qws -display VNC:0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You can replace 0 in the command by any number, that will correspond to the VNC server ID, that you have to use in a VNC client to connect.&lt;br /&gt;
&lt;br /&gt;
* Now you can launch a VNC client and connect.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
* [http://qt-project.org/doc/qt-4.8/qt-embedded-vnc.html Qt&#039;s VNC server]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11584</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11584"/>
		<updated>2013-01-30T13:49:04Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Qt&amp;#039;s VNC server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note| If you are using &#039;&#039;&#039;Armadeus BSP 5.2&#039;&#039;&#039; version or less, you must modify Qt FTP URL in &#039;&#039;buildroot/package/qt/qt.mk&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Replace line16:&lt;br /&gt;
QT_SITE    = http://get.qt.nokia.com/qt/source&lt;br /&gt;
# By:&lt;br /&gt;
QT_SITE    = ftp://ftp.qt-project.org/qt/source/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/input/eventX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/input/eventX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== VNC ==&lt;br /&gt;
&lt;br /&gt;
* You can have a VNC server linked to a Qt application.&lt;br /&gt;
&lt;br /&gt;
=== Qt configuration ===&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the VNC server option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-gfx-vnc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the VNC server option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers ---&amp;gt;&lt;br /&gt;
                  ...&lt;br /&gt;
                  [ ] Qt Virtual Framebuffer&lt;br /&gt;
                  [*] VNC&lt;br /&gt;
                  [ ] multiscreen&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run a VNC server on embedded system ===&lt;br /&gt;
&lt;br /&gt;
* When you execute a Qt application, run it with the following options:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ./application -qws -display VNC:0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You can replace 0 in the command by any number, that will correspond to the VNC server ID, that you have to use in a VNC client to connect.&lt;br /&gt;
&lt;br /&gt;
* Now you can launch a VNC client and connect.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
* [http://qt-project.org/doc/qt-4.8/qt-embedded-vnc.html Qt&#039;s VNC server]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11564</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11564"/>
		<updated>2013-01-25T16:11:30Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note| If you are using &#039;&#039;&#039;Armadeus BSP 5.2&#039;&#039;&#039; version or less, you must modify Qt FTP URL in &#039;&#039;buildroot/package/qt/qt.mk&#039;&#039;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Replace line16:&lt;br /&gt;
QT_SITE    = http://get.qt.nokia.com/qt/source&lt;br /&gt;
# By:&lt;br /&gt;
QT_SITE    = ftp://ftp.qt-project.org/qt/source/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/input/eventX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/input/eventX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11556</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11556"/>
		<updated>2013-01-22T11:00:26Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Embedded system configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/input/eventX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/input/eventX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=11301</id>
		<title>AsDevices</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=11301"/>
		<updated>2012-10-09T08:31:58Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Generate doxygen documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under_Construction}}&lt;br /&gt;
&lt;br /&gt;
AsDevices is an ARMadeus specific library that simplify APF-board devices usage for developers. This library is written to be used with C, C++, Python, (Java?) languages.&lt;br /&gt;
The core is written in C and other languages support is done with &amp;quot;wrappers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Note| This library is under development, see the [[AsDevices#Development_planning | Development planning.]] to know which functionality is finished.}}&lt;br /&gt;
&lt;br /&gt;
== Install AsDevices on target ==&lt;br /&gt;
&lt;br /&gt;
The library is included in Buildroot menu, to use it just select it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base library is in C, to use it with C++ or Python, select the wrapper you need. (For Python you will need to select Python interpreter before as_devices wrapper).&lt;br /&gt;
&lt;br /&gt;
== Generate doxygen documentation ==&lt;br /&gt;
* If &#039;&#039;&#039;doxygen&#039;&#039;&#039; isn&#039;t installed on your Linux distribution, you have to install the correct package:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo apt-get install doxygen&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then go in &#039;&#039;&#039;As Devices&#039;&#039;&#039; root directory.&lt;br /&gt;
* Generate the documentation with Doxygen:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ doxygen Doxyfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Documentation has been generated in &#039;&#039;documentation&#039;&#039;.&lt;br /&gt;
** Open documentation with:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ firefox documentation/index.html&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in C ==&lt;br /&gt;
&lt;br /&gt;
All functions in AsDevices library are constructed on the same way. An as_*_open() function return a device structure or an int that represent the device used. All function take this device structure in first parameter, and a function as_*_close() close the device :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
struct as_devicename_dev * as_devicename_open(&amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
as_devicename_do-something-with-device(struct as_devicename_dev *aDev, &amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
int as_devicename_close(struct as_devicename_dev *aDev);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each library, full documentation can be found in C header in directory &#039;&#039;target/packages/as_devices/c&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== I²C ===&lt;br /&gt;
&lt;br /&gt;
as_i2c_* functions are used to access devices on i²c bus that doesn&#039;t have/need a Linux driver. If you want to access an i²c device, please find out if a driver is not already existing before using this method.&lt;br /&gt;
&lt;br /&gt;
To open the bus, you have to know its number. On [[APF9328]] and [[APF27]] only two busses are present: number 0 and number 1. The &#039;&#039;open()&#039;&#039; function returns an int (file descriptor of the opened &#039;&#039;/dec/i2c-x&#039;&#039;), that have to be passed to all other as_i2c_* functions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_i2c_open(unsigned int i2c_id);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then depending on the complexity of the I2C device communication protocol, you can either use read()/write() (simple frames) or ioctl() with complex &amp;quot;read then write&amp;quot;/&amp;quot;write then read&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
* Example (simple write()):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;as_devices/as_i2c.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int my_device = 0;&lt;br /&gt;
#define MY_DEV_ADDR 0x23&lt;br /&gt;
#define MY_I2C_BUS 1&lt;br /&gt;
unsigned char buf[10];&lt;br /&gt;
int ret;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_device = as_i2c_open(MY_I2C_BUS);&lt;br /&gt;
if (my_device &amp;lt; 0) {&lt;br /&gt;
    printf(&amp;quot;Can&#039;t init I2C port %d!!\n&amp;quot;, MY_I2C_BUS);&lt;br /&gt;
    return -1;&lt;br /&gt;
}&lt;br /&gt;
as_i2c_set_slave(my_device, MY_DEV_ADDR);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
buf[0] = (unsigned char) my_val;&lt;br /&gt;
ret = write(my_device, buf, 1);&lt;br /&gt;
if (ret &amp;lt; 0)&lt;br /&gt;
    printf(&amp;quot;Error while sending data to device !!\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SPI ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
To use as_spi_* function, the &#039;&#039;spidev&#039;&#039; kernel module/interface is required. See [[SPI]]&lt;br /&gt;
page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device file &#039;&#039;/dev/spidevx.x&#039;&#039; is available from the kernel, as_spi library can be used by including the &#039;&#039;as_spi.h&#039;&#039; header in your C source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_spi.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Full description of the API can be found in this header, available on&lt;br /&gt;
[http://armadeus.git.sourceforge.net/git/gitweb.cgi?p=armadeus/armadeus;a=blob_plain;f=target/packages/as_devices/c/as_spi.h;hb=HEAD sourceforge repository].&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
The three mains useful functions used to communicate with a slave SPI device&lt;br /&gt;
are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_spi_open(const unsigned char *aSpidev_name);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the &#039;&#039;/dev/spidevx.x&#039;&#039; special spi file. This function return a file&lt;br /&gt;
handler that will be used for all othes as_spi_* function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
void as_spi_close(int aFd);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As its name said, to close the device.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
uint32_t as_spi_msg(int aFd, &lt;br /&gt;
                    uint32_t aMsg, &lt;br /&gt;
                    size_t aLen,&lt;br /&gt;
                    uint32_t aSpeed);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function forge spi messages on MOSI pin and return MISO message.&lt;br /&gt;
&lt;br /&gt;
=== GPIO ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_gpio_* functions, the &#039;&#039;gpio&#039;&#039; kernel module is required. See [[GPIO_Driver]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device files &#039;&#039;/dev/gpio/*&#039;&#039; are available , as_gpio library can be use by including &#039;&#039;as_gpio.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_gpio.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
Two examples are given, one for lightening led D14 and one to use blocking read on switch S1. This two example are made for [[APF27Dev]] daughter card.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightening led&#039;&#039;&#039;&lt;br /&gt;
With as_gpio, each pin port can be openned separately. The as_gpio_open() function returns a pointer on gpio pin structure declared like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 int ret; /* for returning value */&lt;br /&gt;
 struct as_gpio_device *pf14;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On APF27Dev, D14 is plugged on port F pin 14, then to open it :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 pf14 = as_gpio_open(&#039;F&#039;, 14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GPIO must be configured in ouput mode :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf14, &amp;quot;out&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then to switch LED value, just use &#039;&#039;as_gpio_set_pin_value()&#039;&#039; function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 1); /* led off */&lt;br /&gt;
 ...&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 0); /* led on */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because off led wiring, led polarity is inverted (to light on set 0).&lt;br /&gt;
&lt;br /&gt;
Once gpio pin usage is terminated, it must be closed :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 as_gpio_close(pf14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Pressing button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The button S1 can be used to test interrupt capability of gpio. The button is plugged on gpio port F pin 13.&lt;br /&gt;
After declaring the &#039;&#039;as_gpio_device&#039;&#039; structure, the pin port can be opened :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 struct as_gpio_device *pf13;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
 pf13 = as_gpio_open(&#039;F&#039;, 13);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To stuff must be configured before using it as interruption source, direction and IRQ mode.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;direction&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf13, &amp;quot;in&amp;quot;); /* set switch as input */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;IRQ mode&#039;&#039;&#039;&lt;br /&gt;
There is four IRQ mode :&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_NOINT  &#039;&#039;&#039;: No interrupt, the processor will ignore event on this gpio.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_RISING &#039;&#039;&#039;: rising edge, the processor will generate an interruption on rising edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_FALLING&#039;&#039;&#039;: falling edge, the processor will generate an interruption on falling edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_BOTH   &#039;&#039;&#039;: both, the processor will generate an interruption on both rising or falling edge of gpio.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_irq_mode(pf13, GPIO_IRQ_MODE_FALLING); /* interrupt will be generated on pushed button */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To capture interruption, the blocking read function can be used with a timeout. If no interruption is raised after the timeout time, read function end with error value -10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_blocking_get_pin_value(pf13, 3, 0); /* wait for interruption for 3 seconds and 0 µs) */&lt;br /&gt;
 if(ret == -10)&lt;br /&gt;
     printf(&amp;quot;Timeout\n&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADC ===&lt;br /&gt;
==== MAX1027 ====&lt;br /&gt;
==== AS1531 ====&lt;br /&gt;
=== DAC ===&lt;br /&gt;
==== MAX5821 ====&lt;br /&gt;
==== MCP4912 ====&lt;br /&gt;
=== 93LCXX ===&lt;br /&gt;
=== PWM ===&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_pwm_* functions, the kernel module &#039;&#039;imx_pwm&#039;&#039; needs to be loaded. See [[PWM]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the special files &#039;&#039;/sys/class/pwm/pwmX/*&#039;&#039; are available , as_pwm_* functions can be use by including &#039;&#039;as_pwm.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    struct as_pwm_device *my_pwm;&lt;br /&gt;
...&lt;br /&gt;
    my_pwm = as_pwm_open(0);&lt;br /&gt;
    if (!my_pwm)&lt;br /&gt;
        printf(&amp;quot;Can&#039;t init PWM !!\n&amp;quot;);&lt;br /&gt;
    as_pwm_set_frequency(my_pwm, 150);&lt;br /&gt;
    as_pwm_set_duty(my_pwm, 500);&lt;br /&gt;
...&lt;br /&gt;
    as_pwm_set_state(my_pwm, 1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in Python ==&lt;br /&gt;
&lt;br /&gt;
To use AsDevices in Python, select the python wrapper in menuconfig as follow :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
    [*]   wrapper Python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And keep all .py file on target :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Interpreter languages and scripting  ---&amp;gt;&lt;br /&gt;
        python module format to install (.py sources and .pyc compiled)  ---&amp;gt;&lt;br /&gt;
            (X) .py sources and .pyc compiled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then compile bsp and flash it on your board.&lt;br /&gt;
&lt;br /&gt;
Once done, just import the module AsDevices to use all function available in library:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import AsDevices&lt;br /&gt;
from AsDevices import AsGpio&lt;br /&gt;
&lt;br /&gt;
gpio = AsGpio(3)&lt;br /&gt;
gpio.setPinDirection(&#039;out&#039;)&lt;br /&gt;
gpio.setPinValue(1)&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in C++ ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Development planning ==&lt;br /&gt;
&lt;br /&gt;
AsDevices is not finished, following table indicates the remaining work:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; summary=&amp;quot;Development planning of AsDevices&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#efefef;&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! Name !! Component !! C functions !! C++ wrapper !! Python wrapper !! Python class !! description &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[I2C | i2c]] ||  || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||  Drive I2C&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[SPI | spi]] || || bgcolor=&amp;quot;green&amp;quot; | Ok, but not fully tested || bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  ||bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  || bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  || Drive SPI&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Gpio | gpio]] || || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok || Drive GPIO&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | ADC&lt;br /&gt;
| [[ADC_max1027 | max1027]] || bgcolor=&amp;quot;green&amp;quot;| Ok for SLOW mode ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[as1531 | as1531]] || bgcolor=&amp;quot;green&amp;quot;| Ok for SLOW mode ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | DAC&lt;br /&gt;
| [[Max5821 | max5821]] || bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Mcp4912 | mcp4912]] || bgcolor=&amp;quot;red&amp;quot;| NOK ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| eeprom || 93LCxx ||bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[PWM]] || ||bgcolor=&amp;quot;green&amp;quot; |  OK  ||  bgcolor=&amp;quot;green&amp;quot; | OK    || bgcolor=&amp;quot;red&amp;quot; | NOK  || bgcolor=&amp;quot;red&amp;quot; | NOK || Drive imx27 pwm |&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Backlight]] || ||bgcolor=&amp;quot;green&amp;quot; |  OK  ||  bgcolor=&amp;quot;green&amp;quot; | OK    || bgcolor=&amp;quot;red&amp;quot; | NOK  || bgcolor=&amp;quot;red&amp;quot; | NOK ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=11283</id>
		<title>AsDevices</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=11283"/>
		<updated>2012-10-02T08:12:06Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Development planning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under_Construction}}&lt;br /&gt;
&lt;br /&gt;
AsDevices is an ARMadeus specific library that simplify APF-board devices usage for developers. This library is written to be used with C, C++, Python, (Java?) languages.&lt;br /&gt;
The core is written in C and other languages support is done with &amp;quot;wrappers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Note| This library is under development, see the [[AsDevices#Development_planning | Development planning.]] to know which functionality is finished.}}&lt;br /&gt;
&lt;br /&gt;
== Install AsDevices on target ==&lt;br /&gt;
&lt;br /&gt;
The library is included in Buildroot menu, to use it just select it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base library is in C, to use it with C++ or Python, select the wrapper you need. (For Python you will need to select Python interpreter before as_devices wrapper).&lt;br /&gt;
&lt;br /&gt;
== Using library in C ==&lt;br /&gt;
&lt;br /&gt;
All functions in AsDevices library are constructed on the same way. An as_*_open() function return a device structure or an int that represent the device used. All function take this device structure in first parameter, and a function as_*_close() close the device :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
struct as_devicename_dev * as_devicename_open(&amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
as_devicename_do-something-with-device(struct as_devicename_dev *aDev, &amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
int as_devicename_close(struct as_devicename_dev *aDev);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each library, full documentation can be found in C header in directory &#039;&#039;target/packages/as_devices/c&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== I²C ===&lt;br /&gt;
&lt;br /&gt;
as_i2c_* functions are used to access devices on i²c bus that doesn&#039;t have/need a Linux driver. If you want to access an i²c device, please find out if a driver is not already existing before using this method.&lt;br /&gt;
&lt;br /&gt;
To open the bus, you have to know its number. On [[APF9328]] and [[APF27]] only two busses are present: number 0 and number 1. The &#039;&#039;open()&#039;&#039; function returns an int (file descriptor of the opened &#039;&#039;/dec/i2c-x&#039;&#039;), that have to be passed to all other as_i2c_* functions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_i2c_open(unsigned int i2c_id);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then depending on the complexity of the I2C device communication protocol, you can either use read()/write() (simple frames) or ioctl() with complex &amp;quot;read then write&amp;quot;/&amp;quot;write then read&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
* Example (simple write()):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;as_devices/as_i2c.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int my_device = 0;&lt;br /&gt;
#define MY_DEV_ADDR 0x23&lt;br /&gt;
#define MY_I2C_BUS 1&lt;br /&gt;
unsigned char buf[10];&lt;br /&gt;
int ret;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_device = as_i2c_open(MY_I2C_BUS);&lt;br /&gt;
if (my_device &amp;lt; 0) {&lt;br /&gt;
    printf(&amp;quot;Can&#039;t init I2C port %d!!\n&amp;quot;, MY_I2C_BUS);&lt;br /&gt;
    return -1;&lt;br /&gt;
}&lt;br /&gt;
as_i2c_set_slave(my_device, MY_DEV_ADDR);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
buf[0] = (unsigned char) my_val;&lt;br /&gt;
ret = write(my_device, buf, 1);&lt;br /&gt;
if (ret &amp;lt; 0)&lt;br /&gt;
    printf(&amp;quot;Error while sending data to device !!\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SPI ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
To use as_spi_* function, the &#039;&#039;spidev&#039;&#039; kernel module/interface is required. See [[SPI]]&lt;br /&gt;
page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device file &#039;&#039;/dev/spidevx.x&#039;&#039; is available from the kernel, as_spi library can be used by including the &#039;&#039;as_spi.h&#039;&#039; header in your C source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_spi.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Full description of the API can be found in this header, available on&lt;br /&gt;
[http://armadeus.git.sourceforge.net/git/gitweb.cgi?p=armadeus/armadeus;a=blob_plain;f=target/packages/as_devices/c/as_spi.h;hb=HEAD sourceforge repository].&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
The three mains useful functions used to communicate with a slave SPI device&lt;br /&gt;
are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_spi_open(const unsigned char *aSpidev_name);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the &#039;&#039;/dev/spidevx.x&#039;&#039; special spi file. This function return a file&lt;br /&gt;
handler that will be used for all othes as_spi_* function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
void as_spi_close(int aFd);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As its name said, to close the device.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
uint32_t as_spi_msg(int aFd, &lt;br /&gt;
                    uint32_t aMsg, &lt;br /&gt;
                    size_t aLen,&lt;br /&gt;
                    uint32_t aSpeed);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function forge spi messages on MOSI pin and return MISO message.&lt;br /&gt;
&lt;br /&gt;
=== GPIO ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_gpio_* functions, the &#039;&#039;gpio&#039;&#039; kernel module is required. See [[GPIO_Driver]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device files &#039;&#039;/dev/gpio/*&#039;&#039; are available , as_gpio library can be use by including &#039;&#039;as_gpio.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_gpio.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
Two examples are given, one for lightening led D14 and one to use blocking read on switch S1. This two example are made for [[APF27Dev]] daughter card.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightening led&#039;&#039;&#039;&lt;br /&gt;
With as_gpio, each pin port can be openned separately. The as_gpio_open() function returns a pointer on gpio pin structure declared like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 int ret; /* for returning value */&lt;br /&gt;
 struct as_gpio_device *pf14;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On APF27Dev, D14 is plugged on port F pin 14, then to open it :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 pf14 = as_gpio_open(&#039;F&#039;, 14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GPIO must be configured in ouput mode :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf14, &amp;quot;out&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then to switch LED value, just use &#039;&#039;as_gpio_set_pin_value()&#039;&#039; function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 1); /* led off */&lt;br /&gt;
 ...&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 0); /* led on */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because off led wiring, led polarity is inverted (to light on set 0).&lt;br /&gt;
&lt;br /&gt;
Once gpio pin usage is terminated, it must be closed :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 as_gpio_close(pf14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Pressing button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The button S1 can be used to test interrupt capability of gpio. The button is plugged on gpio port F pin 13.&lt;br /&gt;
After declaring the &#039;&#039;as_gpio_device&#039;&#039; structure, the pin port can be opened :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 struct as_gpio_device *pf13;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
 pf13 = as_gpio_open(&#039;F&#039;, 13);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To stuff must be configured before using it as interruption source, direction and IRQ mode.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;direction&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf13, &amp;quot;in&amp;quot;); /* set switch as input */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;IRQ mode&#039;&#039;&#039;&lt;br /&gt;
There is four IRQ mode :&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_NOINT  &#039;&#039;&#039;: No interrupt, the processor will ignore event on this gpio.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_RISING &#039;&#039;&#039;: rising edge, the processor will generate an interruption on rising edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_FALLING&#039;&#039;&#039;: falling edge, the processor will generate an interruption on falling edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_BOTH   &#039;&#039;&#039;: both, the processor will generate an interruption on both rising or falling edge of gpio.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_irq_mode(pf13, GPIO_IRQ_MODE_FALLING); /* interrupt will be generated on pushed button */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To capture interruption, the blocking read function can be used with a timeout. If no interruption is raised after the timeout time, read function end with error value -10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_blocking_get_pin_value(pf13, 3, 0); /* wait for interruption for 3 seconds and 0 µs) */&lt;br /&gt;
 if(ret == -10)&lt;br /&gt;
     printf(&amp;quot;Timeout\n&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ADC ===&lt;br /&gt;
==== MAX1027 ====&lt;br /&gt;
==== AS1531 ====&lt;br /&gt;
=== DAC ===&lt;br /&gt;
==== MAX5821 ====&lt;br /&gt;
==== MCP4912 ====&lt;br /&gt;
=== 93LCXX ===&lt;br /&gt;
=== PWM ===&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_pwm_* functions, the kernel module &#039;&#039;imx_pwm&#039;&#039; needs to be loaded. See [[PWM]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the special files &#039;&#039;/sys/class/pwm/pwmX/*&#039;&#039; are available , as_pwm_* functions can be use by including &#039;&#039;as_pwm.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    struct as_pwm_device *my_pwm;&lt;br /&gt;
...&lt;br /&gt;
    my_pwm = as_pwm_open(0);&lt;br /&gt;
    if (!my_pwm)&lt;br /&gt;
        printf(&amp;quot;Can&#039;t init PWM !!\n&amp;quot;);&lt;br /&gt;
    as_pwm_set_frequency(my_pwm, 150);&lt;br /&gt;
    as_pwm_set_duty(my_pwm, 500);&lt;br /&gt;
...&lt;br /&gt;
    as_pwm_set_state(my_pwm, 1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in Python ==&lt;br /&gt;
&lt;br /&gt;
To use AsDevices in Python, select the python wrapper in menuconfig as follow :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
    [*]   wrapper Python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And keep all .py file on target :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Interpreter languages and scripting  ---&amp;gt;&lt;br /&gt;
        python module format to install (.py sources and .pyc compiled)  ---&amp;gt;&lt;br /&gt;
            (X) .py sources and .pyc compiled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then compile bsp and flash it on your board.&lt;br /&gt;
&lt;br /&gt;
Once done, just import the module AsDevices to use all function available in library:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import AsDevices&lt;br /&gt;
from AsDevices import AsGpio&lt;br /&gt;
&lt;br /&gt;
gpio = AsGpio(3)&lt;br /&gt;
gpio.setPinDirection(&#039;out&#039;)&lt;br /&gt;
gpio.setPinValue(1)&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in C++ ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Development planning ==&lt;br /&gt;
&lt;br /&gt;
AsDevices is not finished, following table indicates the remaining work:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; summary=&amp;quot;Development planning of AsDevices&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#efefef;&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! Name !! Component !! C functions !! C++ wrapper !! Python wrapper !! Python class !! description &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[I2C | i2c]] ||  || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||  Drive I2C&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[SPI | spi]] || || bgcolor=&amp;quot;green&amp;quot; | Ok, but not fully tested || bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  ||bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  || bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested  || Drive SPI&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Gpio | gpio]] || || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok || Drive GPIO&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | ADC&lt;br /&gt;
| [[ADC_max1027 | max1027]] || bgcolor=&amp;quot;green&amp;quot;| Ok for SLOW mode ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[as1531 | as1531]] || bgcolor=&amp;quot;green&amp;quot;| Ok for SLOW mode ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | DAC&lt;br /&gt;
| [[Max5821 | max5821]] || bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=&amp;quot;green&amp;quot;| Ok, but not fully tested ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Mcp4912 | mcp4912]] || bgcolor=&amp;quot;red&amp;quot;| NOK ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| eeprom || 93LCxx ||bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[PWM]] || ||bgcolor=&amp;quot;green&amp;quot; |  OK  ||  bgcolor=&amp;quot;green&amp;quot; | OK    || bgcolor=&amp;quot;red&amp;quot; | NOK  || bgcolor=&amp;quot;red&amp;quot; | NOK || Drive imx27 pwm |&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Backlight]] || ||bgcolor=&amp;quot;green&amp;quot; |  OK  ||  bgcolor=&amp;quot;green&amp;quot; | OK    || bgcolor=&amp;quot;red&amp;quot; | NOK  || bgcolor=&amp;quot;red&amp;quot; | NOK ||&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11214</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11214"/>
		<updated>2012-08-13T12:18:56Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Compilation for QVFB (Embedded x86/64) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [ftp://ftp.qt.nokia.com/ Nokia FTP]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/ttyX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/ttyX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11213</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=11213"/>
		<updated>2012-08-13T12:15:47Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Qt QVFB compilation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Compilation for QVFB (Embedded x86/64)==&lt;br /&gt;
* Get an Qt source archive from [Nokia FTP|ftp://ftp.qt.nokia.com/]&lt;br /&gt;
* Untar the archive into a compilation directory.&lt;br /&gt;
* Go into the source directory.&lt;br /&gt;
* Use following command to configure Qt:&lt;br /&gt;
** Other configuration options can be used, but the following are essential:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -depths 16,18 -embedded x86 -prefix /usr/local/Trolltech/QtEmbedded-4.7.2 -fast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then compile and install Qt:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make&lt;br /&gt;
$ sudo make install&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/ttyX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/ttyX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Screen rotation==&lt;br /&gt;
* activate it with : &#039;&#039;-qt-gfx-transformed&#039;&#039; (from buildroot menuconfig),&lt;br /&gt;
* to use it on the command line (for example 270°) : &#039;&#039;-display transformed:rot270&#039;&#039;&lt;br /&gt;
* or export the variable (for example 270°) : &#039;&#039;export QWS_DISPLAY=Transformed:Rot270.0&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF9328_and_APF27_migration_to_Linux_2.6.38&amp;diff=10939</id>
		<title>APF9328 and APF27 migration to Linux 2.6.38</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF9328_and_APF27_migration_to_Linux_2.6.38&amp;diff=10939"/>
		<updated>2012-06-08T13:50:12Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Things to know BEFORE booting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; {{Need_Update}}&lt;br /&gt;
==Instructions==&lt;br /&gt;
* Patches to port: &#039;&#039;buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/&#039;&#039;&lt;br /&gt;
* when working on a patch mark it with:&lt;br /&gt;
** &amp;lt;nowiki&amp;gt; ** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; ~~~~ &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;--&amp;gt;&#039;&#039;&#039; &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:14, 9 November 2010 (UTC)&lt;br /&gt;
* Strike the one that are no more needed:&lt;br /&gt;
** &amp;lt;strike&amp;gt; 000-xxxxxxx.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* Write OK in bold green and your name (automatic with 4x&#039;~&#039;) when corresponding patch has been ported:&lt;br /&gt;
** &amp;lt;nowiki&amp;gt; ** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; ~~~~ &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;--&amp;gt;&#039;&#039;&#039; 000-xxxxxxx.patch: &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 07:06, 21 October 2010 (UTC)&lt;br /&gt;
* How to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ cd armadeus-xx&lt;br /&gt;
$ cp buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/000-foo.patch buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/&lt;br /&gt;
$ cd buildroot/output/build/linux-2.6.38.1/&lt;br /&gt;
$ patch -p1 --dry-run &amp;lt; ../../../../buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/000-foo.patch&lt;br /&gt;
&lt;br /&gt;
... modify patch until it applies correctly ...&lt;br /&gt;
&lt;br /&gt;
$ patch -p1 &amp;lt; ../../../../buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/000-foo.patch&lt;br /&gt;
&lt;br /&gt;
... go one ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How to compile kernel ?===&lt;br /&gt;
* 1] Select 2.6.38.8 version in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Kernel  ---&amp;gt;&lt;br /&gt;
    (2.6.38.8) Kernel version&lt;br /&gt;
&lt;br /&gt;
Toolchain  ---&amp;gt;&lt;br /&gt;
    Kernel Headers (Linux 2.6 (manually specified version))  ---&amp;gt;&lt;br /&gt;
    (2.6.38.8) linux version&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 2] Change serial console :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
System configuration  ---&amp;gt;&lt;br /&gt;
    (ttymxc0) Port to run a getty (login prompt) on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 3] Compile whole Buildroot at least once&lt;br /&gt;
* 4] For the one who knows &#039;&#039;quilt&#039;&#039;, they can use &#039;&#039;scripts/quiltify.sh&#039;&#039; before starting (procedure in construction)&lt;br /&gt;
&lt;br /&gt;
===Things to know BEFORE booting===&lt;br /&gt;
* on 2.6.38 i.MX serial port names have been unified to /dev/ttymxc[0-6]. So if you want to see something on your serial console please do the following before booting:&lt;br /&gt;
** APF27&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
BIOS&amp;gt; setenv consoledev ttymxc0&lt;br /&gt;
BIOS&amp;gt; setenv baudrate 115200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;for the same reason you must also modify &#039;&#039;buildroot/output/target/etc/inittab&#039;&#039; and then do a &#039;&#039;make&#039;&#039; after a successful build.&amp;lt;/span&amp;gt;&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Framebuffer can now support multiple LCDs and so LCD you want to use must be passed as bootparam (like serial port). So you can do (for example):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
BIOS&amp;gt; setenv consoledev ttymxc0&lt;br /&gt;
BIOS&amp;gt; setenv baudrate 115200 video=imxfb:Chimei-LW700AT9003&lt;br /&gt;
## Switch baudrate to 115200 bps andpress ENTER ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Things to do AFTER booting===&lt;br /&gt;
* &amp;lt;strike&amp;gt;if you want to use touchscreen, please &#039;&#039;&#039;uncomment&#039;&#039;&#039; this line in &#039;&#039;/etc/ts.conf&#039;&#039; (line 2):&amp;lt;/strike&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# module_raw input&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==APF9328 patches==&lt;br /&gt;
===015 -&amp;gt; 040===&lt;br /&gt;
* 015-armadeus-logo-add_armadeus-project_tux.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:42, 21 October 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;016-armadeus-imxfb-add_platform_specific_init_exit_functions.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;018-armadeus-i2c-imx-add_driver_to_linux_build_system.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 14:27, 27 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;018-armadeus-i2c-imx.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 14:27, 27 November 2010 (UTC)&lt;br /&gt;
* 021-armadeus-apf9328_defconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 17:38, 6 November 2010 (UTC)&lt;br /&gt;
* 021-armadeus-apf9328.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
* 023-armadeus-fblcd-kconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* 024-armadeus-apf9328-add_board_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;028-armadeus-add_reg8_macro_to_hardware_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* 029-armadeus-add_csi_and_spi_registers_to_imx-regs_h.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
** renamed to 029-armadeus-add_csi_and_spi_registers.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-fixes_typo_for_usbdrcv_in_imx-regs_h.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* 030-armadeus-imx-generic.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
** renamed to 030-armadeus-imx.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-add_clock.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-change_source_sink_in_gadget_zero.to_fix&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-deactivate_cdc_in_ether_c.to_fix&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;031-armadeus-imx_udc_add_usb_h_include_to_arch_arm_mach-imx_include_mach.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;032-armadeus-imx_udc_makes_kconfig_selectable_on_imx_arch.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;033-darius-imx_udc-fix_imx_udc_gadget_bugs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;034-darius-imx_udc-fix_imx_udc_gadget_code_style.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;035-darius-imx_udc-fix_imx_udc_gadget_ep0_irq_handling.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;036-darius-imx_udc-fix_imx_udc_gadget_general_irq_handling.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* 037-armadeus-imx_udc-add_printk_when_probed.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 08:58, 18 December 2010 (UTC)&lt;br /&gt;
* 038-armadeus-imx_udc-prevent_crash_after_soft_reboot.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 08:58, 18 December 2010 (UTC)&lt;br /&gt;
* 040-armadeus-imxmmc-add_controller_driven_card_detection.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
* 040-armadeus-imxmmc-correct_some_freezes.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===041 -&amp;gt; 099===&lt;br /&gt;
* &amp;lt;strike&amp;gt;041-armadeus-imx_irq.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 08:06, 18 December 2010 (UTC)&lt;br /&gt;
* 050-armadeus-add_custom_drivers_to_kconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* 063-armadeus-max1027-add_max1027_include.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 072-armadeus-add_backlight_machinfo_to_imxfb_h.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* 073-armadeus-tsc2102_integrate_driver_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 073-armadeus-tsc2102.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 074-armadeus-tsc2102-touchscreen-add_driver_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 074-armadeus-tsc2102-touchscreen.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 075-armadeus-spi2-reg-irq-defines.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;076-arm-vmlinux-ld_script_patch_for_new_binutils.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;077-arm-checksyscalls.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;080-apf9328-armadeus-makes_mach-imx_gpio_h_includable_more_than_once.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* 088-can-mcp2515.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* 090-armadeus-alsa-create_imx-alsa_h.patch&lt;br /&gt;
* 091-armadeus-alsa-add_imx_ssi_tsc2102_driver.patch&lt;br /&gt;
* 092-armadeus-alsa-imx-ssi-tsc2102-integrate_driver_to_linux_build_system.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;094-armadeus-rtc1374-legacy.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 21:42, 21 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;095-armadeus-imx-ssi-add_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:31, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;096-armadeus-clock-add_ssi_clk.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:31, 7 February 2011 (UTC)&lt;br /&gt;
* 097-armadeus-imx-dma-improvements.patch&lt;br /&gt;
* 098-armadeus-imx-dma-announce_imx_is_supporting_scatter_gather.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;099-armadeus-imx_clock-adds_fake_clk_set_rate.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===100 -&amp;gt; 199===&lt;br /&gt;
* 100-armadeus-imx-serial-dont_allocate_rts_interrupt_if_not_needed.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 15:08, 7 November 2010 (UTC)&lt;br /&gt;
* 199-armadeus-hack_kernel_to_export_some_irq_handling_functions.patch&lt;br /&gt;
&lt;br /&gt;
==APF27 patches==&lt;br /&gt;
===220 -&amp;gt; 240===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 220-apf27-pengu-fec-old.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete: fec_old has been replaced by fec in mainline - [[User:JulienB|JulienB]] 08:58, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 221-apf27-armadeus-fec-old_fixes.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete: same comment as above - [[User:JulienB|JulienB]] 09:00, 26 November 2010 (UTC)&lt;br /&gt;
* 226-apf27-pengu-mx27-Camera_support.patch&lt;br /&gt;
* 227-apf27-pengu-mx27-Add_simple_CPU_frequency_scaling_support.patch&lt;br /&gt;
* 230-apf27-pengu-mx2_devices_full.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 231-apf27-pengu-mxc_i2c_driver.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline (merge with MX1 one) - [[User:JulienB|JulienB]] 15:06, 25 November 2010 (UTC)&lt;br /&gt;
* 233-apf27-pengu-mx2_framebuffer_beta.patch&lt;br /&gt;
** Freescale framebuffer. rename patch to show this better... [[User:JulienB|JulienB]] 15:25, 25 November 2010 (UTC)&lt;br /&gt;
* 234-apf27-armadeus-mx2_framebuffer_beta_update_for_2_6_27.patch&lt;br /&gt;
* 235-apf27-armadeus-mx2_framebuffer-makes_it_work_with_8bpp.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 235-apf27-pengu-make_pcm038_full_featured.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 15:28, 25 November 2010 (UTC)&lt;br /&gt;
* 235-apf27-pengu-pcm038-add_BSP_part_of_the_CPU_frequency_scaler.patch&lt;br /&gt;
* 237-apf27-pengu-pcm970-Extend_to_current_development_status.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;238-apf27-pengu-mx27-Add_an_ALSA_driver_for_iMX27.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline in a different form -- [[User:JulienB|JulienB]] 17:45, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;238-apf27-pengu-pcm038-Add_ALSA_audio_support.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:45, 7 February 2011 (UTC)&lt;br /&gt;
* 239-apf27-armadeus-alsa-remove_mc13783_from_mx27_snd_driver_compilation.patch&lt;br /&gt;
** depends on 238&lt;br /&gt;
* 240-apf27-armadeus-fixe-bugs-drivers_mxc_nand.c.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:16, 9 November 2010 (UTC)&lt;br /&gt;
*** Divided into 2 patches&lt;br /&gt;
*** &#039;&#039;&#039;ecc_layout to be checked by Jorasse&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===252 -&amp;gt; 276===&lt;br /&gt;
* 252-apf27-pengu-m27-we_can_do_DMA_chaining.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;256-apf27-pengu-mx27-Add_USB_resources_and_platform_devices.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* 257-apf27-pengu-mx27-Add_EHCI_support.patch&lt;br /&gt;
** partially integrated, to check where ULPI part is gone...&lt;br /&gt;
* &amp;lt;strike&amp;gt;270-apf27-armadeus-imxmmc-add_sdhc1_resources_to_arch_arm_mach-mx2_device.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;271-apf27-armadeus-imxmmc-add_missing_definitions_in_dma-mx1-mx2_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete, imxmmc driver needs to be cleanup instead -- [[User:JulienB|JulienB]] 21:56, 21 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;272-apf27-armadeus-mxcmmc-add_sdhc2_pins_in_iomux-mx1-mx2_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;273-apf27-armadeus-imxmmc-create_arch_arm_plat-mxc_include_mach_mmc_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - imxmmc driver has to be cleanup instead -- [[User:JulienB|JulienB]] 22:13, 21 December 2010 (UTC)&lt;br /&gt;
* 274-apf27-armadeus-mxcmmc-improve_support_of_sdio_cards.patch&lt;br /&gt;
** partially integrated in mainline, rest is &#039;&#039;&#039;OK&#039;&#039;&#039; -- [[User:JulienB|JulienB]] 09:45, 16 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
===280 -&amp;gt; 299===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 280-apf27-armadeus-correct_bugs_in_clock_infrastructure.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** corrected in a better way by mainline - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
* 281-apf27-armadeus-add_apf27.c.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:26, 8 November 2010 (UTC) &lt;br /&gt;
** &#039;&#039;&#039;arch/arm/mach-mx2 has been renamed arch/arm/mach-imx&#039;&#039;&#039;&lt;br /&gt;
* 282-apf27-armadeus-add_apf27_to_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:26, 8 November 2010 (UTC) &lt;br /&gt;
** &#039;&#039;&#039;arch/arm/mach-mx2 has been renamed arch/arm/mach-imx&#039;&#039;&#039;&lt;br /&gt;
* &amp;lt;strike&amp;gt;283-apf27-armadeus-add_dump_uart_registers_function_to_imx_serial_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more useful - [[User:JulienB|JulienB]] 07:19, 25 November 2010 (UTC)&lt;br /&gt;
* 285-apf27-armadeus-add_LQO43_to_mxcfb_modedb.patch&lt;br /&gt;
* 286-apf27-armadeus-add_LQO57_to_mxcfb_modedb.patch&lt;br /&gt;
* 286b-apf27-armadeus-add_LW700AT9003_to_mxcfb_modedb.patch&lt;br /&gt;
* 286c-apf27-armadeus-add_Optrex-T51638D084_to_mxcfb_modedb.patch&lt;br /&gt;
* 286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch&lt;br /&gt;
* 286z-apf27-armadeus-add_CUSTOM_LCD_template_to_mxcfb_modedb.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;287-apf27-armadeus-fix_usb_otg_int.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:42, 24 November 2010 (UTC)&lt;br /&gt;
* 288-apf27-set-ttySMX-ref-imx-uart.patch&lt;br /&gt;
** To remove and inform users that now serial ports are ttymxc[0-6] -- [[User:JulienB|JulienB]] 18:13, 7 February 2011 (UTC)&lt;br /&gt;
* 290-apf27-pengu-spi_addons.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039;, renamed to 290-armadeus-mx2-iomux-add_correct_directions_to_SPI2_gpios.patch - [[User:JulienB|JulienB]] 08:26, 22 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 291-apf27-add_debug_support_with_UART1.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:35, 9 November 2010 (UTC)&lt;br /&gt;
* 291-apf27-armadeus-add_mach_board-apf27_h.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:55, 22 December 2010 (UTC)&lt;br /&gt;
* 292-apf27-armadeus-i2c-fix.patch&lt;br /&gt;
* 293-apf27-armadeus-spi_imx-add_gpio_init_and_iMX27_support.patch&lt;br /&gt;
** probably obsolete, to check...- [[User:JulienB|JulienB]] 08:58, 22 December 2010 (UTC)&lt;br /&gt;
** moved SPI bus selection outside of it -&amp;gt; 293-armadeus-spi_imx-add_config_options_to_individually_activate_spi_busses.patch -- [[User:JulienB|JulienB]] 15:10, 7 January 2011 (UTC)&lt;br /&gt;
* 294-apf27-armadeus-imxfb-create_imx_fb_h.patch&lt;br /&gt;
** needed by Freescale framebuffer&lt;br /&gt;
* &amp;lt;strike&amp;gt;294b-apf27-armadeus-imxfb-create_imxfb_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 18:13, 7 February 2011 (UTC)&lt;br /&gt;
* 295-apf27-armadeus-imxfb-modify_imxfb_device_name_for_freescale_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 296-apf27-armadeus-imx27-usb-host1.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
* 297-apf27-armadeus-add_backlight_machinfo_to_plat_mxc_imxfb_h.patch&lt;br /&gt;
* 297-apf27-armadeus-add_ethernet_PHY.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 299-apf27-armadeus-reboot.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===300 -&amp;gt; 320===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 300-apf27-armadeus-jffs2_debug.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 07:28, 25 November 2010 (UTC)&lt;br /&gt;
* 301-apf27-armadeus-ssi-SSI1_TXD_is_an_ouput_not_an_input.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:02, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 301-armadeus-mx2_ssi-SSIn_TXD_are_ouputs_not_inputs.patch&lt;br /&gt;
* 302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch&lt;br /&gt;
* 303-apf27-armadeus-improve_mx2-dam_driver.patch&lt;br /&gt;
* 304-apf27-armadeus-improve_mx2-ssi_driver.patch&lt;br /&gt;
* 305-apf27-armadeus-separates_imx_and_mx2_alsa_build.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:29, 9 November 2010 (UTC)&lt;br /&gt;
* 311-apf27-armadeus-mx27-add_pm_infra.patch&lt;br /&gt;
* 312-apf27-armadeus-ulpi-add_function_control_register_address.patch&lt;br /&gt;
* 314-apf27-armadeus-ad9889.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:12, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 314-armadeus-ad9889-add_driver.patch&lt;br /&gt;
* 315-apf27-darius-mxc-watchdog.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:45, 25 November 2010 (UTC)&lt;br /&gt;
** now only used for MX1, as MX2+ driver has been committed in mainline&lt;br /&gt;
** renamed to 315-darius-imx_wdt-add_watchdog_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;316-apf27-armadeus-watchdog-makes_darius_driver_work_on_mx27.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 10:45, 25 November 2010 (UTC)&lt;br /&gt;
* 317-apf27-armadeus-add_kconfig_option_to_use_imx_led_and_switch_for_powermanagement_test.patch&lt;br /&gt;
* 318-apf27-pengu-mxc_add_vpu_driver.patch&lt;br /&gt;
* 319-armadeus-soc_camera_add_ov96xx_sensors_driver.patch&lt;br /&gt;
** OK, patch applies but driver needs to be ported (doesn&#039;t compile) - [[User:JulienB|JulienB]] 14:03, 22 December 2010 (UTC)&lt;br /&gt;
* 320-apf27-armadeus-increase_max_dma_zone_size.patch&lt;br /&gt;
&lt;br /&gt;
===320 -&amp;gt; 339===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 321-apf27-armadeus-mx2_adds_pwm_ressources.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:14, 25 November 2010 (UTC)&lt;br /&gt;
* 321-apf27-armadeus-mx2_pwm_fixes.patch&lt;br /&gt;
** check if PE5_PF_PWM0 needs to be forced as GPIO_OUT - [[User:JulienB|JulienB]] 19:19, 25 November 2010 (UTC)&lt;br /&gt;
* 322-apf27-armadeus-add_mach_fpga_h.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:25, 25 November 2010 (UTC)&lt;br /&gt;
* 323-apf27-armadeus-increases_board_irq_number.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:38, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 323-pengu-imxfb-add_platform_specific_init_exit_functions.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:43, 25 November 2010 (UTC)&lt;br /&gt;
* 324-armadeus-declare_scatter_gather_support_in_linux_scatterlist_h.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 325-pengu-imxfb-add_mx27_support.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:29, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 327-pengu-imxfb-fix_margin_settings.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:32, 25 November 2010 (UTC)&lt;br /&gt;
* 328-pengu-imxfb-add_clock_support.patch&lt;br /&gt;
** partly integrated, to check if pcr recalculation is still needed. [[User:JulienB|JulienB]] 16:43, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 329-pengu-imxfb-fix_tft_mode_init.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:43, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 330-armadeus-imxfb-makes_mainline_driver_selectable_for_mx2.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:59, 25 November 2010 (UTC)&lt;br /&gt;
* 330-armadeus-imxfb-power_on_backlight_after_lcd_logic.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 16:55, 25 November 2010 (UTC)&lt;br /&gt;
* 331-armadeus-imxfb-makes_setpalettereg_compatible_with_mx27.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 17:05, 25 November 2010 (UTC)&lt;br /&gt;
* 332-armadeus-imxfb-improvements.patch&lt;br /&gt;
** depends on 328 (pcr)&lt;br /&gt;
* 333-armadeus-imxfb-makes_plat-mxc_imxfb_h_compatible_with_mx27.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 17:36, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 333-armadeus-imxfb-makes_distinction_between_mx1_and_mx2_bit_per_pixel_selection_in_PCR_fields.patch&lt;br /&gt;
* 334-armadeus-imxfb-supports_8bpp_in_tft_mode.patch&lt;br /&gt;
** depends on 332&lt;br /&gt;
* &amp;lt;strike&amp;gt; 336-armadeus-imxfb-makes_it_compatible_with_arch_imx.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 17:44, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 337-armadeus-imxfb-add_lcd_clock_def_for_imx_platform.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 17:48, 25 November 2010 (UTC)&lt;br /&gt;
* 337b-armadeus-mx2fb-add_backlight_power_switch_capability.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 338-denx-mxcgpio-emulates_interrupt_on_both_edges.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:33, 24 November 2010 (UTC)&lt;br /&gt;
* 339-apf27-armadeus-add_platform_data_init_support_to_spidev.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:05, 25 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===340 -&amp;gt; 349===&lt;br /&gt;
* 340-apf27-martin-keypad-add_driver_for_mx2.patch&lt;br /&gt;
** another driver seems to have been integrated in mainline... To check&lt;br /&gt;
* 341-apf27-armadeus-serial-add_uart_modules_selection_in_kconfig.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:30, 26 November 2010 (UTC)&lt;br /&gt;
* 342-apf27-armadeus-serial-some_uart_pins_are_not_available_on_apf27_based_designs.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:35, 26 November 2010 (UTC)&lt;br /&gt;
* 343-apf27-amoled-hx5116.patch&lt;br /&gt;
* 345-apf27-armadeus-iomux-display_gpio_number_when_reservation_fails.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:43, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 346-smsc-lan95xx-activates_led_outputs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 347b-smsc-lan95xx-add_additionnal_USB_products_IDs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* 347c-armadeus-lan95xx-activate_blinking_leds.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:58, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 347-smsc-lan95xx-removes_eeprom_loaded_check.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;348-armadeus-plat-mxc-gpio.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 08:04, 7 February 2011 (UTC)&lt;br /&gt;
* 349-armadeus-spi-backport_2.6.32.2.patch&lt;br /&gt;
&lt;br /&gt;
===350 -&amp;gt; ...===&lt;br /&gt;
* 350-armadeus-spi-improve_spi_gpio_for_single_data_pin.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;351-armadeus-spi_imx-update_for_2.6.32_compatibility.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 352-armadeus-time-fix_timekeeping_resume.patch&lt;br /&gt;
** to check&lt;br /&gt;
* &amp;lt;strike&amp;gt;355a-denx-fsl_udc-Add_iMX3x_support_to_the_fsl_usb2_udc_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355b-montavista-fsl_udc_core-fix_kernel_oops_on_module_removal.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355c-armadeus-mx2-devices-add_usb_device.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355d-armadeus-fsl_udc-add_platform_init_support.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 355e-armadeus-fsl_udc-reset_temporary_fix.patch&lt;br /&gt;
** to check...&lt;br /&gt;
* 356-armadeus-soc_camera-add_ov7670_sensor_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;357-armadeus-mx27camera-add_CSICR1_REDGE_handling.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 358-armadeus-imx-adding_mangling_capability_on_i2c_imx_driver.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:FabienM|FabienM]] 11:17, 13 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;359-armadeus-joystick-adding_as5011_joystick_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Under 2.6.38 kernel now.[[User:FabienM|FabienM]] 14:37, 28 January 2011 (UTC) &lt;br /&gt;
* 361-armadeus-soc_camera-add_ov3640_sensor_driver.patch&lt;br /&gt;
* 362-apf27-armadeus-fec-old_ifconfig_up_down_fix.patch&lt;br /&gt;
** patch is obsolete as we now use fec and not fec_old, but problem seems still to be here on fec&lt;br /&gt;
* 363-armadeus-ADC-Adding_AS1531_adc_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;364-armadeus-add_usb3315_registers_definition_in_ulpi_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 365-pps-armadeus-add_pps_baseboard.patch&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF9328_and_APF27_migration_to_Linux_2.6.38&amp;diff=10938</id>
		<title>APF9328 and APF27 migration to Linux 2.6.38</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF9328_and_APF27_migration_to_Linux_2.6.38&amp;diff=10938"/>
		<updated>2012-06-08T13:13:39Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Things to know BEFORE booting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; {{Need_Update}}&lt;br /&gt;
==Instructions==&lt;br /&gt;
* Patches to port: &#039;&#039;buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/&#039;&#039;&lt;br /&gt;
* when working on a patch mark it with:&lt;br /&gt;
** &amp;lt;nowiki&amp;gt; ** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; ~~~~ &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;--&amp;gt;&#039;&#039;&#039; &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:14, 9 November 2010 (UTC)&lt;br /&gt;
* Strike the one that are no more needed:&lt;br /&gt;
** &amp;lt;strike&amp;gt; 000-xxxxxxx.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* Write OK in bold green and your name (automatic with 4x&#039;~&#039;) when corresponding patch has been ported:&lt;br /&gt;
** &amp;lt;nowiki&amp;gt; ** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; ~~~~ &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
** &#039;&#039;&#039;--&amp;gt;&#039;&#039;&#039; 000-xxxxxxx.patch: &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 07:06, 21 October 2010 (UTC)&lt;br /&gt;
* How to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ cd armadeus-xx&lt;br /&gt;
$ cp buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/000-foo.patch buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/&lt;br /&gt;
$ cd buildroot/output/build/linux-2.6.38.1/&lt;br /&gt;
$ patch -p1 --dry-run &amp;lt; ../../../../buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/000-foo.patch&lt;br /&gt;
&lt;br /&gt;
... modify patch until it applies correctly ...&lt;br /&gt;
&lt;br /&gt;
$ patch -p1 &amp;lt; ../../../../buildroot/target/device/armadeus/linux/kernel-patches/2.6.38/000-foo.patch&lt;br /&gt;
&lt;br /&gt;
... go one ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How to compile kernel ?===&lt;br /&gt;
* 1] Select 2.6.38.8 version in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Kernel  ---&amp;gt;&lt;br /&gt;
    (2.6.38.8) Kernel version&lt;br /&gt;
&lt;br /&gt;
Toolchain  ---&amp;gt;&lt;br /&gt;
    Kernel Headers (Linux 2.6 (manually specified version))  ---&amp;gt;&lt;br /&gt;
    (2.6.38.8) linux version&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 2] Change serial console :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
System configuration  ---&amp;gt;&lt;br /&gt;
    (ttymxc0) Port to run a getty (login prompt) on&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* 3] Compile whole Buildroot at least once&lt;br /&gt;
* 4] For the one who knows &#039;&#039;quilt&#039;&#039;, they can use &#039;&#039;scripts/quiltify.sh&#039;&#039; before starting (procedure in construction)&lt;br /&gt;
&lt;br /&gt;
===Things to know BEFORE booting===&lt;br /&gt;
* on 2.6.38 i.MX serial port names have been unified to /dev/ttymxc[0-6]. So if you want to see something on your serial console please do the following before booting:&lt;br /&gt;
** APF27&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
BIOS&amp;gt; setenv consoledev=ttymxc0&lt;br /&gt;
BIOS&amp;gt; setenv baudrate 115200&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;for the same reason you must also modify &#039;&#039;buildroot/output/target/etc/inittab&#039;&#039; and then do a &#039;&#039;make&#039;&#039; after a successful build.&amp;lt;/span&amp;gt;&amp;lt;/strike&amp;gt;&lt;br /&gt;
* Framebuffer can now support multiple LCDs and so LCD you want to use must be passed as bootparam (like serial port). So you can do (for example):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
BIOS&amp;gt; setenv consoledev=ttymxc0&lt;br /&gt;
BIOS&amp;gt; setenv baudrate 115200 video=imxfb:Chimei-LW700AT9003&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Things to do AFTER booting===&lt;br /&gt;
* &amp;lt;strike&amp;gt;if you want to use touchscreen, please &#039;&#039;&#039;uncomment&#039;&#039;&#039; this line in &#039;&#039;/etc/ts.conf&#039;&#039; (line 2):&amp;lt;/strike&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# module_raw input&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==APF9328 patches==&lt;br /&gt;
===015 -&amp;gt; 040===&lt;br /&gt;
* 015-armadeus-logo-add_armadeus-project_tux.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:42, 21 October 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;016-armadeus-imxfb-add_platform_specific_init_exit_functions.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;018-armadeus-i2c-imx-add_driver_to_linux_build_system.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 14:27, 27 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;018-armadeus-i2c-imx.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 14:27, 27 November 2010 (UTC)&lt;br /&gt;
* 021-armadeus-apf9328_defconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 17:38, 6 November 2010 (UTC)&lt;br /&gt;
* 021-armadeus-apf9328.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
* 023-armadeus-fblcd-kconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* 024-armadeus-apf9328-add_board_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;028-armadeus-add_reg8_macro_to_hardware_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* 029-armadeus-add_csi_and_spi_registers_to_imx-regs_h.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
** renamed to 029-armadeus-add_csi_and_spi_registers.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-fixes_typo_for_usbdrcv_in_imx-regs_h.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* 030-armadeus-imx-generic.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
** renamed to 030-armadeus-imx.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-add_clock.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-change_source_sink_in_gadget_zero.to_fix&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;030-armadeus-imx_udc-deactivate_cdc_in_ether_c.to_fix&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 13:12, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;031-armadeus-imx_udc_add_usb_h_include_to_arch_arm_mach-imx_include_mach.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;032-armadeus-imx_udc_makes_kconfig_selectable_on_imx_arch.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 16:46, 4 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;033-darius-imx_udc-fix_imx_udc_gadget_bugs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;034-darius-imx_udc-fix_imx_udc_gadget_code_style.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;035-darius-imx_udc-fix_imx_udc_gadget_ep0_irq_handling.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* &amp;lt;strike&amp;gt;036-darius-imx_udc-fix_imx_udc_gadget_general_irq_handling.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
* 037-armadeus-imx_udc-add_printk_when_probed.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 08:58, 18 December 2010 (UTC)&lt;br /&gt;
* 038-armadeus-imx_udc-prevent_crash_after_soft_reboot.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 08:58, 18 December 2010 (UTC)&lt;br /&gt;
* 040-armadeus-imxmmc-add_controller_driven_card_detection.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
* 040-armadeus-imxmmc-correct_some_freezes.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 18:40, 21 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===041 -&amp;gt; 099===&lt;br /&gt;
* &amp;lt;strike&amp;gt;041-armadeus-imx_irq.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:GwenhaelG|GwenhaelG]] 08:06, 18 December 2010 (UTC)&lt;br /&gt;
* 050-armadeus-add_custom_drivers_to_kconfig.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* 063-armadeus-max1027-add_max1027_include.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 072-armadeus-add_backlight_machinfo_to_imxfb_h.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* 073-armadeus-tsc2102_integrate_driver_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 073-armadeus-tsc2102.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 074-armadeus-tsc2102-touchscreen-add_driver_to_linux_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 074-armadeus-tsc2102-touchscreen.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* 075-armadeus-spi2-reg-irq-defines.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;076-arm-vmlinux-ld_script_patch_for_new_binutils.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;077-arm-checksyscalls.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 09:01, 18 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;080-apf9328-armadeus-makes_mach-imx_gpio_h_includable_more_than_once.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* 088-can-mcp2515.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 07:54, 17 December 2010 (UTC)&lt;br /&gt;
* 090-armadeus-alsa-create_imx-alsa_h.patch&lt;br /&gt;
* 091-armadeus-alsa-add_imx_ssi_tsc2102_driver.patch&lt;br /&gt;
* 092-armadeus-alsa-imx-ssi-tsc2102-integrate_driver_to_linux_build_system.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;094-armadeus-rtc1374-legacy.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 21:42, 21 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;095-armadeus-imx-ssi-add_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:31, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;096-armadeus-clock-add_ssi_clk.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:31, 7 February 2011 (UTC)&lt;br /&gt;
* 097-armadeus-imx-dma-improvements.patch&lt;br /&gt;
* 098-armadeus-imx-dma-announce_imx_is_supporting_scatter_gather.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; - [[User:GwenhaelG|GwenhaelG]] 13:14, 16 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;099-armadeus-imx_clock-adds_fake_clk_set_rate.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===100 -&amp;gt; 199===&lt;br /&gt;
* 100-armadeus-imx-serial-dont_allocate_rts_interrupt_if_not_needed.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:GwenhaelG|GwenhaelG]] 15:08, 7 November 2010 (UTC)&lt;br /&gt;
* 199-armadeus-hack_kernel_to_export_some_irq_handling_functions.patch&lt;br /&gt;
&lt;br /&gt;
==APF27 patches==&lt;br /&gt;
===220 -&amp;gt; 240===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 220-apf27-pengu-fec-old.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete: fec_old has been replaced by fec in mainline - [[User:JulienB|JulienB]] 08:58, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 221-apf27-armadeus-fec-old_fixes.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete: same comment as above - [[User:JulienB|JulienB]] 09:00, 26 November 2010 (UTC)&lt;br /&gt;
* 226-apf27-pengu-mx27-Camera_support.patch&lt;br /&gt;
* 227-apf27-pengu-mx27-Add_simple_CPU_frequency_scaling_support.patch&lt;br /&gt;
* 230-apf27-pengu-mx2_devices_full.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 231-apf27-pengu-mxc_i2c_driver.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline (merge with MX1 one) - [[User:JulienB|JulienB]] 15:06, 25 November 2010 (UTC)&lt;br /&gt;
* 233-apf27-pengu-mx2_framebuffer_beta.patch&lt;br /&gt;
** Freescale framebuffer. rename patch to show this better... [[User:JulienB|JulienB]] 15:25, 25 November 2010 (UTC)&lt;br /&gt;
* 234-apf27-armadeus-mx2_framebuffer_beta_update_for_2_6_27.patch&lt;br /&gt;
* 235-apf27-armadeus-mx2_framebuffer-makes_it_work_with_8bpp.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 235-apf27-pengu-make_pcm038_full_featured.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 15:28, 25 November 2010 (UTC)&lt;br /&gt;
* 235-apf27-pengu-pcm038-add_BSP_part_of_the_CPU_frequency_scaler.patch&lt;br /&gt;
* 237-apf27-pengu-pcm970-Extend_to_current_development_status.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;238-apf27-pengu-mx27-Add_an_ALSA_driver_for_iMX27.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline in a different form -- [[User:JulienB|JulienB]] 17:45, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;238-apf27-pengu-pcm038-Add_ALSA_audio_support.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 17:45, 7 February 2011 (UTC)&lt;br /&gt;
* 239-apf27-armadeus-alsa-remove_mc13783_from_mx27_snd_driver_compilation.patch&lt;br /&gt;
** depends on 238&lt;br /&gt;
* 240-apf27-armadeus-fixe-bugs-drivers_mxc_nand.c.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:16, 9 November 2010 (UTC)&lt;br /&gt;
*** Divided into 2 patches&lt;br /&gt;
*** &#039;&#039;&#039;ecc_layout to be checked by Jorasse&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===252 -&amp;gt; 276===&lt;br /&gt;
* 252-apf27-pengu-m27-we_can_do_DMA_chaining.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;256-apf27-pengu-mx27-Add_USB_resources_and_platform_devices.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* 257-apf27-pengu-mx27-Add_EHCI_support.patch&lt;br /&gt;
** partially integrated, to check where ULPI part is gone...&lt;br /&gt;
* &amp;lt;strike&amp;gt;270-apf27-armadeus-imxmmc-add_sdhc1_resources_to_arch_arm_mach-mx2_device.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;271-apf27-armadeus-imxmmc-add_missing_definitions_in_dma-mx1-mx2_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete, imxmmc driver needs to be cleanup instead -- [[User:JulienB|JulienB]] 21:56, 21 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;272-apf27-armadeus-mxcmmc-add_sdhc2_pins_in_iomux-mx1-mx2_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 20:16, 24 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;273-apf27-armadeus-imxmmc-create_arch_arm_plat-mxc_include_mach_mmc_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - imxmmc driver has to be cleanup instead -- [[User:JulienB|JulienB]] 22:13, 21 December 2010 (UTC)&lt;br /&gt;
* 274-apf27-armadeus-mxcmmc-improve_support_of_sdio_cards.patch&lt;br /&gt;
** partially integrated in mainline, rest is &#039;&#039;&#039;OK&#039;&#039;&#039; -- [[User:JulienB|JulienB]] 09:45, 16 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
===280 -&amp;gt; 299===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 280-apf27-armadeus-correct_bugs_in_clock_infrastructure.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** corrected in a better way by mainline - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
* 281-apf27-armadeus-add_apf27.c.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:26, 8 November 2010 (UTC) &lt;br /&gt;
** &#039;&#039;&#039;arch/arm/mach-mx2 has been renamed arch/arm/mach-imx&#039;&#039;&#039;&lt;br /&gt;
* 282-apf27-armadeus-add_apf27_to_build_system.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:orange&amp;quot;&amp;gt;&#039;&#039;&#039;In progress&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:JulienB|JulienB]] 14:26, 8 November 2010 (UTC) &lt;br /&gt;
** &#039;&#039;&#039;arch/arm/mach-mx2 has been renamed arch/arm/mach-imx&#039;&#039;&#039;&lt;br /&gt;
* &amp;lt;strike&amp;gt;283-apf27-armadeus-add_dump_uart_registers_function_to_imx_serial_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more useful - [[User:JulienB|JulienB]] 07:19, 25 November 2010 (UTC)&lt;br /&gt;
* 285-apf27-armadeus-add_LQO43_to_mxcfb_modedb.patch&lt;br /&gt;
* 286-apf27-armadeus-add_LQO57_to_mxcfb_modedb.patch&lt;br /&gt;
* 286b-apf27-armadeus-add_LW700AT9003_to_mxcfb_modedb.patch&lt;br /&gt;
* 286c-apf27-armadeus-add_Optrex-T51638D084_to_mxcfb_modedb.patch&lt;br /&gt;
* 286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch&lt;br /&gt;
* 286z-apf27-armadeus-add_CUSTOM_LCD_template_to_mxcfb_modedb.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;287-apf27-armadeus-fix_usb_otg_int.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:42, 24 November 2010 (UTC)&lt;br /&gt;
* 288-apf27-set-ttySMX-ref-imx-uart.patch&lt;br /&gt;
** To remove and inform users that now serial ports are ttymxc[0-6] -- [[User:JulienB|JulienB]] 18:13, 7 February 2011 (UTC)&lt;br /&gt;
* 290-apf27-pengu-spi_addons.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039;, renamed to 290-armadeus-mx2-iomux-add_correct_directions_to_SPI2_gpios.patch - [[User:JulienB|JulienB]] 08:26, 22 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 291-apf27-add_debug_support_with_UART1.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:35, 9 November 2010 (UTC)&lt;br /&gt;
* 291-apf27-armadeus-add_mach_board-apf27_h.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:55, 22 December 2010 (UTC)&lt;br /&gt;
* 292-apf27-armadeus-i2c-fix.patch&lt;br /&gt;
* 293-apf27-armadeus-spi_imx-add_gpio_init_and_iMX27_support.patch&lt;br /&gt;
** probably obsolete, to check...- [[User:JulienB|JulienB]] 08:58, 22 December 2010 (UTC)&lt;br /&gt;
** moved SPI bus selection outside of it -&amp;gt; 293-armadeus-spi_imx-add_config_options_to_individually_activate_spi_busses.patch -- [[User:JulienB|JulienB]] 15:10, 7 January 2011 (UTC)&lt;br /&gt;
* 294-apf27-armadeus-imxfb-create_imx_fb_h.patch&lt;br /&gt;
** needed by Freescale framebuffer&lt;br /&gt;
* &amp;lt;strike&amp;gt;294b-apf27-armadeus-imxfb-create_imxfb_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete -- [[User:JulienB|JulienB]] 18:13, 7 February 2011 (UTC)&lt;br /&gt;
* 295-apf27-armadeus-imxfb-modify_imxfb_device_name_for_freescale_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 296-apf27-armadeus-imx27-usb-host1.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
* 297-apf27-armadeus-add_backlight_machinfo_to_plat_mxc_imxfb_h.patch&lt;br /&gt;
* 297-apf27-armadeus-add_ethernet_PHY.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 299-apf27-armadeus-reboot.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:30, 9 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===300 -&amp;gt; 320===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 300-apf27-armadeus-jffs2_debug.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 07:28, 25 November 2010 (UTC)&lt;br /&gt;
* 301-apf27-armadeus-ssi-SSI1_TXD_is_an_ouput_not_an_input.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:02, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 301-armadeus-mx2_ssi-SSIn_TXD_are_ouputs_not_inputs.patch&lt;br /&gt;
* 302-apf27-armadeus-add_imx-alsa_h_to_plat-mxc_include_mach.patch&lt;br /&gt;
* 303-apf27-armadeus-improve_mx2-dam_driver.patch&lt;br /&gt;
* 304-apf27-armadeus-improve_mx2-ssi_driver.patch&lt;br /&gt;
* 305-apf27-armadeus-separates_imx_and_mx2_alsa_build.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 310-apf27-armadeus-nfc-makes_it_compile_with_CONFIG_PM.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed - [[User:JulienB|JulienB]] 15:29, 9 November 2010 (UTC)&lt;br /&gt;
* 311-apf27-armadeus-mx27-add_pm_infra.patch&lt;br /&gt;
* 312-apf27-armadeus-ulpi-add_function_control_register_address.patch&lt;br /&gt;
* 314-apf27-armadeus-ad9889.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:12, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 314-armadeus-ad9889-add_driver.patch&lt;br /&gt;
* 315-apf27-darius-mxc-watchdog.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 10:45, 25 November 2010 (UTC)&lt;br /&gt;
** now only used for MX1, as MX2+ driver has been committed in mainline&lt;br /&gt;
** renamed to 315-darius-imx_wdt-add_watchdog_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;316-apf27-armadeus-watchdog-makes_darius_driver_work_on_mx27.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 10:45, 25 November 2010 (UTC)&lt;br /&gt;
* 317-apf27-armadeus-add_kconfig_option_to_use_imx_led_and_switch_for_powermanagement_test.patch&lt;br /&gt;
* 318-apf27-pengu-mxc_add_vpu_driver.patch&lt;br /&gt;
* 319-armadeus-soc_camera_add_ov96xx_sensors_driver.patch&lt;br /&gt;
** OK, patch applies but driver needs to be ported (doesn&#039;t compile) - [[User:JulienB|JulienB]] 14:03, 22 December 2010 (UTC)&lt;br /&gt;
* 320-apf27-armadeus-increase_max_dma_zone_size.patch&lt;br /&gt;
&lt;br /&gt;
===320 -&amp;gt; 339===&lt;br /&gt;
* &amp;lt;strike&amp;gt; 321-apf27-armadeus-mx2_adds_pwm_ressources.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:14, 25 November 2010 (UTC)&lt;br /&gt;
* 321-apf27-armadeus-mx2_pwm_fixes.patch&lt;br /&gt;
** check if PE5_PF_PWM0 needs to be forced as GPIO_OUT - [[User:JulienB|JulienB]] 19:19, 25 November 2010 (UTC)&lt;br /&gt;
* 322-apf27-armadeus-add_mach_fpga_h.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:25, 25 November 2010 (UTC)&lt;br /&gt;
* 323-apf27-armadeus-increases_board_irq_number.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:38, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 323-pengu-imxfb-add_platform_specific_init_exit_functions.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:43, 25 November 2010 (UTC)&lt;br /&gt;
* 324-armadeus-declare_scatter_gather_support_in_linux_scatterlist_h.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 325-pengu-imxfb-add_mx27_support.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:29, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 327-pengu-imxfb-fix_margin_settings.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:32, 25 November 2010 (UTC)&lt;br /&gt;
* 328-pengu-imxfb-add_clock_support.patch&lt;br /&gt;
** partly integrated, to check if pcr recalculation is still needed. [[User:JulienB|JulienB]] 16:43, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 329-pengu-imxfb-fix_tft_mode_init.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:43, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 330-armadeus-imxfb-makes_mainline_driver_selectable_for_mx2.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 16:59, 25 November 2010 (UTC)&lt;br /&gt;
* 330-armadeus-imxfb-power_on_backlight_after_lcd_logic.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 16:55, 25 November 2010 (UTC)&lt;br /&gt;
* 331-armadeus-imxfb-makes_setpalettereg_compatible_with_mx27.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 17:05, 25 November 2010 (UTC)&lt;br /&gt;
* 332-armadeus-imxfb-improvements.patch&lt;br /&gt;
** depends on 328 (pcr)&lt;br /&gt;
* 333-armadeus-imxfb-makes_plat-mxc_imxfb_h_compatible_with_mx27.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 17:36, 25 November 2010 (UTC)&lt;br /&gt;
** renamed to 333-armadeus-imxfb-makes_distinction_between_mx1_and_mx2_bit_per_pixel_selection_in_PCR_fields.patch&lt;br /&gt;
* 334-armadeus-imxfb-supports_8bpp_in_tft_mode.patch&lt;br /&gt;
** depends on 332&lt;br /&gt;
* &amp;lt;strike&amp;gt; 336-armadeus-imxfb-makes_it_compatible_with_arch_imx.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 17:44, 25 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 337-armadeus-imxfb-add_lcd_clock_def_for_imx_platform.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** obsolete - [[User:JulienB|JulienB]] 17:48, 25 November 2010 (UTC)&lt;br /&gt;
* 337b-armadeus-mx2fb-add_backlight_power_switch_capability.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt; 338-denx-mxcgpio-emulates_interrupt_on_both_edges.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 19:33, 24 November 2010 (UTC)&lt;br /&gt;
* 339-apf27-armadeus-add_platform_data_init_support_to_spidev.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 19:05, 25 November 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
===340 -&amp;gt; 349===&lt;br /&gt;
* 340-apf27-martin-keypad-add_driver_for_mx2.patch&lt;br /&gt;
** another driver seems to have been integrated in mainline... To check&lt;br /&gt;
* 341-apf27-armadeus-serial-add_uart_modules_selection_in_kconfig.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:30, 26 November 2010 (UTC)&lt;br /&gt;
* 342-apf27-armadeus-serial-some_uart_pins_are_not_available_on_apf27_based_designs.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:35, 26 November 2010 (UTC)&lt;br /&gt;
* 343-apf27-amoled-hx5116.patch&lt;br /&gt;
* 345-apf27-armadeus-iomux-display_gpio_number_when_reservation_fails.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:43, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 346-smsc-lan95xx-activates_led_outputs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 347b-smsc-lan95xx-add_additionnal_USB_products_IDs.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* 347c-armadeus-lan95xx-activate_blinking_leds.patch&lt;br /&gt;
** &#039;&#039;&#039;OK&#039;&#039;&#039; - [[User:JulienB|JulienB]] 09:58, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt; 347-smsc-lan95xx-removes_eeprom_loaded_check.patch &amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 09:48, 26 November 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;348-armadeus-plat-mxc-gpio.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** integrated in mainline - [[User:JulienB|JulienB]] 08:04, 7 February 2011 (UTC)&lt;br /&gt;
* 349-armadeus-spi-backport_2.6.32.2.patch&lt;br /&gt;
&lt;br /&gt;
===350 -&amp;gt; ...===&lt;br /&gt;
* 350-armadeus-spi-improve_spi_gpio_for_single_data_pin.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;351-armadeus-spi_imx-update_for_2.6.32_compatibility.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 352-armadeus-time-fix_timekeeping_resume.patch&lt;br /&gt;
** to check&lt;br /&gt;
* &amp;lt;strike&amp;gt;355a-denx-fsl_udc-Add_iMX3x_support_to_the_fsl_usb2_udc_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355b-montavista-fsl_udc_core-fix_kernel_oops_on_module_removal.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355c-armadeus-mx2-devices-add_usb_device.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;355d-armadeus-fsl_udc-add_platform_init_support.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 355e-armadeus-fsl_udc-reset_temporary_fix.patch&lt;br /&gt;
** to check...&lt;br /&gt;
* 356-armadeus-soc_camera-add_ov7670_sensor_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;357-armadeus-mx27camera-add_CSICR1_REDGE_handling.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 358-armadeus-imx-adding_mangling_capability_on_i2c_imx_driver.patch&lt;br /&gt;
** &amp;lt;span style=&amp;quot;color:green&amp;quot;&amp;gt;&#039;&#039;&#039;OK&#039;&#039;&#039;&amp;lt;/span&amp;gt; [[User:FabienM|FabienM]] 11:17, 13 December 2010 (UTC)&lt;br /&gt;
* &amp;lt;strike&amp;gt;359-armadeus-joystick-adding_as5011_joystick_driver.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** Under 2.6.38 kernel now.[[User:FabienM|FabienM]] 14:37, 28 January 2011 (UTC) &lt;br /&gt;
* 361-armadeus-soc_camera-add_ov3640_sensor_driver.patch&lt;br /&gt;
* 362-apf27-armadeus-fec-old_ifconfig_up_down_fix.patch&lt;br /&gt;
** patch is obsolete as we now use fec and not fec_old, but problem seems still to be here on fec&lt;br /&gt;
* 363-armadeus-ADC-Adding_AS1531_adc_driver.patch&lt;br /&gt;
* &amp;lt;strike&amp;gt;364-armadeus-add_usb3315_registers_definition_in_ulpi_h.patch&amp;lt;/strike&amp;gt;&lt;br /&gt;
** no more needed -- [[User:JulienB|JulienB]] 16:50, 7 February 2011 (UTC)&lt;br /&gt;
* 365-pps-armadeus-add_pps_baseboard.patch&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10783</id>
		<title>Qt Creator</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10783"/>
		<updated>2012-03-26T13:28:35Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* SSH DSA keys */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will explain how to automatically install and configure Qt Creator for Armadeus boards.&lt;br /&gt;
It will also describe the way to use GDB in Qt Creator for remote applications.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Buildroot ===&lt;br /&gt;
&lt;br /&gt;
* Qt Creator is now fully integrated in Armadeus Buildroot. To install it, go in your project&#039;s BSP directory and use the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [ ]   GDB for QtCreator  ---&amp;gt;   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to use GDB in QtCreator for remote applications:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [*]   GDB for QtCreator  ---&amp;gt;&lt;br /&gt;
          --- GDB for QtCreator&lt;br /&gt;
          (192.168.0.208) GDB server IP address&lt;br /&gt;
          (5600) GDB server port&lt;br /&gt;
          (/srv/developpements/armadeus_4-1/processManager/bin/processManager) Local executable&lt;br /&gt;
          (/usr/bin/processManager) Remote executable path on system&lt;br /&gt;
          (-qws) Remote executable arguments&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;GDB server IP address&#039;&#039;, the &#039;&#039;GDB server port&#039;&#039;, the &#039;&#039;Local executable&#039;&#039; and the &#039;&#039;Remote executable path on system&#039;&#039; must be filled.&lt;br /&gt;
The &#039;&#039;Remote executable arguments&#039;&#039; are facultatives.&lt;br /&gt;
&lt;br /&gt;
* Then you can build Qt Creator:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual configuration ===&lt;br /&gt;
&lt;br /&gt;
* The QtCreator&#039;s configuration files are automatically generated in &#039;&#039;buildroot/output/host/etc/Nokia&#039;&#039;: &#039;&#039;&#039;QtCreator.ini&#039;&#039;&#039; and &#039;&#039;&#039;toolChains.xml&#039;&#039;&#039;.&lt;br /&gt;
** Qt Embedded and g++ toolchain for ARM are automatically entered in Qt Creator&#039;s configuration.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GDB server script&#039;&#039;&#039; can be manually modified. Is is located in &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;br /&gt;
This script transfers the executable to debug to the remote system and launch the remote &#039;&#039;&#039;GDB server&#039;&#039;&#039;.&lt;br /&gt;
The following variables can be changed according to the user needs: &#039;&#039;IP_ADDR&#039;&#039;, &#039;&#039;EXEC_ARGUMENTS&#039;&#039;, &#039;&#039;PRIVATE_KEY_PATH&#039;&#039;, &#039;&#039;LOCAL_EXEC_PATH&#039;&#039;, &#039;&#039;REMOTE_EXEC_PATH&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
* QtCreator&#039;s binary is located in &#039;&#039;buildroot/output/host/usr/bin/qtcreator&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Qt and toolchains can be respectively configured in the menu &#039;&#039;Tools --&amp;gt; Options --&amp;gt; Qt4 / Tool Chains&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Remote debugger ===&lt;br /&gt;
&lt;br /&gt;
When in Qt Creator, go in the menu &#039;&#039;Debug --&amp;gt; Start Debugging --&amp;gt; Start and Attach to Remote Application&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Remote_gdb_qtcreator.png‎|center|frame|Qt Creator remote GDB&#039;s configuration and start screen]]&lt;br /&gt;
&lt;br /&gt;
* You can manually configurate GDB by modifying values in configuration screen:&lt;br /&gt;
** The &#039;&#039;&#039;Debugger&#039;&#039;&#039; path is automatically entered by Buildroot. It must be a GDB compiled to debug on ARM platforms.&lt;br /&gt;
** The &#039;&#039;&#039;Local executable&#039;&#039;&#039; must be compiled against Qt Embedded for ARM and will be used by the host GDB and transfered to the remote system for GDB server.&lt;br /&gt;
** The &#039;&#039;&#039;Sysroot&#039;&#039;&#039; is the remote system root path in host. GDB needs it to have access to all system headers and libraries.&lt;br /&gt;
&lt;br /&gt;
* When you click on &#039;&#039;&#039;OK&#039;&#039;&#039;, the GDB server and host start and you can debug the remote application.&lt;br /&gt;
&lt;br /&gt;
=== SSH DSA keys ===&lt;br /&gt;
* SSH is used to transfer the file to debug to the remote system and to launch the remote GDB server.&lt;br /&gt;
* If you choose to use GDB with Qt Creator in Buildroot, DSA keys will be automatically generated for SSH on your host PC and installed in the remote system rootfs.&lt;br /&gt;
* The host public and private keys are installed in &#039;&#039;buildroot/output/host/etc/ssh/&#039;&#039;&lt;br /&gt;
* You can also generate your own keys and use them to debug the remote application but then you have to:&lt;br /&gt;
** Put the public key in the remote system rootfs&#039; authorized-keys file: &#039;&#039;buildroot/output/target/root/.ssh/authorized_keys&#039;&#039;.&lt;br /&gt;
** Change the &#039;&#039;&#039;PRIVATE_KEY_PATH&#039;&#039;&#039; variable in &#039;&#039;&#039;gdb_server_script&#039;&#039;&#039;: &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* The remote system must be registered as a &#039;&#039;&#039;known host&#039;&#039;&#039; in your host PC.&lt;br /&gt;
** Try to connect to the system before debugging for the first time:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  $ ssh root@REMOTE_IP&lt;br /&gt;
&lt;br /&gt;
  The authenticity of host &#039;192.168.0.208 (192.168.0.208)&#039; can&#039;t be established.&lt;br /&gt;
  ECDSA key fingerprint is e0:20:a4:60:63:33:b8:4f:c2:9c:1a:1c:52:d2:4d:f7.&lt;br /&gt;
  Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
&lt;br /&gt;
  $ yes&lt;br /&gt;
&lt;br /&gt;
  Warning: Permanently added &#039;192.168.0.208&#039; (ECDSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** If the system is already registered and you reflash the rootfs, you must reset the known hosts, then reconnect:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  $ ssh-keygen -f &amp;quot;~/.ssh/known_hosts&amp;quot; -R REMOTE_IP&lt;br /&gt;
&lt;br /&gt;
  Original contents retained as ~/.ssh/known_hosts.old&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10782</id>
		<title>Qt Creator</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10782"/>
		<updated>2012-03-22T09:34:07Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: QtCreator Remote debugger and SSH keys&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will explain how to automatically install and configure Qt Creator for Armadeus boards.&lt;br /&gt;
It will also describe the way to use GDB in Qt Creator for remote applications.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Buildroot ===&lt;br /&gt;
&lt;br /&gt;
* Qt Creator is now fully integrated in Armadeus Buildroot. To install it, go in your project&#039;s BSP directory and use the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [ ]   GDB for QtCreator  ---&amp;gt;   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to use GDB in QtCreator for remote applications:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [*]   GDB for QtCreator  ---&amp;gt;&lt;br /&gt;
          --- GDB for QtCreator&lt;br /&gt;
          (192.168.0.208) GDB server IP address&lt;br /&gt;
          (5600) GDB server port&lt;br /&gt;
          (/srv/developpements/armadeus_4-1/processManager/bin/processManager) Local executable&lt;br /&gt;
          (/usr/bin/processManager) Remote executable path on system&lt;br /&gt;
          (-qws) Remote executable arguments&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;GDB server IP address&#039;&#039;, the &#039;&#039;GDB server port&#039;&#039;, the &#039;&#039;Local executable&#039;&#039; and the &#039;&#039;Remote executable path on system&#039;&#039; must be filled.&lt;br /&gt;
The &#039;&#039;Remote executable arguments&#039;&#039; are facultatives.&lt;br /&gt;
&lt;br /&gt;
* Then you can build Qt Creator:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual configuration ===&lt;br /&gt;
&lt;br /&gt;
* The QtCreator&#039;s configuration files are automatically generated in &#039;&#039;buildroot/output/host/etc/Nokia&#039;&#039;: &#039;&#039;&#039;QtCreator.ini&#039;&#039;&#039; and &#039;&#039;&#039;toolChains.xml&#039;&#039;&#039;.&lt;br /&gt;
** Qt Embedded and g++ toolchain for ARM are automatically entered in Qt Creator&#039;s configuration.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GDB server script&#039;&#039;&#039; can be manually modified. Is is located in &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;br /&gt;
This script transfers the executable to debug to the remote system and launch the remote &#039;&#039;&#039;GDB server&#039;&#039;&#039;.&lt;br /&gt;
The following variables can be changed according to the user needs: &#039;&#039;IP_ADDR&#039;&#039;, &#039;&#039;EXEC_ARGUMENTS&#039;&#039;, &#039;&#039;PRIVATE_KEY_PATH&#039;&#039;, &#039;&#039;LOCAL_EXEC_PATH&#039;&#039;, &#039;&#039;REMOTE_EXEC_PATH&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
* QtCreator&#039;s binary is located in &#039;&#039;buildroot/output/host/usr/bin/qtcreator&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Qt and toolchains can be respectively configured in the menu &#039;&#039;Tools --&amp;gt; Options --&amp;gt; Qt4 / Tool Chains&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Remote debugger ===&lt;br /&gt;
&lt;br /&gt;
When in Qt Creator, go in the menu &#039;&#039;Debug --&amp;gt; Start Debugging --&amp;gt; Start and Attach to Remote Application&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Remote_gdb_qtcreator.png‎|center|frame|Qt Creator remote GDB&#039;s configuration and start screen]]&lt;br /&gt;
&lt;br /&gt;
* You can manually configurate GDB by modifying values in configuration screen:&lt;br /&gt;
** The &#039;&#039;&#039;Debugger&#039;&#039;&#039; path is automatically entered by Buildroot. It must be a GDB compiled to debug on ARM platforms.&lt;br /&gt;
** The &#039;&#039;&#039;Local executable&#039;&#039;&#039; must be compiled against Qt Embedded for ARM and will be used by the host GDB and transfered to the remote system for GDB server.&lt;br /&gt;
** The &#039;&#039;&#039;Sysroot&#039;&#039;&#039; is the remote system root path in host. GDB needs it to have access to all system headers and libraries.&lt;br /&gt;
&lt;br /&gt;
* When you click on &#039;&#039;&#039;OK&#039;&#039;&#039;, the GDB server and host start and you can debug the remote application.&lt;br /&gt;
&lt;br /&gt;
=== SSH DSA keys ===&lt;br /&gt;
* SSH is used to transfer the file to debug to the remote system and to launch the remote GDB server.&lt;br /&gt;
* If you choose to use GDB with Qt Creator in Buildroot, DSA keys will be automatically generated for SSH on your host PC and installed in the remote system rootfs.&lt;br /&gt;
* The host public and private keys are installed in &#039;&#039;buildroot/output/host/etc/ssh/&#039;&#039;&lt;br /&gt;
* You can also generate your own keys and use them to debug the remote application but then you have to:&lt;br /&gt;
** Put the public key in the remote system rootfs&#039; authorized-keys file: &#039;&#039;buildroot/output/target/root/.ssh/authorized_keys&#039;&#039;.&lt;br /&gt;
** Change the &#039;&#039;&#039;PRIVATE_KEY_PATH&#039;&#039;&#039; variable in &#039;&#039;&#039;gdb_server_script&#039;&#039;&#039;: &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=File:Remote_gdb_qtcreator.png&amp;diff=10781</id>
		<title>File:Remote gdb qtcreator.png</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=File:Remote_gdb_qtcreator.png&amp;diff=10781"/>
		<updated>2012-03-22T09:06:43Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Qt Creator remote GDB&amp;#039;s configuration and start screen.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Qt Creator remote GDB&#039;s configuration and start screen.&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10777</id>
		<title>Qt Creator</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10777"/>
		<updated>2012-03-21T17:17:29Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Manual configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will explain how to automatically install and configure Qt Creator for Armadeus boards.&lt;br /&gt;
It will also describe the way to use GDB in Qt Creator for remote applications.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Buildroot ===&lt;br /&gt;
&lt;br /&gt;
* Qt Creator is now fully integrated in Armadeus Buildroot. To install it, go in your project&#039;s BSP directory and use the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [ ]   GDB for QtCreator  ---&amp;gt;   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to use GDB in QtCreator for remote applications:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [*]   GDB for QtCreator  ---&amp;gt;&lt;br /&gt;
          --- GDB for QtCreator&lt;br /&gt;
          (192.168.0.208) GDB server IP address&lt;br /&gt;
          (5600) GDB server port&lt;br /&gt;
          (/srv/developpements/armadeus_4-1/processManager/bin/processManager) Local executable&lt;br /&gt;
          (/usr/bin/processManager) Remote executable path on system&lt;br /&gt;
          (-qws) Remote executable arguments&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;GDB server IP address&#039;&#039;, the &#039;&#039;GDB server port&#039;&#039;, the &#039;&#039;Local executable&#039;&#039; and the &#039;&#039;Remote executable path on system&#039;&#039; must be filled.&lt;br /&gt;
The &#039;&#039;Remote executable arguments&#039;&#039; are facultatives.&lt;br /&gt;
&lt;br /&gt;
* Then you can build Qt Creator:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual configuration ===&lt;br /&gt;
&lt;br /&gt;
* The QtCreator&#039;s configuration files are automatically generated in &#039;&#039;buildroot/output/host/etc/Nokia&#039;&#039;: &#039;&#039;&#039;QtCreator.ini&#039;&#039;&#039; and &#039;&#039;&#039;toolChains.xml&#039;&#039;&#039;.&lt;br /&gt;
** Qt Embedded and g++ toolchain for ARM are automatically entered in Qt Creator&#039;s configuration.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GDB server script&#039;&#039;&#039; can be manually modified. Is is located in &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;br /&gt;
This script transfers the executable to debug to the remote system and launch the remote &#039;&#039;&#039;GDB server&#039;&#039;&#039;.&lt;br /&gt;
The following variables can be changed according to the user needs: &#039;&#039;IP_ADDR&#039;&#039;, &#039;&#039;EXEC_ARGUMENTS&#039;&#039;, &#039;&#039;PRIVATE_KEY_PATH&#039;&#039;, &#039;&#039;LOCAL_EXEC_PATH&#039;&#039;, &#039;&#039;REMOTE_EXEC_PATH&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
* QtCreator&#039;s binary is located in &#039;&#039;buildroot/output/host/usr/bin/qtcreator&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Qt and toolchains can be respectively configured in the menu &#039;&#039;Tools --&amp;gt; Options --&amp;gt; Qt4 / Tool Chains&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Remote debugger ===&lt;br /&gt;
&lt;br /&gt;
When in Qt Creator, go in the menu &#039;&#039;Debug --&amp;gt; Start Debugging --&amp;gt; Start and Attach to Remote Application&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10776</id>
		<title>Qt Creator</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt_Creator&amp;diff=10776"/>
		<updated>2012-03-21T17:16:42Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Qt Creator&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will explain how to automatically install and configure Qt Creator for Armadeus boards.&lt;br /&gt;
It will also describe the way to use GDB in Qt Creator for remote applications.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Buildroot ===&lt;br /&gt;
&lt;br /&gt;
* Qt Creator is now fully integrated in Armadeus Buildroot. To install it, go in your project&#039;s BSP directory and use the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
  [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [ ]   GDB for QtCreator  ---&amp;gt;   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you want to use GDB in QtCreator for remote applications:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Host utilities  ---&amp;gt;&lt;br /&gt;
  [*] host qtcreator  ---&amp;gt;&lt;br /&gt;
      --- host qtcreator&lt;br /&gt;
      [*]   GDB for QtCreator  ---&amp;gt;&lt;br /&gt;
          --- GDB for QtCreator&lt;br /&gt;
          (192.168.0.208) GDB server IP address&lt;br /&gt;
          (5600) GDB server port&lt;br /&gt;
          (/srv/developpements/armadeus_4-1/processManager/bin/processManager) Local executable&lt;br /&gt;
          (/usr/bin/processManager) Remote executable path on system&lt;br /&gt;
          (-qws) Remote executable arguments&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;GDB server IP address&#039;&#039;, the &#039;&#039;GDB server port&#039;&#039;, the &#039;&#039;Local executable&#039;&#039; and the &#039;&#039;Remote executable path on system&#039;&#039; must be filled.&lt;br /&gt;
The &#039;&#039;Remote executable arguments&#039;&#039; are facultatives.&lt;br /&gt;
&lt;br /&gt;
* Then you can build Qt Creator:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual configuration ===&lt;br /&gt;
&lt;br /&gt;
* The QtCreator&#039;s configuration files are automatically generated in &#039;&#039;buildroot/output/host/etc/Nokia&#039;&#039;: &#039;&#039;&#039;QtCreator.ini&#039;&#039;&#039; and &#039;&#039;&#039;toolChains.xml&#039;&#039;&#039;.&lt;br /&gt;
** Qt Embedded and g++ toolchain for ARM are automatically entered in Qt Creator&#039;s configuration.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;GDB server script&#039;&#039;&#039; can be manually modified. Is is located in &#039;&#039;buildroot/output/host/etc/Nokia/gdb_server_script&#039;&#039;.&lt;br /&gt;
This script transfers the executable to debug to the remote system and launch the remote &#039;&#039;&#039;GDB server&#039;&#039;&#039;.&lt;br /&gt;
The following variables can be changed according to the user needs: &#039;&#039;&#039;IP_ADDR&#039;&#039;&#039;, &#039;&#039;&#039;EXEC_ARGUMENTS&#039;&#039;&#039;, &#039;&#039;&#039;PRIVATE_KEY_PATH&#039;&#039;&#039;, &#039;&#039;&#039;LOCAL_EXEC_PATH&#039;&#039;&#039;, &#039;&#039;&#039;REMOTE_EXEC_PATH&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
* QtCreator&#039;s binary is located in &#039;&#039;buildroot/output/host/usr/bin/qtcreator&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Qt and toolchains can be respectively configured in the menu &#039;&#039;Tools --&amp;gt; Options --&amp;gt; Qt4 / Tool Chains&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Remote debugger ===&lt;br /&gt;
&lt;br /&gt;
When in Qt Creator, go in the menu &#039;&#039;Debug --&amp;gt; Start Debugging --&amp;gt; Start and Attach to Remote Application&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=10593</id>
		<title>Qt/Embedded</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Qt/Embedded&amp;diff=10593"/>
		<updated>2012-02-01T16:49:10Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Keyboard handling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions to install and use QtEmbedded &amp;amp; Qt virtual frame buffer for Armadeus&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).&lt;br /&gt;
&lt;br /&gt;
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.&lt;br /&gt;
&lt;br /&gt;
{{Note| We recommand at least 32 MBytes of RAM if you plan to design and run Qt based GUIs.}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept [[QtEmbedded Installation|here]]). So to install it you have to:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  [*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        [ ]   Compile with debug support&lt;br /&gt;
              Library type (Shared library)  ---&amp;gt;&lt;br /&gt;
        [*]   Approve free license&lt;br /&gt;
        [ ]   Compatibility with Qt3&lt;br /&gt;
        [*]   Gui Module&lt;br /&gt;
                Pixel depths  ---&amp;gt;&lt;br /&gt;
                Fonts  ---&amp;gt;&lt;br /&gt;
                freetype2 support (no freetype2 support)  ---&amp;gt;&lt;br /&gt;
        [*]     Enable GIF support&lt;br /&gt;
        [ ]     Enable libmng support&lt;br /&gt;
                JPEG support (System libjpeg)  ---&amp;gt;&lt;br /&gt;
                PNG support (No PNG support)  ---&amp;gt;&lt;br /&gt;
                TIFF support (No TIFF support)  ---&amp;gt;&lt;br /&gt;
              zlib support (Qt zlib)  ---&amp;gt;&lt;br /&gt;
        (arm) The embedded platform we are making Qt for&lt;br /&gt;
        [ ]   SQL Module  ---&amp;gt; &lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        [ ]   Phonon Module&lt;br /&gt;
        [*]   XML Module &lt;br /&gt;
        [ ]     XML Patterns Module&lt;br /&gt;
        [ ]   SVG Module&lt;br /&gt;
        -*-   Network Module&lt;br /&gt;
        [ ]     WebKit Module&lt;br /&gt;
        [ ]   STL support&lt;br /&gt;
        [ ]   Enable OpenSSL support&lt;br /&gt;
        [*]   Script Module&lt;br /&gt;
        [ ]     Script Tools Module&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(don&#039;t forget Pixel depths submenu options (at least 8 and 16))&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*If you want touchscreen support:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
    Mouse drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] tslib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
then:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.&lt;br /&gt;
&lt;br /&gt;
==Touchscreen handling==&lt;br /&gt;
* Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)&lt;br /&gt;
* Then, before launching Qt app, do&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX         (replace XX with the right number)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Keyboard handling==&lt;br /&gt;
&lt;br /&gt;
===USB Keyboard===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB keyboard driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-kbd-linuxinput&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB keyboard option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
                  [ ] tty&lt;br /&gt;
                  [*] linux input&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB keyboard, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the keyboard drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [*]   Keyboards  ---&amp;gt;&lt;br /&gt;
            --- Keyboards&lt;br /&gt;
            &amp;lt;*&amp;gt;     AT keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Sun Type 4 and Type 5 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     DECstation/VAXstation LK201/LK401 keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     XT keyboard&lt;br /&gt;
            &amp;lt;M&amp;gt;     Freescale MXC/IMX keypad support&lt;br /&gt;
            &amp;lt; &amp;gt;     Newton keyboard&lt;br /&gt;
            &amp;lt; &amp;gt;     Stowaway keyboard &lt;br /&gt;
            &amp;lt; &amp;gt;     GPIO Button&lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
        ...&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB keyboard to the system, a device is created in &#039;&#039;&#039;/dev/ttyX&#039;&#039;&#039;.&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_KEYBOARD=&amp;quot;LinuxInput:/dev/ttyX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB keyboard with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided here: [http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-charinput.html]&lt;br /&gt;
&lt;br /&gt;
==Mouse handling==&lt;br /&gt;
&lt;br /&gt;
===USB Mouse===&lt;br /&gt;
&lt;br /&gt;
====Qt configuration====&lt;br /&gt;
&lt;br /&gt;
*If you manually build Qt, you have to add the USB mouse driver option in the configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ configure -qt-mouse-pc .......&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*If you let Buildroot build Qt, select the USB mouse option in the configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Graphic libraries and applications (graphic/text)  ---&amp;gt;&lt;br /&gt;
    *** other GUIs ***&lt;br /&gt;
    [*]   Qt  ---&amp;gt;&lt;br /&gt;
        --- Qt&lt;br /&gt;
        ...&lt;br /&gt;
              Graphics drivers  ---&amp;gt;&lt;br /&gt;
              Mouse drivers  ---&amp;gt;&lt;br /&gt;
                  [*] pc&lt;br /&gt;
                  [ ] bus&lt;br /&gt;
                  [ ] linuxtp&lt;br /&gt;
                  [ ] yopy&lt;br /&gt;
                  [ ] vr41xx&lt;br /&gt;
                  [ ] tslib&lt;br /&gt;
                  [ ] qvfb&lt;br /&gt;
              Keyboard drivers  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then build &amp;amp; install Qt or let Buildroot build.&lt;br /&gt;
&lt;br /&gt;
====Linux configuration====&lt;br /&gt;
&lt;br /&gt;
To use USB mouse, there are some drivers to install in Linux.&lt;br /&gt;
&lt;br /&gt;
*First open the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Select the Mouse interface and PS/2 Mouse drivers in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    ...&lt;br /&gt;
    Input device support  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
              *** Userland interfaces ***&lt;br /&gt;
        &amp;lt;*&amp;gt;   Mouse interface &lt;br /&gt;
        [*]     Provide legacy /dev/psaux device&lt;br /&gt;
        (1024)  Horizontal screen resolution&lt;br /&gt;
        (768)   Vertical screen resolution&lt;br /&gt;
        ...&lt;br /&gt;
              *** Input Device Drivers ***&lt;br /&gt;
        [ ]   Keyboards  ---&amp;gt; &lt;br /&gt;
        [*]   Mice  ---&amp;gt; &lt;br /&gt;
            --- Mice&lt;br /&gt;
            &amp;lt;M&amp;gt;   PS/2 mouse&lt;br /&gt;
            [*]     ALPS PS/2 mouse protocol extension&lt;br /&gt;
            [*]     Logitech PS/2++ mouse protocol extension&lt;br /&gt;
            [*]     Synaptics PS/2 mouse protocol extension&lt;br /&gt;
            [*]     IBM Trackpoint PS/2 mouse protocol extension&lt;br /&gt;
            [ ]     Elantech PS/2 protocol extension&lt;br /&gt;
            [ ]     eGalax TouchKit PS/2 protocol extension &lt;br /&gt;
            ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Then clean your Linux installation and rebuild it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
[armadeus]$ make linux26-clean&lt;br /&gt;
[armadeus]$ make linux26&lt;br /&gt;
[armadeus]$ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Embedded system configuration====&lt;br /&gt;
&lt;br /&gt;
* First flash your new kernel and rootfs and boot the system.&lt;br /&gt;
* When you connect the USB mouse to the system, a device is created in &#039;&#039;&#039;/dev/input/mouseXX&#039;&#039;&#039;. The touchscreen devices are also created as &#039;&#039;&#039;/dev/input/eventXX&#039;&#039;&#039;.&lt;br /&gt;
* To know which device is the USB mouse one, you have to check in:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cat /sys/class/input/mouseXX/device/name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Then you can tell Qt which driver to connect to the device to make it work:&lt;br /&gt;
**If you want the USB mouse only:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| For a dynamic detection of an USB mouse, you can use the automatic driver like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/eventXX Auto&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then you can launch an application and use your USB mouse with it.&lt;br /&gt;
&lt;br /&gt;
More infos are provided  here: [http://doc.qt.nokia.com/4.6/qt-embedded-pointer.html]&lt;br /&gt;
&lt;br /&gt;
==Test==&lt;br /&gt;
If you want to test it, compile and put some examples in your TFTP directory:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make shell_env&lt;br /&gt;
$ source armadeus_env.sh&lt;br /&gt;
$ cd $ARMADEUS_QT_DIR/examples/widgets/&lt;br /&gt;
$ $ARMADEUS_QT_DIR/bin/qmake widgets.pro&lt;br /&gt;
$ make&lt;br /&gt;
...&lt;br /&gt;
$ cp digitalclock/digitalclock /tftpboot&lt;br /&gt;
$ cp calculator/calculator /tftpboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and then launch it on your APF (supposed you have a running &amp;amp; calibrated touchscreen):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# cd /usr/bin/&lt;br /&gt;
# tftp -g -r calculator 192.168.0.xx (Host IP)&lt;br /&gt;
# chmod a+x calculator&lt;br /&gt;
# export QWS_MOUSE_PROTO=&amp;quot;Tslib:/dev/input/event0&amp;quot;&lt;br /&gt;
# &lt;br /&gt;
# ./calculator -qws&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Demo==&lt;br /&gt;
A client/server (with GUI) demo is available under: &#039;&#039;software/demos/ApfDacClientServer/&#039;&#039;. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in &#039;&#039;src/build.sh&#039;&#039; depending on your Host Qt installation).&lt;br /&gt;
&lt;br /&gt;
[[Image:qtdemo.png|center|frame|GUI with widgets taken from http://www.qt-apps.org]]&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.&lt;br /&gt;
&lt;br /&gt;
== How to cross-compile an application using Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is to define a specific &amp;quot;&#039;&#039;&#039;qmake&#039;&#039;&#039; specs directory&amp;quot; for armadeus. Here for example:&lt;br /&gt;
&lt;br /&gt;
 $ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
and install the two following files into this new directory:  [http://www.armadeus.com/assos_downloads/qt/qmake.conf qmake.conf] &amp;amp; [http://www.armadeus.com/assos_downloads/qt/qplatformdefs.h qplatformdefs.h]. &#039;&#039;&#039;qmake.conf&#039;&#039;&#039; may be customized if necessary. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, you must define two typical environment variables : &lt;br /&gt;
&#039;&#039;&#039;QTDIR&#039;&#039;&#039; which defines the Qt installation path &lt;br /&gt;
&amp;amp; &#039;&#039;&#039;QMAKESPEC&#039;&#039;&#039; which defines the path to the configuration files of the &#039;&#039;&#039;qmake&#039;&#039;&#039; tool &lt;br /&gt;
&lt;br /&gt;
Here two typical lines of a Qtopia application building script&lt;br /&gt;
&lt;br /&gt;
 $ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3&lt;br /&gt;
 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++&lt;br /&gt;
&lt;br /&gt;
Adapt the &#039;&#039;&#039;QTDIR&#039;&#039;&#039; path to your own installation path and compile your code now, using theses commands:&lt;br /&gt;
&lt;br /&gt;
 # build the makefile with the &#039;&#039;&#039;qmake&#039;&#039;&#039; command (See Trolltech documentation for details about &#039;&#039;&#039;qmake&#039;&#039;&#039;):&lt;br /&gt;
 $QTDIR/bin/qmake -spec my.pro&lt;br /&gt;
 # and now compile the beast... :&lt;br /&gt;
 $ make&lt;br /&gt;
&lt;br /&gt;
Good luck....&lt;br /&gt;
&lt;br /&gt;
== Phonon installation with Qt Embedded ==&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
In order to use Phonon with Qt, first you need to install some other libraries.&lt;br /&gt;
You may even need to cross-compile them, depending on the platform you want to run Qt on.&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
*You only have to install GStreamer and some plugins with the following command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer0.10-dev&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-0&lt;br /&gt;
$ sudo apt-get install libgstreamer-plugins-base0.10-dev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note | These packages are available for Linux Ubuntu ; but for other distributions, the names may vary.}}&lt;br /&gt;
&lt;br /&gt;
*To use some audio, image or video format like mp3, mpeg2, png or ogg:&lt;br /&gt;
**First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)&lt;br /&gt;
**Then you can install these gstreamer plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-good&lt;br /&gt;
$ sudo apt-get install gstreamer0.10-plugins-ugly&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There also are other plugin packages which you can find the list at :&lt;br /&gt;
[http://gstreamer.freedesktop.org/documentation/ GStreamer]&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
If you want to build Qt with Phonon for embedded platform, you&#039;ll need to cross-compile the following libraries for the same platform:&lt;br /&gt;
*libxml2 &amp;gt;= 2.7.7&lt;br /&gt;
*libcheck &amp;gt;= 0.9.8&lt;br /&gt;
*liboil &amp;gt;= 0.3.2&lt;br /&gt;
*gstreamer &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-base &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
There are some required libraries that you can compile and install with Buildroot:&lt;br /&gt;
*glib &amp;gt;= 2.16&lt;br /&gt;
*Optional:&lt;br /&gt;
**libpng&lt;br /&gt;
**tiff&lt;br /&gt;
**jpeg&lt;br /&gt;
**...&lt;br /&gt;
&lt;br /&gt;
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer&#039;s plugins :&lt;br /&gt;
*gst-plugins-good &amp;gt;= 0.10.0&lt;br /&gt;
*gst-plugins-ugly &amp;gt;= 0.10.0&lt;br /&gt;
&lt;br /&gt;
=== Cross-compiling libraries ===&lt;br /&gt;
*First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries&#039; pkgconfig files.&lt;br /&gt;
&lt;br /&gt;
*To see what environment variable you can modify to impact the library cross-compiling, enter the command :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --help&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then create a file to define all required environment variables for the cross-compiling. &lt;br /&gt;
For instance for glib2:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
$ export CC=arm-linux-gcc&lt;br /&gt;
$ export CXX=arm-linux-g++&lt;br /&gt;
$ export CFLAGS=&amp;quot;-I/usr/local/libxml2/include/libxml2&amp;quot;&lt;br /&gt;
$ export LDFLAGS=-L/usr/local/libxml2/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And then, to create your environment, type :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ source ENVIRONMENT_FILE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Finally you can configure your library like this:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then build and install the library.&lt;br /&gt;
&lt;br /&gt;
=== Build Qt ===&lt;br /&gt;
&lt;br /&gt;
==== For x86 platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s x86 libraries and headers.&lt;br /&gt;
&lt;br /&gt;
All you need to do then is to configure Qt with the phonon option and its backend :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then build and install Qt and you will be able to use Phonon on your x86 platform.&lt;br /&gt;
&lt;br /&gt;
==== For embedded platform ====&lt;br /&gt;
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer&#039;s and glib&#039;s embedded libraries and headers.&lt;br /&gt;
&lt;br /&gt;
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note | You may need to give the cross-compiler the paths toward gstreamer&#039;s and glib&#039;s libraries and headers as configuration options.}}&lt;br /&gt;
&lt;br /&gt;
=== Possible problems encountered ===&lt;br /&gt;
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Impossible constraint in &#039;asm&#039;&#039;&#039;:&lt;br /&gt;
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;Cannot run test program&#039;&#039;:&lt;br /&gt;
Your best shot is to look in configure.ac (or configure.in) and see if&lt;br /&gt;
there&#039;s a &amp;quot;cache variable&amp;quot; for that test. If so, you can set that&lt;br /&gt;
variable in your environment, to the expected answer for your target,&lt;br /&gt;
before running configure, and it should bypass the actual test.&lt;br /&gt;
If there&#039;s no cache variable, you&#039;ll need to modify configure.ac (or&lt;br /&gt;
configure.in) to set the variable manually, and rebuild configure.&lt;br /&gt;
&lt;br /&gt;
*Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.&lt;br /&gt;
&lt;br /&gt;
*When installing libraries : &#039;&#039;arm-linux-g++: command not found&#039;&#039;&lt;br /&gt;
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.&lt;br /&gt;
&lt;br /&gt;
*In gst-plugins-base, delete manually the compilation of &#039;&#039;icles&#039;&#039; in the file tests/Makefile. The lines to delete are l.377 and l.382.&lt;br /&gt;
&lt;br /&gt;
== Work in progress / to do list ==&lt;br /&gt;
&lt;br /&gt;
* Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.&lt;br /&gt;
&lt;br /&gt;
==Licenses==&lt;br /&gt;
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
* [[PyQt]]&lt;br /&gt;
* http://www.trolltech.com&lt;br /&gt;
* [http://lists.trolltech.com/qt-embedded-interest/2003-11/msg00007.html 16 colors framebuffer with Qt]&lt;br /&gt;
* [http://doc.trolltech.com/4.2/qtopiacore-envvars.html Qtopia Core Environment Variables]&lt;br /&gt;
* [http://thelins.se/learnqt/category/embedded-linux/ Tutorial on Qt setup for embedded devt]&lt;br /&gt;
&lt;br /&gt;
[[Category: Qt]]&lt;br /&gt;
[[Category: Software]]&lt;br /&gt;
[[Category: Graphical User Interface]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=10196</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=10196"/>
		<updated>2011-10-18T09:46:28Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Host PC (Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with password====&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with public/private key====&lt;br /&gt;
You can also connect to your system without needing a password.&lt;br /&gt;
You only have to let the system know your host&#039;s public SSH key.&lt;br /&gt;
&lt;br /&gt;
* First, in directory &#039;&#039;/root&#039;&#039;, on your system, if you don&#039;t have a directory &#039;&#039;.ssh&#039;&#039;, create it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # mkdir /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you must give it the correct rights:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # chmod 750 /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, if not already existing, create the file &#039;&#039;authorized_keys&#039;&#039; in &#039;&#039;/root/.ssh&#039;&#039;:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # touch /root/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Edit the file &#039;&#039;authorized_keys&#039;&#039; (with &#039;&#039;&#039;nano&#039;&#039;&#039; for instance) and copy-paste in it your host computer&#039;s public key contained in the file &#039;&#039;~/.ssh/id_dsa.pub&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* You can test your SSH connection by running the following command on your host PC (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh root@192.168.0.3&lt;br /&gt;
The authenticity of host &#039;192.168.0.10 (192.168.0.10)&#039; can&#039;t be established.&lt;br /&gt;
RSA key fingerprint is 7c:4b:e4:9c:6d:ea:6d:ca:ed:36:39:26:91:f9:82:30.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added &#039;192.168.0.10&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo apt-get install xinetd&lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
Port 32490&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The OpenSSH and OpenSSL packages must be selected in Buildroot (if not done by default).&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L $TARGET_PORT:localhost:$HOST_PORT -C $USERNAME@$HOSTNAME -p $VIRTUALPORT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=10195</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=10195"/>
		<updated>2011-10-18T08:42:51Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Host PC (Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with password====&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with public/private key====&lt;br /&gt;
You can also connect to your system without needing a password.&lt;br /&gt;
You only have to let the system know your host&#039;s public SSH key.&lt;br /&gt;
&lt;br /&gt;
* First, in directory &#039;&#039;/root&#039;&#039;, on your system, if you don&#039;t have a directory &#039;&#039;.ssh&#039;&#039;, create it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # mkdir /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you must give it the correct rights:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # chmod 750 /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, if not already existing, create the file &#039;&#039;authorized_keys&#039;&#039; in &#039;&#039;/root/.ssh&#039;&#039;:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # touch /root/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Edit the file &#039;&#039;authorized_keys&#039;&#039; (with &#039;&#039;&#039;nano&#039;&#039;&#039; for instance) and copy-paste in it your host computer&#039;s public key contained in the file &#039;&#039;~/.ssh/id_dsa.pub&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* You can test your SSH connection by running the following command on your host PC (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh root@192.168.0.3&lt;br /&gt;
The authenticity of host &#039;192.168.0.10 (192.168.0.10)&#039; can&#039;t be established.&lt;br /&gt;
RSA key fingerprint is 7c:4b:e4:9c:6d:ea:6d:ca:ed:36:39:26:91:f9:82:30.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added &#039;192.168.0.10&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
Port 32490&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The OpenSSH and OpenSSL packages must be selected in Buildroot (if not done by default).&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L $TARGET_PORT:localhost:$HOST_PORT -C $USERNAME@$HOSTNAME -p $VIRTUALPORT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=HMS_Demo&amp;diff=9658</id>
		<title>HMS Demo</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=HMS_Demo&amp;diff=9658"/>
		<updated>2011-05-11T13:48:39Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Software structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;HMS demo board is an electronic development board that demonstrates industrial capabilities of the APF27 ARMadeus board.&lt;br /&gt;
&lt;br /&gt;
This article will describe the structure of the board.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
== Hardware structure ==&lt;br /&gt;
&lt;br /&gt;
This board includes :&lt;br /&gt;
&lt;br /&gt;
* An Anybus&amp;lt;ref&amp;gt;Anybus is a registered trademark of HMS Industrial Networks AB, Sweden, USA, Germany and other countries.&amp;lt;/ref&amp;gt; CompactCom adaptator from [http://www.anybus.com/products/abcc.shtml HMS].&lt;br /&gt;
* 8 industrial inputs using SN65HVS882 chip&lt;br /&gt;
* 8 industrial outputs with simple shift register&lt;br /&gt;
* a LCD screen&lt;br /&gt;
* Voltage needles&lt;br /&gt;
* Light sensor&lt;br /&gt;
* Potentiometer button&lt;br /&gt;
* and all [[APF27Dev]] capabilities&lt;br /&gt;
&lt;br /&gt;
[[image:hmsdemohardstrct.png|center|600px|thumb|&#039;&#039;&#039;figure 1&#039;&#039;&#039; - &#039;&#039;Global hardware structure&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
== FPGA structure ==&lt;br /&gt;
&lt;br /&gt;
The structure of the FPGA is represented bellow. All modules are connected on i.MX wrapper with the wishbone bus (16 bits data), the intercon is used to decode addresses. &lt;br /&gt;
&lt;br /&gt;
[[image:fpga_struct.png|center|700px|thumb|&#039;&#039;&#039;figure 2&#039;&#039;&#039; - &#039;&#039;FPGA internal structure&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
Components are included in FPGA using [[POD]] to ease integration :&lt;br /&gt;
&lt;br /&gt;
* input : Read input value using a serial bus like SPI. This component can generate an interrupt on input change.&lt;br /&gt;
* output: Write output value using a serial bus like SPI.&lt;br /&gt;
* uart  : Anybus CompactCom can be driven using a simple uart TTL bus.&lt;br /&gt;
* hms_par: For more complex design, Anybus CompactCom can use a «parallel bus» like memory bus.&lt;br /&gt;
* hms_io : Anybus has some IO for status and configuration, this component is used to configure it.&lt;br /&gt;
&lt;br /&gt;
== Software structure ==&lt;br /&gt;
&lt;br /&gt;
Demo kit software structure is composed of some layers as described in figure 3 :&lt;br /&gt;
&lt;br /&gt;
[[image:software_structure.png|center|500px|thumb|&#039;&#039;&#039;figure 3&#039;&#039;&#039; - &#039;&#039;Software&lt;br /&gt;
structure&#039;&#039;]]&lt;br /&gt;
&lt;br /&gt;
* Linux BSP : Linux distribution used in kit is the ARMadeus sourceforge tree. Some specific modules must be added :&lt;br /&gt;
** ADC max1027 : driver for max1027 analog to digital converter.&lt;br /&gt;
** DAC max5821 : driver for max5821 digital to analog converter.&lt;br /&gt;
** input, output : driver for fpga specific input/output.&lt;br /&gt;
** uart : driver for uart used to drive HMS module.&lt;br /&gt;
* as_devices : low level library used to drive max1027 and max5821&lt;br /&gt;
* as_hms : high level library used to drive all devices on board.&lt;br /&gt;
* Qt application : graphical application for human interface.&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Gstreamer&amp;diff=9657</id>
		<title>Gstreamer</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Gstreamer&amp;diff=9657"/>
		<updated>2011-05-11T13:09:57Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* MPEG 1/2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under_Construction}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] gstreamer&lt;br /&gt;
        [*]   require libxml2 for registry and load/save&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-good  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins worth to activate:&lt;br /&gt;
*base: &lt;br /&gt;
*good:&lt;br /&gt;
*bad:&lt;br /&gt;
*ugly:&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
===Check installed plugins===&lt;br /&gt;
* To see all installed plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-inspect&lt;br /&gt;
videoscale:  videoscale: Video scaler&lt;br /&gt;
queue2:  queue2: Queue               &lt;br /&gt;
ffmpegcolorspace:  ffmpegcolorspace: FFMPEG Colorspace converter&lt;br /&gt;
audiorate:  audiorate: Audio rate adjuster                      &lt;br /&gt;
audioconvert:  audioconvert: Audio converter                    &lt;br /&gt;
audioresample:  audioresample: Audio resampler                  &lt;br /&gt;
volume:  volume: Volume&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* To have more details about one particular plugin (here alsasrc):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-inspect alsasrc&lt;br /&gt;
Factory Details:     &lt;br /&gt;
  Long name:    Audio source (ALSA)&lt;br /&gt;
  Class:        Source/Audio       &lt;br /&gt;
  Description:  Read from a sound card via ALSA&lt;br /&gt;
  Author(s):    Wim Taymans &amp;lt;wim@fluendo.com&amp;gt;  &lt;br /&gt;
  Rank:         primary (256)                  &lt;br /&gt;
&lt;br /&gt;
Plugin Details:&lt;br /&gt;
  Name:                 alsa&lt;br /&gt;
  Description:          ALSA plugin library&lt;br /&gt;
  Filename:             /usr/lib/gstreamer-0.10/libgstalsa.so&lt;br /&gt;
  Version:              0.10.25                              &lt;br /&gt;
  License:              LGPL                                 &lt;br /&gt;
  Source module:        gst-plugins-base                     &lt;br /&gt;
  Binary package:       GStreamer Base Plug-ins source release&lt;br /&gt;
  Origin URL:           Unknown package origin                &lt;br /&gt;
...&lt;br /&gt;
&amp;lt;cut&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
* play a monotic tone to check your sound configuration is working (if not please configure [[ALSA]]):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch audiotestsrc ! audioconvert ! audioresample ! alsasink&lt;br /&gt;
Setting pipeline to PAUSED ...&lt;br /&gt;
Pipeline is PREROLLING ...&lt;br /&gt;
Pipeline is PREROLLED ...&lt;br /&gt;
Setting pipeline to PLAYING ...&lt;br /&gt;
New clock: GstAudioSinkClock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* play a music file (here a .ogg, supposing the libgstogg plugin was installed):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=toto.ogg ! decodebin ! audioconvert ! audioresample ! alsasink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) and store it as an uncompressed wav file:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch alsasrc ! audioconvert ! audioresample ! wavenc ! filesink location=mic.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) and compress it (ogg/worbis):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch alsasrc ! audioconvert ! audioresample ! vorbisenc ! oggmux ! filesink location=mic.ogg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) @ 8KHz (16KHz is too CPU consuming), compress it with [[Speex]] and send it to your Host (here 192.168.1.2) at port 6666:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch -v alsasrc ! audioconvert ! audioresample ! &#039;audio/x-raw-int,rate=8000,width=16,channels=1&#039; ! speexenc ! rtpspeexpay ! udpsink host=192.168.1.2 port=6666&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ gst-launch udpsrc port=6666 caps=&amp;quot;application/x-rtp, media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)110&amp;quot; ! gstrtpjitterbuffer ! rtpspeexdepay ! speexdec ! audioconvert ! audioresample ! autoaudiosink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ gst-launch udpsrc port=6666 caps=&amp;quot;application/x-rtp, media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)110&amp;quot; ! gstrtpjitterbuffer ! rtpspeexdepay ! speexdec ! audioconvert ! audioresample ! wavenc ! filesink location=toto.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
====Plugins====&lt;br /&gt;
* You&#039;ll need to activate a few plugins in Buildroot menuconfig to play videos with Gstreamer:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
              [*]   ffmpegcolorspace (mandatory for video playback)&lt;br /&gt;
              ...&lt;br /&gt;
              [*]   playback (mandatory)&lt;br /&gt;
        [*]   gst-plugins-good  ---&amp;gt;&lt;br /&gt;
              [*]   videobox&lt;br /&gt;
              [*]   videocrop&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
              [*]   fbdev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Test installation====&lt;br /&gt;
* To test your Gstreamer installation, you need to select a plugin in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
              [*]   videotestsrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then on your APF system, launch the following command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must see a pattern displayed on the screen if your Gstreamer installation is working well.&lt;br /&gt;
&lt;br /&gt;
====Play video====&lt;br /&gt;
=====MPEG 1/2=====&lt;br /&gt;
* If you want to play MPEG 1/2 video, you have to install some plugins in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
              [*]   mpegdemux&lt;br /&gt;
              [*]   mpegtsmux&lt;br /&gt;
              [*]   mpeg4videoparse&lt;br /&gt;
              [*]   mpegvideoparse&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
              [*]   mpegaudioparse&lt;br /&gt;
              [*]   mpegstream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======With FFmpeg decoder======&lt;br /&gt;
* In Buildroot menuconfig, select:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*- ffmpeg  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] gst-ffmpeg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On your APF system, play the video with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=VIDEO_FILE_LOCATION ! mpegdemux ! ffdec_mpegvideo ! ffmpegcolorspace ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======With mpeg2dec decoder======&lt;br /&gt;
* In Buildroot menuconfig, select:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
              [*]   mpeg2dec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On your APF system, play the video with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=VIDEO_FILE_LOCATION ! mpegdemux ! mpeg2dec ! ffmpegcolorspace ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://www.gstreamer.net/&lt;br /&gt;
* http://lists.affinix.com/pipermail/delta-affinix.com/2009-April/001493.html&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=Gstreamer&amp;diff=9656</id>
		<title>Gstreamer</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=Gstreamer&amp;diff=9656"/>
		<updated>2011-05-11T10:16:30Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under_Construction}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] gstreamer&lt;br /&gt;
        [*]   require libxml2 for registry and load/save&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-good  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Plugins worth to activate:&lt;br /&gt;
*base: &lt;br /&gt;
*good:&lt;br /&gt;
*bad:&lt;br /&gt;
*ugly:&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
===Check installed plugins===&lt;br /&gt;
* To see all installed plugins:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-inspect&lt;br /&gt;
videoscale:  videoscale: Video scaler&lt;br /&gt;
queue2:  queue2: Queue               &lt;br /&gt;
ffmpegcolorspace:  ffmpegcolorspace: FFMPEG Colorspace converter&lt;br /&gt;
audiorate:  audiorate: Audio rate adjuster                      &lt;br /&gt;
audioconvert:  audioconvert: Audio converter                    &lt;br /&gt;
audioresample:  audioresample: Audio resampler                  &lt;br /&gt;
volume:  volume: Volume&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* To have more details about one particular plugin (here alsasrc):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-inspect alsasrc&lt;br /&gt;
Factory Details:     &lt;br /&gt;
  Long name:    Audio source (ALSA)&lt;br /&gt;
  Class:        Source/Audio       &lt;br /&gt;
  Description:  Read from a sound card via ALSA&lt;br /&gt;
  Author(s):    Wim Taymans &amp;lt;wim@fluendo.com&amp;gt;  &lt;br /&gt;
  Rank:         primary (256)                  &lt;br /&gt;
&lt;br /&gt;
Plugin Details:&lt;br /&gt;
  Name:                 alsa&lt;br /&gt;
  Description:          ALSA plugin library&lt;br /&gt;
  Filename:             /usr/lib/gstreamer-0.10/libgstalsa.so&lt;br /&gt;
  Version:              0.10.25                              &lt;br /&gt;
  License:              LGPL                                 &lt;br /&gt;
  Source module:        gst-plugins-base                     &lt;br /&gt;
  Binary package:       GStreamer Base Plug-ins source release&lt;br /&gt;
  Origin URL:           Unknown package origin                &lt;br /&gt;
...&lt;br /&gt;
&amp;lt;cut&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Audio===&lt;br /&gt;
* play a monotic tone to check your sound configuration is working (if not please configure [[ALSA]]):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch audiotestsrc ! audioconvert ! audioresample ! alsasink&lt;br /&gt;
Setting pipeline to PAUSED ...&lt;br /&gt;
Pipeline is PREROLLING ...&lt;br /&gt;
Pipeline is PREROLLED ...&lt;br /&gt;
Setting pipeline to PLAYING ...&lt;br /&gt;
New clock: GstAudioSinkClock&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* play a music file (here a .ogg, supposing the libgstogg plugin was installed):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=toto.ogg ! decodebin ! audioconvert ! audioresample ! alsasink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) and store it as an uncompressed wav file:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch alsasrc ! audioconvert ! audioresample ! wavenc ! filesink location=mic.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) and compress it (ogg/worbis):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch alsasrc ! audioconvert ! audioresample ! vorbisenc ! oggmux ! filesink location=mic.ogg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* record a sound from a mic (APF27 only) @ 8KHz (16KHz is too CPU consuming), compress it with [[Speex]] and send it to your Host (here 192.168.1.2) at port 6666:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch -v alsasrc ! audioconvert ! audioresample ! &#039;audio/x-raw-int,rate=8000,width=16,channels=1&#039; ! speexenc ! rtpspeexpay ! udpsink host=192.168.1.2 port=6666&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ gst-launch udpsrc port=6666 caps=&amp;quot;application/x-rtp, media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)110&amp;quot; ! gstrtpjitterbuffer ! rtpspeexdepay ! speexdec ! audioconvert ! audioresample ! autoaudiosink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ gst-launch udpsrc port=6666 caps=&amp;quot;application/x-rtp, media=(string)audio, clock-rate=(int)16000, encoding-name=(string)SPEEX, encoding-params=(string)1, payload=(int)110&amp;quot; ! gstrtpjitterbuffer ! rtpspeexdepay ! speexdec ! audioconvert ! audioresample ! wavenc ! filesink location=toto.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Video===&lt;br /&gt;
====Plugins====&lt;br /&gt;
* You&#039;ll need to activate a few plugins in Buildroot menuconfig to play videos with Gstreamer:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
              [*]   ffmpegcolorspace (mandatory for video playback)&lt;br /&gt;
              ...&lt;br /&gt;
              [*]   playback (mandatory)&lt;br /&gt;
        [*]   gst-plugins-good  ---&amp;gt;&lt;br /&gt;
              [*]   videobox&lt;br /&gt;
              [*]   videocrop&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
              [*]   fbdev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Test installation====&lt;br /&gt;
* To test your Gstreamer installation, you need to select a plugin in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*-   gst-plugins-base  ---&amp;gt;&lt;br /&gt;
              [*]   videotestsrc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then on your APF system, launch the following command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must see a pattern displayed on the screen if your Gstreamer installation is working well.&lt;br /&gt;
&lt;br /&gt;
====Play video====&lt;br /&gt;
=====MPEG 1/2=====&lt;br /&gt;
* If you want to play MPEG 1/2 video, you have to install some plugins in Buildroot menuconfig:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*]   gst-plugins-bad  ---&amp;gt;&lt;br /&gt;
              [*]   mpegdemux&lt;br /&gt;
              [*]   mpegtsmux&lt;br /&gt;
              [*]   mpeg4videoparse&lt;br /&gt;
              [*]   mpegvideoparse&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
              [*]   mpegaudioparse&lt;br /&gt;
              [*]   mpegstream&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======With FFmpeg decoder======&lt;br /&gt;
* In Buildroot menuconfig, select:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        -*- ffmpeg  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*] gst-ffmpeg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On your APF system, play the video with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=VIDEO_FILE_LOCATION ! mpegdemux ! ffdec_mpegvi&lt;br /&gt;
deo ! ffmpegcolorspace ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
======With mpeg2dec decoder======&lt;br /&gt;
* In Buildroot menuconfig, select:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Audio and video libraries and applications  ---&amp;gt;&lt;br /&gt;
        ...&lt;br /&gt;
        [*]   gst-plugins-ugly  ---&amp;gt;&lt;br /&gt;
              [*]   mpeg2dec&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On your APF system, play the video with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# gst-launch filesrc location=Pixar_For_the_Birds.mpg ! mpegdemux ! mpeg2dec ! f&lt;br /&gt;
fmpegcolorspace ! fbdevsink&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://www.gstreamer.net/&lt;br /&gt;
* http://lists.affinix.com/pipermail/delta-affinix.com/2009-April/001493.html&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=9524</id>
		<title>AsDevices</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=AsDevices&amp;diff=9524"/>
		<updated>2011-04-18T08:34:25Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Development planning : C++ wrappers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under_Construction}}&lt;br /&gt;
&lt;br /&gt;
AsDevices is an ARMadeus specific library that simplify APF-board devices usage for developers. This library is written to be used with C, C++, Python, (Java?) languages.&lt;br /&gt;
The core is written in C and other languages support is done with &amp;quot;wrappers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{Note| This library is under development, see the [[AsDevices#Development_planning | Development planning.]] to know which functionality is finished.}}&lt;br /&gt;
&lt;br /&gt;
== Install AsDevices on target ==&lt;br /&gt;
&lt;br /&gt;
The library is included in Buildroot menu, to use it just select it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base library is in C, to use it with C++ or Python, select the wrapper you need. (For Python you will need to select Python interpreter before as_devices wrapper).&lt;br /&gt;
&lt;br /&gt;
== Using library in C ==&lt;br /&gt;
&lt;br /&gt;
All functions in AsDevices library are constructed on the same way. An as_*_open() function return a device structure or an int that represent the device used. All function take this device structure in first parameter, and a function as_*_close() close the device :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
struct as_devicename_dev * as_devicename_open(&amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
as_devicename_do-something-with-device(struct as_devicename_dev *aDev, &amp;lt;some parameters&amp;gt;);&lt;br /&gt;
&lt;br /&gt;
int as_devicename_close(struct as_devicename_dev *aDev);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each library, full documentation can be found in C header in directory &#039;&#039;target/packages/as_devices/c&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== I²C ===&lt;br /&gt;
&lt;br /&gt;
as_i2c_* functions are used to access devices on i²c bus that doesn&#039;t have/need a Linux driver. If you want to access an i²c device, please find out if a driver is not already existing before using this method.&lt;br /&gt;
&lt;br /&gt;
To open the bus, you have to know its number. On [[APF9328]] and [[APF27]] only two busses are present: number 0 and number 1. The &#039;&#039;open()&#039;&#039; function returns an int (file descriptor of the opened &#039;&#039;/dec/i2c-x&#039;&#039;), that have to be passed to all other as_i2c_* functions :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_i2c_open(unsigned int i2c_id);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then depending on the complexity of the I2C device communication protocol, you can either use read()/write() (simple frames) or ioctl() with complex &amp;quot;read then write&amp;quot;/&amp;quot;write then read&amp;quot; messages.&lt;br /&gt;
&lt;br /&gt;
* Example (simple write()):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;as_devices/as_i2c.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int my_device = 0;&lt;br /&gt;
#define MY_DEV_ADDR 0x23&lt;br /&gt;
#define MY_I2C_BUS 1&lt;br /&gt;
unsigned char buf[10];&lt;br /&gt;
int ret;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
my_device = as_i2c_open(MY_I2C_BUS);&lt;br /&gt;
if (my_device &amp;lt; 0) {&lt;br /&gt;
    printf(&amp;quot;Can&#039;t init I2C port %d!!\n&amp;quot;, MY_I2C_BUS);&lt;br /&gt;
    return -1;&lt;br /&gt;
}&lt;br /&gt;
as_i2c_set_slave(my_device, MY_DEV_ADDR);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
buf[0] = (unsigned char) my_val;&lt;br /&gt;
ret = write(my_device, buf, 1);&lt;br /&gt;
if (ret &amp;lt; 0)&lt;br /&gt;
    printf(&amp;quot;Error while sending data to device !!\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SPI ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
To use as_spi_* function, the &#039;&#039;spidev&#039;&#039; kernel module/interface is required. See [[SPI]]&lt;br /&gt;
page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device file &#039;&#039;/dev/spidevx.x&#039;&#039; is available from the kernel, as_spi library can be used by including the &#039;&#039;as_spi.h&#039;&#039; header in your C source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_spi.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Full description of the API can be found in this header, available on&lt;br /&gt;
[http://armadeus.git.sourceforge.net/git/gitweb.cgi?p=armadeus/armadeus;a=blob_plain;f=target/packages/as_devices/c/as_spi.h;hb=HEAD sourceforge repository].&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
The three mains useful functions used to communicate with a slave SPI device&lt;br /&gt;
are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
int as_spi_open(const unsigned char *aSpidev_name);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To open the &#039;&#039;/dev/spidevx.x&#039;&#039; special spi file. This function return a file&lt;br /&gt;
handler that will be used for all othes as_spi_* function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
void as_spi_close(int aFd);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As its name said, to close the device.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
uint32_t as_spi_msg(int aFd, &lt;br /&gt;
                    uint32_t aMsg, &lt;br /&gt;
                    size_t aLen,&lt;br /&gt;
                    uint32_t aSpeed);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function forge spi messages on MOSI pin and return MISO message.&lt;br /&gt;
&lt;br /&gt;
=== GPIO ===&lt;br /&gt;
&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_gpio_* functions, the &#039;&#039;gpio&#039;&#039; kernel module is required. See [[GPIO_Driver]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the device files &#039;&#039;/dev/gpio/*&#039;&#039; are available , as_gpio library can be use by including &#039;&#039;as_gpio.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_gpio.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
Two examples are given, one for lightening led D14 and one to use blocking read on switch S1. This two example are made for [[APF27Dev]] daughter card.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Lightening led&#039;&#039;&#039;&lt;br /&gt;
With as_gpio, each pin port can be openned separately. The as_gpio_open() function returns a pointer on gpio pin structure declared like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 int ret; /* for returning value */&lt;br /&gt;
 struct as_gpio_device *pf14;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On APF27Dev, D14 is plugged on port F pin 14, then to open it :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 pf14 = as_gpio_open(&#039;F&#039;, 14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GPIO must be configured in ouput mode :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf14, 1);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then to switch LED value, just use &#039;&#039;as_gpio_set_pin_value()&#039;&#039; function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 1); /* led off */&lt;br /&gt;
 ...&lt;br /&gt;
 ret = as_gpio_set_pin_value(pf14, 0); /* led on */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that because off led wiring, led polarity is inverted (to light on set 0).&lt;br /&gt;
&lt;br /&gt;
Once gpio pin usage is terminated, it must be closed :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 as_gpio_close(pf14);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Pressing button&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The button S1 can be used to test interrupt capability of gpio. The button is plugged on gpio port F pin 13.&lt;br /&gt;
After declaring the &#039;&#039;as_gpio_device&#039;&#039; structure, the pin port can be opened :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 struct as_gpio_device *pf13;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
 pf13 = as_gpio_open(&#039;F&#039;, 13);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To stuff must be configured before using it as interruption source, direction and IRQ mode.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;direction&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_pin_direction(pf13, 0); /* set switch as input */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;IRQ mode&#039;&#039;&#039;&lt;br /&gt;
There is four IRQ mode :&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_NOINT  &#039;&#039;&#039;: No interrupt, the processor will ignore event on this gpio.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_RISING &#039;&#039;&#039;: rising edge, the processor will generate an interruption on rising edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_FALLING&#039;&#039;&#039;: falling edge, the processor will generate an interruption on falling edge of gpio pin.&lt;br /&gt;
* &#039;&#039;&#039;GPIO_IRQ_MODE_BOTH   &#039;&#039;&#039;: both, the processor will generate an interruption on both rising or falling edge of gpio.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_set_irq_mode(pf13, GPIO_IRQ_MODE_FALLING); /* interrupt will be generated on pushed button */&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To capture interruption, the blocking read function can be used with a timeout. If no interruption is raised after the timeout time, read function end with error value -10.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 ret = as_gpio_blocking_get_pin_value(pf13, 3, 0); /* wait for interruption for 3 seconds and 0 µs) */&lt;br /&gt;
 if(ret == -10)&lt;br /&gt;
     printf(&amp;quot;Timeout\n&amp;quot;);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== MAX1027 ===&lt;br /&gt;
=== MAX5821 ===&lt;br /&gt;
=== 93LCXX ===&lt;br /&gt;
=== PWM ===&lt;br /&gt;
==== Usage ====&lt;br /&gt;
&lt;br /&gt;
To use as_pwm_* functions, the kernel module &#039;&#039;imx_pwm&#039;&#039; needs to be loaded. See [[PWM]] page to know how to configure it.&lt;br /&gt;
&lt;br /&gt;
Once the special files &#039;&#039;/sys/class/pwm/pwmX/*&#039;&#039; are available , as_pwm_* functions can be use by including &#039;&#039;as_pwm.h&#039;&#039; header in the C source code of your application.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;as_devices/as_pwm.h&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
    struct as_pwm_device *my_pwm;&lt;br /&gt;
...&lt;br /&gt;
    my_pwm = as_pwm_open(0);&lt;br /&gt;
    if (!my_pwm)&lt;br /&gt;
        printf(&amp;quot;Can&#039;t init PWM !!\n&amp;quot;);&lt;br /&gt;
    as_pwm_set_frequency(my_pwm, 150);&lt;br /&gt;
    as_pwm_set_duty(my_pwm, 500);&lt;br /&gt;
...&lt;br /&gt;
    as_pwm_set_state(my_pwm, 1);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in Python ==&lt;br /&gt;
&lt;br /&gt;
To use AsDevices in Python, select the python wrapper in menuconfig as follow :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
  *** Armadeus specific packages ***&lt;br /&gt;
  Armadeus specific tools/utilities  ---&amp;gt;   &lt;br /&gt;
    [*] as_devices &lt;br /&gt;
    [*]   wrapper Python&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then compile bsp and flash it on your board.&lt;br /&gt;
&lt;br /&gt;
Once done, just import the module AsDevices to use all function available in library:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import AsDevices&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using library in C++ ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TODO&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Development planning ==&lt;br /&gt;
&lt;br /&gt;
AsDevices is not finished, following table indicates the remaining work:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot; summary=&amp;quot;Development planning of AsDevices&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#efefef;&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
! Name !!  C functions !! C++ wrapper !! Python wrapper !! Python class !! description &lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[I2C | i2c]] || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||  Drive I2C&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[SPI | spi]] || bgcolor=&amp;quot;green&amp;quot; | Ok, not fully tested || bgcolor=&amp;quot;green&amp;quot;| Ok, not fully tested  ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive SPI&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Gpio | gpio]] || bgcolor=&amp;quot;green&amp;quot;| Ok || bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok ||bgcolor=&amp;quot;green&amp;quot; | Ok || Drive GPIO&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[ADC_max1027 | max1027]] || bgcolor=&amp;quot;green&amp;quot;| Ok for SLOW mode ||bgcolor=&amp;quot;green&amp;quot;| Ok ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Analog to Digital chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3872/t/al MAX1027]&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[Max5821 | max5821]] || bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=&amp;quot;green&amp;quot;| Ok, not fully tested ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || Drive Digital to Analog chip [http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3288/t/al MAX5821]&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| 93LCxx || bgcolor=&amp;quot;green&amp;quot;| OK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK ||bgcolor=#FF0000| NOK || [http://ww1.microchip.com/downloads/en/DeviceDoc/21749G.pdf EEPROM memory on SPI].&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[PWM]] || bgcolor=&amp;quot;green&amp;quot; |  OK  ||  bgcolor=&amp;quot;red&amp;quot; | NOK    || bgcolor=&amp;quot;red&amp;quot; | NOK  || bgcolor=&amp;quot;red&amp;quot; | NOK || Drive imx27 pwm |&lt;br /&gt;
|- align=&amp;quot;center&amp;quot;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9484</id>
		<title>APF27 PPS</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9484"/>
		<updated>2011-03-24T15:48:32Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* IPSec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
PPS is an Armadeus System&#039;s baseboard for the [[APF27]] module. It can be used to implement and securize network applications such as routers and gateways.&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:PPS_recto.jpeg|center|thumb|400px|Front side, you can see dual Ethernet, USB 2.0 Host &amp;amp; OTG, WiFi Antenna, extension connector footprint and power supply]]&lt;br /&gt;
|| [[Image:PPS_verso.jpeg|center|thumb|200px|Back side, with an APF27 module plugged-in]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* [http://www.armadeus.com/english/products-development_boards-apf27_pps.html Product page on Armadeus Systems website]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware Schematics]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/documentation Datasheet]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware Mechanical drawings]&lt;br /&gt;
&lt;br /&gt;
==Software features==&lt;br /&gt;
There are some network applications/features that are preselected in the PPS baseboard default configuration:&lt;br /&gt;
* Encryption / Security&lt;br /&gt;
** [[SSH|OpenSSH]]&lt;br /&gt;
** [[IPSec / IPTables]]&lt;br /&gt;
* [[USB Gadget#To emulate an Ethernet link|USB Ethernet gadget support]]&lt;br /&gt;
* [[USB Gadget#To emulate a serial link|USB RS232 gadget support]]&lt;br /&gt;
* [[USB to Ethernet adapter|SMSC USB to Ethernet Adapter]]&lt;br /&gt;
* [[Boa|Boa Web Server]]&lt;br /&gt;
* [[WiFi|Wireless tools]] (for securized WiFi with WEP encryption)&lt;br /&gt;
* [[WPA supplicant]] (for securized WiFi with WPA/WPA2 encryption)&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also use the PPS test scripts located in &#039;&#039;/usr/local/pps/scripts&#039;&#039; on the system to test some software functionalities.}}&lt;br /&gt;
&lt;br /&gt;
==SSH terminal==&lt;br /&gt;
The APF27 PPS filesystem is configured to enable SSH connection from a host computer.&lt;br /&gt;
It allows you to access a system terminal through the default Ethernet port (the one aside USB Host connector).&lt;br /&gt;
&lt;br /&gt;
* The default connection informations are:&lt;br /&gt;
** &#039;&#039;&#039;IP address&#039;&#039;&#039;: 192.168.0.10&lt;br /&gt;
** &#039;&#039;&#039;Login&#039;&#039;&#039;: guest&lt;br /&gt;
** &#039;&#039;&#039;Password&#039;&#039;&#039;: armadeus&lt;br /&gt;
&lt;br /&gt;
* Then you can connect to your system by running the following command on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh guest@192.168.0.10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For more details, refer to the [[SSH#Dropbear|SSH - Dropbear page]] in the Wiki.&lt;br /&gt;
&lt;br /&gt;
==Debug / Development interface==&lt;br /&gt;
* In order to gain access to the serial port of the APF27 (U-Boot &amp;amp; Linux console), a small adapter cable has to be done.&lt;br /&gt;
A standard 2.54mm pin header connector (J5) allows accessing the TX and RX debug lines of the i.MX27.&lt;br /&gt;
The signals are compatible with a the RS-232 standard so no level translator is required.&lt;br /&gt;
&lt;br /&gt;
The pinout is described in the [http://www.armadeus.com/_downloads/apf27_PPS/documentation/pps_datasheet_v0A.pdf datasheet] and summarized here:&lt;br /&gt;
* pin 1 (square pad): not connected&lt;br /&gt;
* pin 2: TX line (processor side)&lt;br /&gt;
* pin 3: RX line (processor side)&lt;br /&gt;
* pin 4: GND&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:APF27_PPS_J5.png|center|thumb|200px| J5 pin 1]]&lt;br /&gt;
|| [[Image:APF27_PPS_RS232_standard.gif|center|thumb|200px| DB9 connection like on APF27Dev (requires Null-Modem cable)]]&lt;br /&gt;
|| [[Image:Apf27_PPS_RS232.png|center|thumb|200px| DB9 connection for direct USB&amp;lt;-&amp;gt;Serial adapter usage]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Now you have the debug access, you can [[Setup| install all the tools needed to control your board on your Host]].&lt;br /&gt;
&lt;br /&gt;
==WiFi usage==&lt;br /&gt;
On PPS, WiFi/Libertas driver usage is a little bit different than on other platforms. Here are the things to know:&lt;br /&gt;
&lt;br /&gt;
===Drivers setup===&lt;br /&gt;
You have to install Libertas SDIO and MMC drivers as modules to make Wi2Wi chipset work correctly on PPS (done by default):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    [*] Network device support  ---&amp;gt;&lt;br /&gt;
        Wireless LAN  ---&amp;gt;&lt;br /&gt;
            [*] Wireless LAN (IEEE 802.11)&lt;br /&gt;
            &amp;lt;M&amp;gt;   Marvell 8xxx Libertas WLAN driver support&lt;br /&gt;
            &amp;lt; &amp;gt;     Marvell Livertas 8388 USB 802.11b/g cards&lt;br /&gt;
            &amp;lt;M&amp;gt;     Marvell Libertas 8385 and 8686 SDIO 802.11b/g cards&lt;br /&gt;
    &amp;lt;M&amp;gt; MMC/SD/SDIO card support  ---&amp;gt;&lt;br /&gt;
              *** MMC/SD/SDIO Card Drivers ***&lt;br /&gt;
        &amp;lt;M&amp;gt;   MMC block device driver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initializing the connection===&lt;br /&gt;
Before creating the WiFi connection, you must load the Libertas SDIO and the MMC modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# modprobe mxcmmc&lt;br /&gt;
i.MX SDHC driver&lt;br /&gt;
mmc0: new SDIO card at address 0001&lt;br /&gt;
&lt;br /&gt;
# modprobe libertas_sdio&lt;br /&gt;
lib80211: common routines for IEEE802.11 drivers&lt;br /&gt;
libertas_sdio: Libertas SDIO driver&lt;br /&gt;
libertas_sdio: Copyright Pierre Ossman&lt;br /&gt;
libertas_sdio mmc0:0001:1: firmware: requesting sd8686_helper.bin&lt;br /&gt;
libertas_sdio mmc0:0001:1: firmware: requesting sd8686.bin&lt;br /&gt;
libertas: 00:19:88:11:6b:d8, fw 9.70.3p36, cap 0x00000303&lt;br /&gt;
eth1 (libertas_sdio): not using net_device_ops yet&lt;br /&gt;
libertas: PREP_CMD: command 0x00a3 failed: 2&lt;br /&gt;
libertas: PREP_CMD: command 0x00a3 failed: 2&lt;br /&gt;
libertas: eth1: Marvell WLAN 802.11 adapter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then all informations on [[Libertas_driver]] page apply.&lt;br /&gt;
&lt;br /&gt;
===Shutdown WiFi interface===&lt;br /&gt;
You have to unload the MMC driver along with the Libertas SDIO if you want to completely shutdown the WiFi interface:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ifconfig eth1 down&lt;br /&gt;
# rmmod mxcmmc&lt;br /&gt;
# rmmod libertas_sdio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reset Wi2Wi===&lt;br /&gt;
To reset the chipset, you have to use the Wi2Wi RESET GPIO:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# source /usr/bin/gpio_helpers.sh&lt;br /&gt;
&lt;br /&gt;
# gpio_mode PE11 1&lt;br /&gt;
# gpio_set_value PE11 0&lt;br /&gt;
# gpio_set_value PE11 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test scripts==&lt;br /&gt;
You can find test scripts in PPS&#039; filesystem to help you to test the PPS&#039; functionalities.&lt;br /&gt;
They are located in the directory &#039;&#039;/usr/local/pps/scripts&#039;&#039; but you can run them from any directory.&lt;br /&gt;
&lt;br /&gt;
=== Boa ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** init_boa.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: init_boa.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Enable a web server with an interpreted HTML page accessible from outside the system.&lt;br /&gt;
&lt;br /&gt;
=== USB Gadget ===&lt;br /&gt;
==== Ethernet Gadget ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ether_gadget.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ether_gadget.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Activate an Ethernet connection interface on the system through the USB Gadget port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Try to ping the system from your host PC on &#039;&#039;192.168.10.1&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== RS232 Gadget ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_rs232_gadget.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_rs232_gadget.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Enable a RS232 connection interface on the system through the USB Gadget port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Enter some datas or texts through /dev/ttyACM0 on your host PC. You should see the same datas displayed on the system.&lt;br /&gt;
&lt;br /&gt;
=== Bridge ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_bridge.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_bridge.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a bridge through two connection interfaces on the system.&lt;br /&gt;
&lt;br /&gt;
=== SMSC95xx ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ether_smsc95xx.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ether_smsc95xx.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create an Ethernet connection interface through the Ethernet SMSC95xx port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Try to ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
&lt;br /&gt;
=== Wifi ===&lt;br /&gt;
==== IWConfig &#039;&#039;(WEP)&#039;&#039; ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_wifi.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_wifi.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a Wifi connection interface with [[Wifi|IWConfig &#039;&#039;(WEP encryption)&#039;&#039;]].&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
&lt;br /&gt;
==== WPA Supplicant &#039;&#039;(WPA/WPA2)&#039;&#039; ====&lt;br /&gt;
* &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
** init_wpa.sh&lt;br /&gt;
** reset_wi2wi.sh&lt;br /&gt;
** stop_wpa.sh&lt;br /&gt;
* &#039;&#039;&#039;Arguments&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;SSID&#039;&#039;: Wifi connection SSID&lt;br /&gt;
** &#039;&#039;PASSPHRASE&#039;&#039;: Wifi connection passphrase&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: init_wpa.sh SSID PASSPHRASE&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a Wifi connection interface with [[WPA supplicant|WPA Supplicant &#039;&#039;(WPA/WPA2 encryption)&#039;&#039;]].&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;&lt;br /&gt;
** Ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
** To unable the connection, you can run &#039;&#039;stop_wpa.sh&#039;&#039;.&lt;br /&gt;
** To restart WPA Supplicant, first run &#039;&#039;stop_wpa.sh&#039;&#039; then &#039;&#039;init_wpa.sh&#039;&#039; again.&lt;br /&gt;
&lt;br /&gt;
=== OpenSSH ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ssh_tunnel.sh&lt;br /&gt;
* &#039;&#039;&#039;Arguments&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;USERNAME&#039;&#039;: the login of the user you want to connect on.&lt;br /&gt;
** &#039;&#039;HOSTADDRESS&#039;&#039;: the IP address of the host PC you want to connect on.&lt;br /&gt;
** &#039;&#039;VIRTUALPORT&#039;&#039;: the virtual port used to hide the encrypted port.&lt;br /&gt;
** &#039;&#039;TELNETPORT&#039;&#039;: the number of your Telnet port (must be same on the system and the host PC)&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ssh_tunnel.sh USERNAME HOSTADDRESS VIRTUALPORT TELNETPORT&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a SSH connection between the system and your host PC on the Telnet port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: To test it, launch a Wireshark on the host PC to check the datas on your host IP address. The password you type and the name of the [[Telnet]] protocol must be encrypted.&lt;br /&gt;
&lt;br /&gt;
=== IPSec ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ipsec.sh&lt;br /&gt;
* &#039;&#039;&#039;Argument&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;IPADDRESS&#039;&#039;: the system&#039;s IP address of the encrypted connection&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ipsec.sh IPADDRESS&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Encrypt the connection between your host PC and the system.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;&lt;br /&gt;
** Before running the script, edit the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; and put the right IP addresses for the system and your host PC.&lt;br /&gt;
** Launch Wireshark on your host PC on the encrypted connection&#039;s IP address.&lt;br /&gt;
** Run [[Telnet]] on the system toward your host PC:&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;telnet HOST_ADDRESS&amp;lt;/pre&amp;gt;&lt;br /&gt;
** Your login, password and the name of the [[Telnet]] protocol must be encrypted.&lt;br /&gt;
&lt;br /&gt;
==Feature list==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;5&amp;quot; summary=&amp;quot;Hardware Add-Ons by functionnalities&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|- style=&amp;quot;background:#f4f4f4; color:black; -moz-border-radius:18px;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
===Wired communication===&lt;br /&gt;
* [[Uart|UART]]&lt;br /&gt;
* [[SPI]]&lt;br /&gt;
* [[I2C]]&lt;br /&gt;
* [[USB Host]]&lt;br /&gt;
* USB OTG&lt;br /&gt;
* Ethernet&lt;br /&gt;
&lt;br /&gt;
===Wireless communication===&lt;br /&gt;
* [[Libertas driver|Wi2Wi chipset driver]] (see [[Libertas driver#Wi2Wi chipset|Wi2Wi Section]])&lt;br /&gt;
* [[Wifi|WiFi usage on Linux]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [[PWM]]: PWM output is on J22 pin 4 &amp;lt;br&amp;gt;(2.8V output, if configured as output)&lt;br /&gt;
* [[GPIO Driver]]&lt;br /&gt;
* [[JTAG]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===FPGA===&lt;br /&gt;
* [[Using FPGA]]&lt;br /&gt;
&lt;br /&gt;
[[Category:DevelopmentBoards]]&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9483</id>
		<title>APF27 PPS</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9483"/>
		<updated>2011-03-24T15:43:20Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: PPS&amp;#039; test scripts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
PPS is an Armadeus System&#039;s baseboard for the [[APF27]] module. It can be used to implement and securize network applications such as routers and gateways.&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:PPS_recto.jpeg|center|thumb|400px|Front side, you can see dual Ethernet, USB 2.0 Host &amp;amp; OTG, WiFi Antenna, extension connector footprint and power supply]]&lt;br /&gt;
|| [[Image:PPS_verso.jpeg|center|thumb|200px|Back side, with an APF27 module plugged-in]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* [http://www.armadeus.com/english/products-development_boards-apf27_pps.html Product page on Armadeus Systems website]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware Schematics]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/documentation Datasheet]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware Mechanical drawings]&lt;br /&gt;
&lt;br /&gt;
==Software features==&lt;br /&gt;
There are some network applications/features that are preselected in the PPS baseboard default configuration:&lt;br /&gt;
* Encryption / Security&lt;br /&gt;
** [[SSH|OpenSSH]]&lt;br /&gt;
** [[IPSec / IPTables]]&lt;br /&gt;
* [[USB Gadget#To emulate an Ethernet link|USB Ethernet gadget support]]&lt;br /&gt;
* [[USB Gadget#To emulate a serial link|USB RS232 gadget support]]&lt;br /&gt;
* [[USB to Ethernet adapter|SMSC USB to Ethernet Adapter]]&lt;br /&gt;
* [[Boa|Boa Web Server]]&lt;br /&gt;
* [[WiFi|Wireless tools]] (for securized WiFi with WEP encryption)&lt;br /&gt;
* [[WPA supplicant]] (for securized WiFi with WPA/WPA2 encryption)&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also use the PPS test scripts located in &#039;&#039;/usr/local/pps/scripts&#039;&#039; on the system to test some software functionalities.}}&lt;br /&gt;
&lt;br /&gt;
==SSH terminal==&lt;br /&gt;
The APF27 PPS filesystem is configured to enable SSH connection from a host computer.&lt;br /&gt;
It allows you to access a system terminal through the default Ethernet port (the one aside USB Host connector).&lt;br /&gt;
&lt;br /&gt;
* The default connection informations are:&lt;br /&gt;
** &#039;&#039;&#039;IP address&#039;&#039;&#039;: 192.168.0.10&lt;br /&gt;
** &#039;&#039;&#039;Login&#039;&#039;&#039;: guest&lt;br /&gt;
** &#039;&#039;&#039;Password&#039;&#039;&#039;: armadeus&lt;br /&gt;
&lt;br /&gt;
* Then you can connect to your system by running the following command on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh guest@192.168.0.10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For more details, refer to the [[SSH#Dropbear|SSH - Dropbear page]] in the Wiki.&lt;br /&gt;
&lt;br /&gt;
==Debug / Development interface==&lt;br /&gt;
* In order to gain access to the serial port of the APF27 (U-Boot &amp;amp; Linux console), a small adapter cable has to be done.&lt;br /&gt;
A standard 2.54mm pin header connector (J5) allows accessing the TX and RX debug lines of the i.MX27.&lt;br /&gt;
The signals are compatible with a the RS-232 standard so no level translator is required.&lt;br /&gt;
&lt;br /&gt;
The pinout is described in the [http://www.armadeus.com/_downloads/apf27_PPS/documentation/pps_datasheet_v0A.pdf datasheet] and summarized here:&lt;br /&gt;
* pin 1 (square pad): not connected&lt;br /&gt;
* pin 2: TX line (processor side)&lt;br /&gt;
* pin 3: RX line (processor side)&lt;br /&gt;
* pin 4: GND&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:APF27_PPS_J5.png|center|thumb|200px| J5 pin 1]]&lt;br /&gt;
|| [[Image:APF27_PPS_RS232_standard.gif|center|thumb|200px| DB9 connection like on APF27Dev (requires Null-Modem cable)]]&lt;br /&gt;
|| [[Image:Apf27_PPS_RS232.png|center|thumb|200px| DB9 connection for direct USB&amp;lt;-&amp;gt;Serial adapter usage]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Now you have the debug access, you can [[Setup| install all the tools needed to control your board on your Host]].&lt;br /&gt;
&lt;br /&gt;
==WiFi usage==&lt;br /&gt;
On PPS, WiFi/Libertas driver usage is a little bit different than on other platforms. Here are the things to know:&lt;br /&gt;
&lt;br /&gt;
===Drivers setup===&lt;br /&gt;
You have to install Libertas SDIO and MMC drivers as modules to make Wi2Wi chipset work correctly on PPS (done by default):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Device drivers  ---&amp;gt;&lt;br /&gt;
    [*] Network device support  ---&amp;gt;&lt;br /&gt;
        Wireless LAN  ---&amp;gt;&lt;br /&gt;
            [*] Wireless LAN (IEEE 802.11)&lt;br /&gt;
            &amp;lt;M&amp;gt;   Marvell 8xxx Libertas WLAN driver support&lt;br /&gt;
            &amp;lt; &amp;gt;     Marvell Livertas 8388 USB 802.11b/g cards&lt;br /&gt;
            &amp;lt;M&amp;gt;     Marvell Libertas 8385 and 8686 SDIO 802.11b/g cards&lt;br /&gt;
    &amp;lt;M&amp;gt; MMC/SD/SDIO card support  ---&amp;gt;&lt;br /&gt;
              *** MMC/SD/SDIO Card Drivers ***&lt;br /&gt;
        &amp;lt;M&amp;gt;   MMC block device driver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Initializing the connection===&lt;br /&gt;
Before creating the WiFi connection, you must load the Libertas SDIO and the MMC modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# modprobe mxcmmc&lt;br /&gt;
i.MX SDHC driver&lt;br /&gt;
mmc0: new SDIO card at address 0001&lt;br /&gt;
&lt;br /&gt;
# modprobe libertas_sdio&lt;br /&gt;
lib80211: common routines for IEEE802.11 drivers&lt;br /&gt;
libertas_sdio: Libertas SDIO driver&lt;br /&gt;
libertas_sdio: Copyright Pierre Ossman&lt;br /&gt;
libertas_sdio mmc0:0001:1: firmware: requesting sd8686_helper.bin&lt;br /&gt;
libertas_sdio mmc0:0001:1: firmware: requesting sd8686.bin&lt;br /&gt;
libertas: 00:19:88:11:6b:d8, fw 9.70.3p36, cap 0x00000303&lt;br /&gt;
eth1 (libertas_sdio): not using net_device_ops yet&lt;br /&gt;
libertas: PREP_CMD: command 0x00a3 failed: 2&lt;br /&gt;
libertas: PREP_CMD: command 0x00a3 failed: 2&lt;br /&gt;
libertas: eth1: Marvell WLAN 802.11 adapter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then all informations on [[Libertas_driver]] page apply.&lt;br /&gt;
&lt;br /&gt;
===Shutdown WiFi interface===&lt;br /&gt;
You have to unload the MMC driver along with the Libertas SDIO if you want to completely shutdown the WiFi interface:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# ifconfig eth1 down&lt;br /&gt;
# rmmod mxcmmc&lt;br /&gt;
# rmmod libertas_sdio&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Reset Wi2Wi===&lt;br /&gt;
To reset the chipset, you have to use the Wi2Wi RESET GPIO:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
# source /usr/bin/gpio_helpers.sh&lt;br /&gt;
&lt;br /&gt;
# gpio_mode PE11 1&lt;br /&gt;
# gpio_set_value PE11 0&lt;br /&gt;
# gpio_set_value PE11 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test scripts==&lt;br /&gt;
You can find test scripts in PPS&#039; filesystem to help you to test the PPS&#039; functionalities.&lt;br /&gt;
They are located in the directory &#039;&#039;/usr/local/pps/scripts&#039;&#039; but you can run them from any directory.&lt;br /&gt;
&lt;br /&gt;
=== Boa ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** init_boa.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: init_boa.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Enable a web server with an interpreted HTML page accessible from outside the system.&lt;br /&gt;
&lt;br /&gt;
=== USB Gadget ===&lt;br /&gt;
==== Ethernet Gadget ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ether_gadget.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ether_gadget.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Activate an Ethernet connection interface on the system through the USB Gadget port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Try to ping the system from your host PC on &#039;&#039;192.168.10.1&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== RS232 Gadget ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_rs232_gadget.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_rs232_gadget.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Enable a RS232 connection interface on the system through the USB Gadget port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Enter some datas or texts through /dev/ttyACM0 on your host PC. You should see the same datas displayed on the system.&lt;br /&gt;
&lt;br /&gt;
=== Bridge ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_bridge.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_bridge.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a bridge through two connection interfaces on the system.&lt;br /&gt;
&lt;br /&gt;
=== SMSC95xx ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ether_smsc95xx.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ether_smsc95xx.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create an Ethernet connection interface through the Ethernet SMSC95xx port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Try to ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
&lt;br /&gt;
=== Wifi ===&lt;br /&gt;
==== IWConfig &#039;&#039;(WEP)&#039;&#039; ====&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_wifi.sh&lt;br /&gt;
* No argument&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_wifi.sh&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a Wifi connection interface with [[Wifi|IWConfig &#039;&#039;(WEP encryption)&#039;&#039;]].&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: Ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
&lt;br /&gt;
==== WPA Supplicant &#039;&#039;(WPA/WPA2)&#039;&#039; ====&lt;br /&gt;
* &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
** init_wpa.sh&lt;br /&gt;
** reset_wi2wi.sh&lt;br /&gt;
** stop_wpa.sh&lt;br /&gt;
* &#039;&#039;&#039;Arguments&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;SSID&#039;&#039;: Wifi connection SSID&lt;br /&gt;
** &#039;&#039;PASSPHRASE&#039;&#039;: Wifi connection passphrase&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: init_wpa.sh SSID PASSPHRASE&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a Wifi connection interface with [[WPA supplicant|WPA Supplicant &#039;&#039;(WPA/WPA2 encryption)&#039;&#039;]].&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;&lt;br /&gt;
** Ping the address &#039;&#039;192.168.0.251&#039;&#039; on your host PC.&lt;br /&gt;
** To unable the connection, you can run &#039;&#039;stop_wpa.sh&#039;&#039;.&lt;br /&gt;
** To restart WPA Supplicant, first run &#039;&#039;stop_wpa.sh&#039;&#039; then &#039;&#039;init_wpa.sh&#039;&#039; again.&lt;br /&gt;
&lt;br /&gt;
=== OpenSSH ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ssh_tunnel.sh&lt;br /&gt;
* &#039;&#039;&#039;Arguments&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;USERNAME&#039;&#039;: the login of the user you want to connect on.&lt;br /&gt;
** &#039;&#039;HOSTADDRESS&#039;&#039;: the IP address of the host PC you want to connect on.&lt;br /&gt;
** &#039;&#039;VIRTUALPORT&#039;&#039;: the virtual port used to hide the encrypted port.&lt;br /&gt;
** &#039;&#039;TELNETPORT&#039;&#039;: the number of your Telnet port (must be same on the system and the host PC)&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ssh_tunnel.sh USERNAME HOSTADDRESS VIRTUALPORT TELNETPORT&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Create a SSH connection between the system and your host PC on the Telnet port.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;: To test it, launch a Wireshark on the host PC to check the datas on your host IP address. The password you type and the name of the [[Telnet]] protocol must be encrypted.&lt;br /&gt;
&lt;br /&gt;
=== IPSec ===&lt;br /&gt;
* &#039;&#039;&#039;File&#039;&#039;&#039;&lt;br /&gt;
** test_ipsec.sh&lt;br /&gt;
* &#039;&#039;&#039;Argument&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;IPADDRESS&#039;&#039;: the system&#039;s IP address of the encrypted connection&lt;br /&gt;
* &#039;&#039;&#039;Usage&#039;&#039;&#039;: test_ipsec.sh IPADDRESS&lt;br /&gt;
* &#039;&#039;&#039;Functionality&#039;&#039;&#039;: Encrypt the connection between your host PC and the system.&lt;br /&gt;
* &#039;&#039;&#039;Test&#039;&#039;&#039;&lt;br /&gt;
** Before running the script, edit the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; and put the right IP addresses for the system and your host PC.&lt;br /&gt;
** Launch Wireshark on your host PC on the encrypted connection&#039;s IP address.&lt;br /&gt;
** Run [[Telnet]] on the system toward your host PC:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
telnet HOST_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
** Your login, password and the name of the [[Telnet]] protocol must be encrypted.&lt;br /&gt;
&lt;br /&gt;
==Feature list==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;5&amp;quot; summary=&amp;quot;Hardware Add-Ons by functionnalities&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|- style=&amp;quot;background:#f4f4f4; color:black; -moz-border-radius:18px;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
===Wired communication===&lt;br /&gt;
* [[Uart|UART]]&lt;br /&gt;
* [[SPI]]&lt;br /&gt;
* [[I2C]]&lt;br /&gt;
* [[USB Host]]&lt;br /&gt;
* USB OTG&lt;br /&gt;
* Ethernet&lt;br /&gt;
&lt;br /&gt;
===Wireless communication===&lt;br /&gt;
* [[Libertas driver|Wi2Wi chipset driver]] (see [[Libertas driver#Wi2Wi chipset|Wi2Wi Section]])&lt;br /&gt;
* [[Wifi|WiFi usage on Linux]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [[PWM]]: PWM output is on J22 pin 4 &amp;lt;br&amp;gt;(2.8V output, if configured as output)&lt;br /&gt;
* [[GPIO Driver]]&lt;br /&gt;
* [[JTAG]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===FPGA===&lt;br /&gt;
* [[Using FPGA]]&lt;br /&gt;
&lt;br /&gt;
[[Category:DevelopmentBoards]]&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=USB_Gadget&amp;diff=9459</id>
		<title>USB Gadget</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=USB_Gadget&amp;diff=9459"/>
		<updated>2011-03-03T09:27:32Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* To emulate a serial link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions on how to use the USB device (or OTG) port of your Armadeus board to communicate with your PC; ie see your board from your PC like an USB device.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
You can connect your APF board to your PC using its USB Device port ([[APF9328DevFull]]), a modified USB host port ([[APF27Dev]]), or an USB OTG port ([[APF27 PPS]]), and it can be &amp;quot;enumerated&amp;quot; as most common USB devices (depending on the type of communication you want to use):&lt;br /&gt;
* serial device&lt;br /&gt;
* net device&lt;br /&gt;
* mass storage device&lt;br /&gt;
&lt;br /&gt;
=== Hardware/software specifics for the APF27dev and APF27 PPS boards ===&lt;br /&gt;
At first, an USB A male / A male cable has to be used like this one: http://fr.farnell.com/pro-signal/psg90024/lead-usb-2-0-am-am-2m-black/dp/1494745&lt;br /&gt;
&lt;br /&gt;
Do not use USB cable with integrated ferrite bead !!&lt;br /&gt;
&lt;br /&gt;
The APF27dev board is equipped with two USB host ports. Only the high speed Host port (top connector) can be configured as an USB Device.&lt;br /&gt;
&lt;br /&gt;
In order to activate the device mode, a new parameter has to be added to the U-Boot console variable:&lt;br /&gt;
 BIOS&amp;gt; setenv console console=ttySMX0,115200 otg_mode=device&lt;br /&gt;
 BIOS&amp;gt; saveenv&lt;br /&gt;
 BIOS&amp;gt; boot&lt;br /&gt;
&lt;br /&gt;
Your port will now work as an USB device.&lt;br /&gt;
&lt;br /&gt;
{{Warning|DO NOT CONNECT TWO HOST PORTS TOGETHER AND TAKE CARE TO USE THE RIGHT USB PORT ON THE APF27DEV !!}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
* The drivers are now installed by default (since armadeus-3.0)&lt;br /&gt;
* you should have following modules in your kernel source tree:&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/gadgetfs.ko&#039;&#039;&#039;        For test&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_ether.ko&#039;&#039;&#039;         Ethernet emulation on USB&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_file_storage.ko&#039;&#039;&#039;  Mass storage&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_serial.ko&#039;&#039;&#039;        Serial emulation on USB&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_zero.ko&#039;&#039;&#039;          For test&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&lt;br /&gt;
===To emulate a mass storage device:===&lt;br /&gt;
* [[USB_Gadget#Links |create]] or get a &amp;quot;backing storage file&amp;quot; ([http://dl.free.fr/q9IKqqweK for example])&lt;br /&gt;
* copy this file (uncompressed) in the &#039;&#039;&#039;/tmp&#039;&#039;&#039; directory of your board (here my Host PC has 192.168.0.20 as IP @):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # tftp -g -r backing_file.gz -l /tmp/backing_file.gz 192.168.0.20&lt;br /&gt;
 # gunzip /tmp/backing_file.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* load &#039;&#039;g_file_storage&#039;&#039; module:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # modprobe g_file_storage file=/tmp/backing_file&lt;br /&gt;
 g_file_storage gadget: File-backed Storage Gadget, version: 28 November 2005&lt;br /&gt;
 g_file_storage gadget: Number of LUNs=1&lt;br /&gt;
 g_file_storage gadget-lun0: ro=0, file: /tmp/backing_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* connect target&#039;s USB cable to your PC and, &lt;br /&gt;
On your Linux Host:&lt;br /&gt;
* If you have a recent Linux distribution, your device should be automatically mounted. Otherwise:&lt;br /&gt;
** as root, launch &#039;&#039;dmesg&#039;&#039; and find the &#039;&#039;/dev/sdaX&#039;&#039; device assigned to your board:&lt;br /&gt;
 ... usb 1-1.4: new full speed USB device using uhci_hcd and address 7&lt;br /&gt;
 ... usb 1-1.4: configuration #1 chosen from 1 choice&lt;br /&gt;
 ... scsi1 : SCSI emulation for USB Mass Storage devices&lt;br /&gt;
 ...    Vendor: Linux     Model: File-Stor Gadget  Rev: 0314&lt;br /&gt;
 ...    Type:   Direct-Access                      ANSI SCSI revision: 02&lt;br /&gt;
 ...  SCSI device sda: 8192 512-byte hdwr sectors (4 MB)&lt;br /&gt;
 ...  sda: Write Protect is off&lt;br /&gt;
 ...  SCSI device sda: 8192 512-byte hdwr sectors (4 MB)&lt;br /&gt;
 ...  sda: Write Protect is off&lt;br /&gt;
 ...   sda: sda1&lt;br /&gt;
 ...  sd 1:0:0:0: Attached scsi disk sda&lt;br /&gt;
 ...  sd 1:0:0:0: Attached scsi generic sg0 type 0&lt;br /&gt;
*&lt;br /&gt;
** then mount the device and enjoy file sharing:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo mount /dev/sda1 /mnt/tmp&lt;br /&gt;
 $ cd /mnt/tmp&lt;br /&gt;
 $ showimage /mnt/tmp/test.jpg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To emulate a serial link===&lt;br /&gt;
* On your Host PC (if &#039;&#039;&#039;usbserial&#039;&#039;&#039; module is not already loaded):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo modprobe usbserial vendor=0x0525 product=0xA4A6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or you can automate it by modifying &#039;&#039;/etc/modprobe.d/options&#039;&#039; file (Tested on *Ubuntu):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo vim /etc/modprobe.d/options&lt;br /&gt;
  ...&lt;br /&gt;
  options usbserial vendor=0x0525 product=0xA4A6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* on your APF:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # modprobe g_serial&lt;br /&gt;
 g_serial gadget: Gadget Serial v2.4&lt;br /&gt;
 g_serial gadget: g_serial ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_serial&lt;br /&gt;
 g_serial gadget: high speed config #2: CDC ACM config&lt;br /&gt;
&lt;br /&gt;
 # mknod /dev/ttyGS0 c 249 0   (if not created)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* then connect the USB cable between your PC and your APF and you should see on your Host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ tail -f /var/log/messages&lt;br /&gt;
 Sep 27 10:06:38 ...  usb 2-1.3: new high speed USB device using ehci_hcd and address 14&lt;br /&gt;
 Sep 27 10:06:38 ...  usb 2-1.3: configuration #2 chosen from 1 choice&lt;br /&gt;
 Sep 27 10:06:38 ...  cdc_acm 2-1.3:2.0: ttyACM0: USB ACM device&lt;br /&gt;
 Sep 27 10:06:38 ...  usbcore: registered new interface driver cdc_acm&lt;br /&gt;
 Sep 27 10:06:38 ...  cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* you should now be able to send/receive data through &#039;&#039;/dev/ttyACM0&#039;&#039; (PC) and &#039;&#039;/dev/ttyGS0&#039;&#039; (APF):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # cat /dev/ttyGS0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ echo &amp;quot;COUCOU&amp;quot; &amp;gt; /dev/ttyACM0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 COUCOU&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To emulate an Ethernet link===&lt;br /&gt;
* On your Target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 ether gadget: using random self ethernet address&lt;br /&gt;
 ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: Ethernet Gadget, version: May Day 2005&lt;br /&gt;
 usb0: using imx_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep4in-int&lt;br /&gt;
 usb0: MAC be:df:31:95:16:e0&lt;br /&gt;
 usb0: HOST MAC 3e:86:1e:94:eb:84&lt;br /&gt;
 usb0: RNDIS ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now an IP address has to be assigned to the USB0 ethernet port &lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig usb0 192.168.10.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On your PC:&lt;br /&gt;
** On &#039;&#039;&#039;Linux&#039;&#039;&#039; systems:&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;$ sudo modprobe cdc_ether&amp;lt;/pre&amp;gt;&lt;br /&gt;
** On &#039;&#039;&#039;Windows&#039;&#039;&#039; systems: &amp;lt;br/&amp;gt;When the target is detected, you will be asked to give the right driver. &amp;lt;br/&amp;gt;You will find it here: [http://www.armadeus.com/_downloads/apf27_PPS/windrivers/ APF27 PPS Windrivers].&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
&lt;br /&gt;
* http://www.linux-usb.org/gadget/&lt;br /&gt;
* http://www.linux-usb.org/usbtest/#gadgets&lt;br /&gt;
* http://www.linux-usb.org/gadget/file_storage.html&lt;br /&gt;
* http://lxr.linux.no/source/Documentation/usb/gadget_serial.txt&lt;br /&gt;
* [[Serial_Transfer]]&lt;br /&gt;
* http://www.linux-usb.org/usbnet/&lt;br /&gt;
* http://wiki.gp2x.org/wiki/UsbNet_on_Linux&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux drivers]]&lt;br /&gt;
[[Category:USB]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9347</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9347"/>
		<updated>2011-01-24T13:04:03Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Host PC (Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can choose specific ports and protocols to securize with IPSec in the security policies like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 192.168.0.211/24[PORT_NUMBER] 192.168.0.208/24[PORT_NUMBER] PROTOCOL_NAME -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if you want to encrypt on [[Telnet]] port only, on the server your security policies will be:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 0.0.0.0/0[any] 192.168.0.211/24[23] tcp -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.211/24[23] 192.168.0.208/24[any] tcp -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The keyword any means any protocols or any ports.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the IPSec authentication and encryption.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In order to use protocols like TFTP or FTP through the NAT router, you have to activate the support for the protocol you want in Netfilter.&lt;br /&gt;
For instance with the TFTP protocol:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   TFTP protocol support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9346</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9346"/>
		<updated>2011-01-24T13:02:02Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Host PC (Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can choose specific ports and protocols to securize with IPSec in the security policies like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 192.168.0.211/24[PORT_NUMBER] 192.168.0.208/24[PORT_NUMBER] PROTOCOL_NAME -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if you want to encrypt only on [[Telnet]] port, on the server your security policies will be:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 0.0.0.0/0[any] 192.168.0.211/24[23] tcp -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.211/24[23] 192.168.0.208/24[any] tcp -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The keyword any means any protocols or any ports.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the IPSec authentication and encryption.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In order to use protocols like TFTP or FTP through the NAT router, you have to activate the support for the protocol you want in Netfilter.&lt;br /&gt;
For instance with the TFTP protocol:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   TFTP protocol support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9345</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9345"/>
		<updated>2011-01-24T13:01:21Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Host PC (Ubuntu) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can choose specific ports and protocols to securize with IPSec in the security policies like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 192.168.0.211/24[PORT_NUMBER] 192.168.0.208/24[PORT_NUMBER] PROTOCOL_NAME -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if you want to encrypt only on [[Telnet]] port, on the server your security policies will be:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
spdadd 0.0.0.0/0[any] 192.168.0.211/24[23] tcp -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.211/24[23] 192.168.0.208/24[any] tcp -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The keyword any means any protocols or any ports.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the IPSec authentication and encryption.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In order to use protocols like TFTP or FTP through the NAT router, you have to activate the support for the protocol you want in Netfilter.&lt;br /&gt;
For instance with the TFTP protocol:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   TFTP protocol support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9344</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9344"/>
		<updated>2011-01-24T10:40:47Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the IPSec authentication and encryption.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In order to use protocols like TFTP or FTP through the NAT router, you have to activate the support for the protocol you want in Netfilter.&lt;br /&gt;
For instance with the TFTP protocol:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   TFTP protocol support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9343</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9343"/>
		<updated>2011-01-24T10:27:42Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Test IPSec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the IPSec authentication and encryption.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9342</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9342"/>
		<updated>2011-01-24T10:26:05Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Target (APF27) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====In the filesystem=====&lt;br /&gt;
* You still have to put the following IPSec configuration file on the target in /etc/ipsec-tools.conf:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=USB_Gadget&amp;diff=9331</id>
		<title>USB Gadget</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=USB_Gadget&amp;diff=9331"/>
		<updated>2011-01-10T15:28:55Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* To emulate an Ethernet link */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Instructions on how to use the USB device (or OTG) port of your Armadeus board to communicate with your PC; ie see your board from your PC like an USB device.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
You can connect your APF board to your PC using its USB Device port ([[APF9328DevFull]]), a modified USB host port ([[APF27Dev]]), or an USB OTG port ([[APF27 PPS]]), and it can be &amp;quot;enumerated&amp;quot; as most common USB devices (depending on the type of communication you want to use):&lt;br /&gt;
* serial device&lt;br /&gt;
* net device&lt;br /&gt;
* mass storage device&lt;br /&gt;
&lt;br /&gt;
=== Hardware/software specifics for the APF27dev and APF27 PPS boards ===&lt;br /&gt;
At first, an USB A male / A male cable has to be used like this one: http://fr.farnell.com/pro-signal/psg90024/lead-usb-2-0-am-am-2m-black/dp/1494745&lt;br /&gt;
&lt;br /&gt;
Do not use USB cable with integrated ferrite bead !!&lt;br /&gt;
&lt;br /&gt;
The APF27dev board is equipped with two USB host ports. Only the high speed Host port (top connector) can be configured as an USB Device.&lt;br /&gt;
&lt;br /&gt;
In order to activate the device mode, a new parameter has to be added to the U-Boot console variable:&lt;br /&gt;
 BIOS&amp;gt; setenv console console=ttySMX0,115200 otg_mode=device&lt;br /&gt;
 BIOS&amp;gt; saveenv&lt;br /&gt;
 BIOS&amp;gt; boot&lt;br /&gt;
&lt;br /&gt;
Your port will now work as an USB device.&lt;br /&gt;
&lt;br /&gt;
{{Warning|DO NOT CONNECT TWO HOST PORTS TOGETHER AND TAKE CARE TO USE THE RIGHT USB PORT ON THE APF27DEV !!}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
* The drivers are now installed by default (since armadeus-3.0)&lt;br /&gt;
* you should have following modules in your kernel source tree:&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/gadgetfs.ko&#039;&#039;&#039;        For test&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_ether.ko&#039;&#039;&#039;         Ethernet emulation on USB&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_file_storage.ko&#039;&#039;&#039;  Mass storage&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_serial.ko&#039;&#039;&#039;        Serial emulation on USB&lt;br /&gt;
 &#039;&#039;&#039;drivers/usb/gadget/g_zero.ko&#039;&#039;&#039;          For test&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
&lt;br /&gt;
===To emulate a mass storage device:===&lt;br /&gt;
* [[USB_Gadget#Links |create]] or get a &amp;quot;backing storage file&amp;quot; ([http://dl.free.fr/q9IKqqweK for example])&lt;br /&gt;
* copy this file (uncompressed) in the &#039;&#039;&#039;/tmp&#039;&#039;&#039; directory of your board (here my Host PC has 192.168.0.20 as IP @):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # tftp -g -r backing_file.gz -l /tmp/backing_file.gz 192.168.0.20&lt;br /&gt;
 # gunzip /tmp/backing_file.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* load &#039;&#039;g_file_storage&#039;&#039; module:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # modprobe g_file_storage file=/tmp/backing_file&lt;br /&gt;
 g_file_storage gadget: File-backed Storage Gadget, version: 28 November 2005&lt;br /&gt;
 g_file_storage gadget: Number of LUNs=1&lt;br /&gt;
 g_file_storage gadget-lun0: ro=0, file: /tmp/backing_file&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* connect target&#039;s USB cable to your PC and, &lt;br /&gt;
On your Linux Host:&lt;br /&gt;
* If you have a recent Linux distribution, your device should be automatically mounted. Otherwise:&lt;br /&gt;
** as root, launch &#039;&#039;dmesg&#039;&#039; and find the &#039;&#039;/dev/sdaX&#039;&#039; device assigned to your board:&lt;br /&gt;
 ... usb 1-1.4: new full speed USB device using uhci_hcd and address 7&lt;br /&gt;
 ... usb 1-1.4: configuration #1 chosen from 1 choice&lt;br /&gt;
 ... scsi1 : SCSI emulation for USB Mass Storage devices&lt;br /&gt;
 ...    Vendor: Linux     Model: File-Stor Gadget  Rev: 0314&lt;br /&gt;
 ...    Type:   Direct-Access                      ANSI SCSI revision: 02&lt;br /&gt;
 ...  SCSI device sda: 8192 512-byte hdwr sectors (4 MB)&lt;br /&gt;
 ...  sda: Write Protect is off&lt;br /&gt;
 ...  SCSI device sda: 8192 512-byte hdwr sectors (4 MB)&lt;br /&gt;
 ...  sda: Write Protect is off&lt;br /&gt;
 ...   sda: sda1&lt;br /&gt;
 ...  sd 1:0:0:0: Attached scsi disk sda&lt;br /&gt;
 ...  sd 1:0:0:0: Attached scsi generic sg0 type 0&lt;br /&gt;
*&lt;br /&gt;
** then mount the device and enjoy file sharing:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo mount /dev/sda1 /mnt/tmp&lt;br /&gt;
 $ cd /mnt/tmp&lt;br /&gt;
 $ showimage /mnt/tmp/test.jpg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To emulate a serial link===&lt;br /&gt;
* On your Host PC:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo modprobe usbserial vendor=0x0525 product=0xA4A6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or you can automate it by modifying &#039;&#039;/etc/modprobe.d/options&#039;&#039; file (Tested on *Ubuntu):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo vim /etc/modprobe.d/options&lt;br /&gt;
  ...&lt;br /&gt;
  options usbserial vendor=0x0525 product=0xA4A6&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* on your APF:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # mknod /dev/ttyGS0 c 249 0   (if not already existing)&lt;br /&gt;
 # modprobe g_serial&lt;br /&gt;
 g_serial gadget: Gadget Serial v2.4&lt;br /&gt;
 g_serial gadget: g_serial ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_serial&lt;br /&gt;
 g_serial gadget: high speed config #2: CDC ACM config&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* then connect the USB cable between your PC and your APF and you should see on your Host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ tail -f /var/log/messages&lt;br /&gt;
 Sep 27 10:06:38 ...  usb 2-1.3: new high speed USB device using ehci_hcd and address 14&lt;br /&gt;
 Sep 27 10:06:38 ...  usb 2-1.3: configuration #2 chosen from 1 choice&lt;br /&gt;
 Sep 27 10:06:38 ...  cdc_acm 2-1.3:2.0: ttyACM0: USB ACM device&lt;br /&gt;
 Sep 27 10:06:38 ...  usbcore: registered new interface driver cdc_acm&lt;br /&gt;
 Sep 27 10:06:38 ...  cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* you should now be able to send/receive data through &#039;&#039;/dev/ttyACM0&#039;&#039; (PC) and &#039;&#039;/dev/ttyGS0&#039;&#039; (APF):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # cat /dev/ttyGS0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus]$ echo &amp;quot;COUCOU&amp;quot; &amp;gt; /dev/ttyACM0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 COUCOU&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===To emulate an Ethernet link===&lt;br /&gt;
* On your Target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 ether gadget: using random self ethernet address&lt;br /&gt;
 ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: Ethernet Gadget, version: May Day 2005&lt;br /&gt;
 usb0: using imx_udc, OUT ep2out-bulk IN ep1in-bulk STATUS ep4in-int&lt;br /&gt;
 usb0: MAC be:df:31:95:16:e0&lt;br /&gt;
 usb0: HOST MAC 3e:86:1e:94:eb:84&lt;br /&gt;
 usb0: RNDIS ready&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Now an IP address has to be assigned to the USB0 ethernet port &lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig usb0 192.168.10.1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* On your PC:&lt;br /&gt;
** On &#039;&#039;&#039;Linux&#039;&#039;&#039; systems:&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;$ sudo modprobe cdc_ether&amp;lt;/pre&amp;gt;&lt;br /&gt;
** On &#039;&#039;&#039;Windows&#039;&#039;&#039; systems: &amp;lt;br/&amp;gt;When the target is detected, you will be asked to give the right driver. &amp;lt;br/&amp;gt;You will find it here: [http://www.armadeus.com/_downloads/apf27_PPS/windrivers/ APF27 PPS Windrivers].&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
&lt;br /&gt;
* http://www.linux-usb.org/gadget/&lt;br /&gt;
* http://www.linux-usb.org/usbtest/#gadgets&lt;br /&gt;
* http://www.linux-usb.org/gadget/file_storage.html&lt;br /&gt;
* http://lxr.linux.no/source/Documentation/usb/gadget_serial.txt&lt;br /&gt;
* [[Serial_Transfer]]&lt;br /&gt;
* http://www.linux-usb.org/usbnet/&lt;br /&gt;
* http://wiki.gp2x.org/wiki/UsbNet_on_Linux&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux drivers]]&lt;br /&gt;
[[Category:USB]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9324</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9324"/>
		<updated>2011-01-07T13:30:42Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: Connection with public/private key&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with password====&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Connection with public/private key====&lt;br /&gt;
You can also connect to your system without needing a password.&lt;br /&gt;
You only have to let the system know your host&#039;s public SSH key.&lt;br /&gt;
&lt;br /&gt;
* First, in directory &#039;&#039;/root&#039;&#039;, on your system, if you don&#039;t have a directory &#039;&#039;.ssh&#039;&#039;, create it:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # mkdir /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you must give it the correct rights:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # chmod 750 /root/.ssh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Now, if not already existing, create the file &#039;&#039;authorized_keys&#039;&#039; in &#039;&#039;/root/.ssh&#039;&#039;:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # touch /root/.ssh/authorized_keys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Edit the file &#039;&#039;authorized_keys&#039;&#039; (with &#039;&#039;&#039;nano&#039;&#039;&#039; for instance) and copy-paste in it your host computer&#039;s public key contained in the file &#039;&#039;~/.ssh/id_dsa.pub&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* You can test your SSH connection by running the following command on your host PC (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh root@192.168.0.3&lt;br /&gt;
The authenticity of host &#039;192.168.0.10 (192.168.0.10)&#039; can&#039;t be established.&lt;br /&gt;
RSA key fingerprint is 7c:4b:e4:9c:6d:ea:6d:ca:ed:36:39:26:91:f9:82:30.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added &#039;192.168.0.10&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The OpenSSH and OpenSSL packages must be selected in Buildroot (if not done by default).&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L $TARGET_PORT:localhost:$HOST_PORT -C $USERNAME@$HOSTNAME -p $VIRTUALPORT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9323</id>
		<title>APF27 PPS</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9323"/>
		<updated>2011-01-07T13:10:36Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* SSH terminal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
PPS is an Armadeus System&#039;s baseboard for the [[APF27]] module. It can be used to implement and securize network applications such as routers and gateways.&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:PPS_recto.jpeg|center|thumb|200px|Front side, you can see dual Ethernet, USB 2.0 Host &amp;amp; OTG, WiFi Antenna, extension connector footprint and power supply]]&lt;br /&gt;
|| [[Image:PPS_verso.jpeg|center|thumb|200px|Back side, with an APF27 module plugged-in]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* [http://www.armadeus.com/english/products-development_boards-apf27_pps.html Product page on Armadeus Systems website]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware/pps_v10.pdf Schematics]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/documentation/pps_datasheet_v0A.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
==Software features==&lt;br /&gt;
There are some network applications/features that are preselected in the PPS baseboard default configuration:&lt;br /&gt;
* Encryption / Security&lt;br /&gt;
** [[SSH|OpenSSH]]&lt;br /&gt;
** [[IPSec / IPTables]]&lt;br /&gt;
* [[USB Gadget#To emulate an Ethernet link|USB Ethernet gadget support]]&lt;br /&gt;
* [[USB Gadget#To emulate a serial link|USB RS232 gadget support]]&lt;br /&gt;
* [[USB to Ethernet adapter|SMSC USB to Ethernet Adapter]]&lt;br /&gt;
* [[Boa|Boa Web Server]]&lt;br /&gt;
* [[WiFi|Wireless tools]] (for securized WiFi with WEP encryption)&lt;br /&gt;
* [[WPA supplicant]] (for securized WiFi with WPA/WPA2 encryption)&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also use the PPS test scripts located in &#039;&#039;/usr/local/pps/scripts&#039;&#039; on the system to test some software functionalities.}}&lt;br /&gt;
&lt;br /&gt;
==SSH terminal==&lt;br /&gt;
The APF27 PPS filesystem is configured to enable SSH connection from a host computer.&lt;br /&gt;
It allows you to access a command terminal of the system through the Ethernet ports.&lt;br /&gt;
&lt;br /&gt;
* The default connection informations are:&lt;br /&gt;
** &#039;&#039;&#039;IP address&#039;&#039;&#039;: 192.168.0.10&lt;br /&gt;
** &#039;&#039;&#039;Login&#039;&#039;&#039;: guest&lt;br /&gt;
** &#039;&#039;&#039;Password&#039;&#039;&#039;: armadeus&lt;br /&gt;
&lt;br /&gt;
* Then you can connect to your system by running the following command on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh guest@192.168.0.10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For more details, refer to the [[SSH#Dropbear|SSH - Dropbear page]] in the Wiki.&lt;br /&gt;
&lt;br /&gt;
==Feature list==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;5&amp;quot; summary=&amp;quot;Hardware Add-Ons by functionnalities&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|- style=&amp;quot;background:#f4f4f4; color:black; -moz-border-radius:18px;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
===Wired communication===&lt;br /&gt;
* [[Uart|UART]]&lt;br /&gt;
* [[SPI]]&lt;br /&gt;
* [[I2C]]&lt;br /&gt;
* [[USB Host]]&lt;br /&gt;
* USB OTG&lt;br /&gt;
* Ethernet&lt;br /&gt;
&lt;br /&gt;
===Wireless communication===&lt;br /&gt;
* [[Wifi|Wifi (b/g)]]&lt;br /&gt;
* [[Libertas driver|Wi2Wi chipset]] (see [[Libertas driver#Wi2Wi chipset|Wi2Wi Section]])&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [[PWM]]: PWM output is on J22 pin 4 &amp;lt;br&amp;gt;(2.8V output, if configured as output)&lt;br /&gt;
* [[GPIO Driver]]&lt;br /&gt;
* [[JTAG]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===FPGA===&lt;br /&gt;
* [[Using FPGA]]&lt;br /&gt;
&lt;br /&gt;
[[Category:DevelopmentBoards]]&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9322</id>
		<title>APF27 PPS</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9322"/>
		<updated>2011-01-07T13:10:00Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: SSH terminal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
PPS is an Armadeus System&#039;s baseboard for the [[APF27]] module. It can be used to implement and securize network applications such as routers and gateways.&lt;br /&gt;
&lt;br /&gt;
{|border=0 summary=&amp;quot;Photos&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
| [[Image:PPS_recto.jpeg|center|thumb|200px|Front side, you can see dual Ethernet, USB 2.0 Host &amp;amp; OTG, WiFi Antenna, extension connector footprint and power supply]]&lt;br /&gt;
|| [[Image:PPS_verso.jpeg|center|thumb|200px|Back side, with an APF27 module plugged-in]]&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* [http://www.armadeus.com/english/products-development_boards-apf27_pps.html Product page on Armadeus Systems website]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware/pps_v10.pdf Schematics]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/documentation/pps_datasheet_v0A.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
==Software features==&lt;br /&gt;
There are some network applications/features that are preselected in the PPS baseboard default configuration:&lt;br /&gt;
* Encryption / Security&lt;br /&gt;
** [[SSH|OpenSSH]]&lt;br /&gt;
** [[IPSec / IPTables]]&lt;br /&gt;
* [[USB Gadget#To emulate an Ethernet link|USB Ethernet gadget support]]&lt;br /&gt;
* [[USB Gadget#To emulate a serial link|USB RS232 gadget support]]&lt;br /&gt;
* [[USB to Ethernet adapter|SMSC USB to Ethernet Adapter]]&lt;br /&gt;
* [[Boa|Boa Web Server]]&lt;br /&gt;
* [[WiFi|Wireless tools]] (for securized WiFi with WEP encryption)&lt;br /&gt;
* [[WPA supplicant]] (for securized WiFi with WPA/WPA2 encryption)&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also use the PPS test scripts located in &#039;&#039;/usr/local/pps/scripts&#039;&#039; on the system to test some software functionalities.}}&lt;br /&gt;
&lt;br /&gt;
==SSH terminal==&lt;br /&gt;
The APF27 PPS filesystem is configured to enable SSH connection from a host computer.&lt;br /&gt;
It allows you to access a command terminal of the system through the Ethernet ports.&lt;br /&gt;
&lt;br /&gt;
* The default connection informations are:&lt;br /&gt;
** &#039;&#039;&#039;IP address&#039;&#039;&#039;: 192.168.0.10&lt;br /&gt;
** &#039;&#039;&#039;Login&#039;&#039;&#039;: guest&lt;br /&gt;
** &#039;&#039;&#039;Password&#039;&#039;&#039;: armadeus&lt;br /&gt;
&lt;br /&gt;
* Then you can connect to your system by running the following command on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh guest@192.168.0.10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For more details, refer to the [[SSH#Dropbear|SSH - Dropbear page] in the Wiki.&lt;br /&gt;
&lt;br /&gt;
==Feature list==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;5&amp;quot; summary=&amp;quot;Hardware Add-Ons by functionnalities&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|- style=&amp;quot;background:#f4f4f4; color:black; -moz-border-radius:18px;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
===Wired communication===&lt;br /&gt;
* [[Uart|UART]]&lt;br /&gt;
* [[SPI]]&lt;br /&gt;
* [[I2C]]&lt;br /&gt;
* [[USB Host]]&lt;br /&gt;
* USB OTG&lt;br /&gt;
* Ethernet&lt;br /&gt;
&lt;br /&gt;
===Wireless communication===&lt;br /&gt;
* [[Wifi|Wifi (b/g)]]&lt;br /&gt;
* [[Libertas driver|Wi2Wi chipset]] (see [[Libertas driver#Wi2Wi chipset|Wi2Wi Section]])&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [[PWM]]: PWM output is on J22 pin 4 &amp;lt;br&amp;gt;(2.8V output, if configured as output)&lt;br /&gt;
* [[GPIO Driver]]&lt;br /&gt;
* [[JTAG]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===FPGA===&lt;br /&gt;
* [[Using FPGA]]&lt;br /&gt;
&lt;br /&gt;
[[Category:DevelopmentBoards]]&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9293</id>
		<title>APF27 PPS</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=APF27_PPS&amp;diff=9293"/>
		<updated>2010-12-23T15:19:20Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Software features */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
This is the Armadeus System&#039;s PPS board/baseboard for the [[APF27]] module.&lt;br /&gt;
This board can be used to implement and securize network applications such as routers and gateways.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* [http://www.armadeus.com/english/products-development_boards-apf27_pps.html Product page]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/hardware/pps_v10.pdf Schematics]&lt;br /&gt;
* [http://www.armadeus.com/_downloads/apf27_PPS/documentation/pps_datasheet_v0A.pdf Datasheet]&lt;br /&gt;
&lt;br /&gt;
==Software features==&lt;br /&gt;
There are some network applications features that are preselect in the PPS board/baseboard configuration:&lt;br /&gt;
* Encryption / Security&lt;br /&gt;
** [[SSH|OpenSSH]]&lt;br /&gt;
** [[IPSec / IPTables]]&lt;br /&gt;
* [[USB Gadget#To emulate an Ethernet link|USB Ethernet gadget support]]&lt;br /&gt;
* [[USB Gadget#To emulate a serial link|USB RS232 gadget support]]&lt;br /&gt;
* [[USB to Ethernet adapter|SMSC USB to Ethernet Adapter]]&lt;br /&gt;
* [[Boa|Boa Web Server]]&lt;br /&gt;
* [[WiFi|Iwconfig (for Wifi securized with WEP encryption)]]&lt;br /&gt;
* [[WPA supplicant|WPA Supplicant (for Wifi securized with WPA/WPA2 encryption)]]&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also use the PPS test scripts located in &#039;&#039;/usr/local/pps/scripts&#039;&#039; on the system to test some software functionalities.}}&lt;br /&gt;
&lt;br /&gt;
==Feature list==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;5&amp;quot; summary=&amp;quot;Hardware Add-Ons by functionnalities&amp;quot;&lt;br /&gt;
|----------------&lt;br /&gt;
|- style=&amp;quot;background:#f4f4f4; color:black; -moz-border-radius:18px;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
===Wired communication===&lt;br /&gt;
* [[Uart|UART]]&lt;br /&gt;
* [[SPI]]&lt;br /&gt;
* [[I2C]]&lt;br /&gt;
* [[USB Host]]&lt;br /&gt;
* USB OTG&lt;br /&gt;
* Ethernet&lt;br /&gt;
&lt;br /&gt;
===Wireless communication===&lt;br /&gt;
* [[Wifi|Wifi (b/g)]]&lt;br /&gt;
* [[Libertas driver|Wi2Wi chipset]] (see [[Libertas driver#Wi2Wi chipset|Wi2Wi Section]])&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===Other===&lt;br /&gt;
* [[PWM]]: PWM output is on J22 pin 4 &amp;lt;br&amp;gt;(2.8V output, if configured as output)&lt;br /&gt;
* [[GPIO Driver]]&lt;br /&gt;
* [[JTAG]]&lt;br /&gt;
&lt;br /&gt;
||&lt;br /&gt;
&lt;br /&gt;
===FPGA===&lt;br /&gt;
* [[Using FPGA]]&lt;br /&gt;
&lt;br /&gt;
[[Category:DevelopmentBoards]]&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9292</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9292"/>
		<updated>2010-12-23T14:29:33Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Test IPTables on APF27 PPS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#Full_NAT_router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9291</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9291"/>
		<updated>2010-12-23T14:28:50Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Full_NAT_router&amp;quot;&amp;gt;&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#full NAT router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9290</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9290"/>
		<updated>2010-12-23T14:26:39Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{anchor|Full NAT router}}&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#full NAT router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9289</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9289"/>
		<updated>2010-12-23T14:23:12Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS]] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#full NAT router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9288</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9288"/>
		<updated>2010-12-23T14:22:46Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#full NAT router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9287</id>
		<title>IPSec / IPTables</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=IPSec_/_IPTables&amp;diff=9287"/>
		<updated>2010-12-23T14:22:29Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: IPSec/IPTables page creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Under Construction}}&lt;br /&gt;
&lt;br /&gt;
IPSec and IPTables are network tools that can be used together to create a VPN between two computers. IPSec securizes the connection as IPTables do the packets routing. The [[APF27 PPS] board is optimized to use these tools.&lt;br /&gt;
&lt;br /&gt;
==IPSec==&lt;br /&gt;
IPSec is a protocol that securizes IP communications by authenticating and crypting packets from IP address to another, over all computer ports.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* You need to install the ipsec-tools package on your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install ipsec-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Give the file &#039;&#039;/etc/ipsec-tools.conf&#039;&#039; the access rights 700:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo chmod 700 /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then edit this file and define the IPSec keys like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/sbin/setkey -f &lt;br /&gt;
&lt;br /&gt;
# NOTE: Do not use this file if you use racoon with racoon-tool &lt;br /&gt;
# utility. racoon-tool will setup SAs and SPDs automatically using &lt;br /&gt;
# /etc/racoon/racoon-tool.conf configuration. &lt;br /&gt;
# &lt;br /&gt;
&lt;br /&gt;
## Flush the SAD and SPD &lt;br /&gt;
# &lt;br /&gt;
flush; &lt;br /&gt;
spdflush; &lt;br /&gt;
&lt;br /&gt;
# Attention: Use this keys only for testing purposes! &lt;br /&gt;
# Generate your own keys! &lt;br /&gt;
&lt;br /&gt;
# AH SAs using 128 bit long keys &lt;br /&gt;
add 192.168.0.211 192.168.0.208	ah 0x200 -A hmac-md5 &lt;br /&gt;
        0xc0291ff014dccdd03874d9e8e4cdf3e6; &lt;br /&gt;
&lt;br /&gt;
add  192.168.0.208 192.168.0.211 ah 0x300 -A hmac-md5 &lt;br /&gt;
        0x96358c90783bbfa3d7b196ceabe0536b; &lt;br /&gt;
&lt;br /&gt;
# ESP SAs using 192 bit long keys (168 + 24 parity) &lt;br /&gt;
&lt;br /&gt;
add 192.168.0.211 192.168.0.208	esp 0x201 -E 3des-cbc &lt;br /&gt;
        0x7aeaca3f87d060a12f4a4487d5a5c3355920fae69a96c831; &lt;br /&gt;
add 192.168.0.208 192.168.0.211	esp 0x301 -E 3des-cbc &lt;br /&gt;
        0xf6ddb555acfd9d77b03ea3843f2653255afe8eb5573965df; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Security policies &lt;br /&gt;
spdadd 192.168.0.211 192.168.0.208 any -P in ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.0.208 192.168.0.211 any -P out ipsec &lt;br /&gt;
           esp/transport//require &lt;br /&gt;
           ah/transport//require; &lt;br /&gt;
&lt;br /&gt;
spdadd 192.168.2.100 192.168.1.100 any -P in ipsec&lt;br /&gt;
           esp/transport//require&lt;br /&gt;
           ah/transport//require;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In this example the host is 192.168.0.211 and the APF27 target is 192.168.0.208 but you must adapt the file to your configuration and create your own keys.}}&lt;br /&gt;
&lt;br /&gt;
{{Note|To generate a 192 bit key you can use the following command: &amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;dd if=/dev/random count=24 bs=1| xxd -ps&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
&lt;br /&gt;
=====Linux=====&lt;br /&gt;
There are some drivers you need to install in Linux Kernel to make IPSec work.&lt;br /&gt;
&lt;br /&gt;
* To configure Linux, go into the BSP directory and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following drivers to install in Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt; &lt;br /&gt;
    Networking options ---&amp;gt; &lt;br /&gt;
        &amp;lt;*&amp;gt; Transformation user configuration interface&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt; PF_KEY sockets&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;*&amp;gt;   IP: AH transformation                                                                                                     	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: ESP transformation                                                                       &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPComp transformation                                                                    &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec transport mode                                                                     &lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec tunnel mode                                                                          	&lt;br /&gt;
        &amp;lt;*&amp;gt;   IP: IPsec BEET mode &lt;br /&gt;
&lt;br /&gt;
[*] Cryptographic API ---&amp;gt;&lt;br /&gt;
    &amp;lt;*&amp;gt;   Null algorithms&lt;br /&gt;
&lt;br /&gt;
      *** Authenticated Encryption with Associated Data ***&lt;br /&gt;
    &amp;lt;*&amp;gt;   CCM support                          &lt;br /&gt;
    &amp;lt;*&amp;gt;   GCM/GMAC support &lt;br /&gt;
&lt;br /&gt;
    {*}   AES cipher algorithms     &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can rebuild Linux like that:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Buildroot=====&lt;br /&gt;
You must install flex and networking packages like [[SSH#OpenSSH|OpenSSH]], OpenSSL and IPSec-tools.&lt;br /&gt;
&lt;br /&gt;
* First run this command to open the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages in the menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] flex      &lt;br /&gt;
&lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools                                                                    &lt;br /&gt;
	[*]   Enable racoonctl(8).                                       &lt;br /&gt;
	[ ]   Enable NAT-Traversal            &lt;br /&gt;
	[*]   Enable IKE fragmentation.&lt;br /&gt;
	[*]   Enable statistics logging function.           &lt;br /&gt;
	[ ]   Enable IPv6 support                                   &lt;br /&gt;
	[ ]   Enable readline input support if available.      &lt;br /&gt;
	[*]   Install IPSec libraries under staging_dir/lib&lt;br /&gt;
&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
	-*-   openssl       &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you want to use IPSec in a NAT router/firewall, you must enable the NAT-Traversal option:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt; &lt;br /&gt;
    [*] Networking &lt;br /&gt;
	[*]   ipsec-tools &lt;br /&gt;
                                    &lt;br /&gt;
	[*]   Enable NAT-Traversal            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Securize the connection===&lt;br /&gt;
Once IPSec is installed and configured on both the system and the host, you have to launch it and activate the keys.&lt;br /&gt;
&lt;br /&gt;
* First on your Host (Ubuntu), you have to reboot the computer or to run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you want to see the generated keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* On the target (APF27), you can run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And you can check the keys with:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -D&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test IPSec===&lt;br /&gt;
* To check that datas are correctly encrypted through the securized connection, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l $USERNAME $HOST_IP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For instance if you want to connect to computer 192.168.0.225 with the user toto:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet -l toto 192.168.0.225&lt;br /&gt;
&lt;br /&gt;
Entering character mode&lt;br /&gt;
Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
Password: &lt;br /&gt;
Last login: Thu Dec 23 14:35:40 CET 2010 from localhost on pts/5&lt;br /&gt;
Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
To access official Ubuntu documentation, please visit:&lt;br /&gt;
http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can also connect without the username. When you are asked to fill the username, it will also be encrypted.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the ESP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ipsec.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==IPTables==&lt;br /&gt;
IPTables is a command-line interface to configure Netfilter. It can allow you to set up the chains and rules of routing in the firewall of a computer. It can also be used to access a public domain from a private network by masquerading the private IP address.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
If you want to use IPTables on your system, you have to configure both Buildroot and Linux.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
* In the BSP directory, run this command to launch the Linux configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In the menu, select the following drivers or modules:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] TCP/IP networking&lt;br /&gt;
        [*]   IP: multicasting&lt;br /&gt;
        [*]   IP: advanced router&lt;br /&gt;
                Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure) (FIB_HASH) ---&amp;gt;&lt;br /&gt;
        [ ]   IP: policy routing&lt;br /&gt;
        [ ]   IP: equal cost multipath&lt;br /&gt;
        [ ]   IP: verbose route monitoring&lt;br /&gt;
&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
            [*] Advanced netfilter configuration&lt;br /&gt;
            [*]   Bridged IP/ARP packets filtering&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    {*} Netfilter Xtables support (required for ip_tables)&lt;br /&gt;
&lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IP tables support (required for filtering/masq/NAT)&lt;br /&gt;
                    &lt;br /&gt;
                    &amp;lt;M&amp;gt;   Packet filtering&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt; ARP tables support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   ARP packet filtering&lt;br /&gt;
                    &amp;lt; &amp;gt;   ARP payload mangling&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note| If you want to use your target as a full NAT router and do masquerading, there are some advanced features you must add to Linux Kernel:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
[*] Networking support ---&amp;gt;&lt;br /&gt;
    Networking options ---&amp;gt;&lt;br /&gt;
        [*] Network packet filtering framework (Netfilter) ---&amp;gt;&lt;br /&gt;
                Core Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; Netfilter connection tracking support&lt;br /&gt;
                    &amp;lt;M&amp;gt;   &amp;quot;state&amp;quot; match support&lt;br /&gt;
               &lt;br /&gt;
                IP: Netfilter Configuration ---&amp;gt;&lt;br /&gt;
                    &amp;lt;M&amp;gt; IPv4 connection tracking support (required for NAT)&lt;br /&gt;
                    [*]   proc/sysctl compatibility with old connectiion tracking&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;M&amp;gt;   Full NAT&lt;br /&gt;
                    &amp;lt;M&amp;gt;     MASQUERADE target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     NETMAP target support&lt;br /&gt;
                    &amp;lt;M&amp;gt;     REDIRECT target support&lt;br /&gt;
                    &amp;lt; &amp;gt;     Basic SNMP-ALG support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can also add other IP tables like &#039;&#039;nat&#039;&#039; and &#039;&#039;mangle&#039;&#039; or new firewall rule options like &#039;&#039;LOG&#039;&#039; or &#039;&#039;REJECT&#039;&#039; in Netfilter page of the Linux configuration menu.}}&lt;br /&gt;
&lt;br /&gt;
* Now you can rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Buildroot====&lt;br /&gt;
* In the BSP directory, launch the Buildroot configuration menu:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Select the following packages for IPTables to be installed on target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package selection for the target ---&amp;gt;&lt;br /&gt;
    [*] Networking ---&amp;gt;&lt;br /&gt;
        [*] iptables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then rebuild Buildroot to generate the rootfs:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===IPTables usage===&lt;br /&gt;
* To learn how to use IPTables to define firewall chains and rules, please refer to the [http://doc.ubuntu-fr.org/iptables Linux Ubuntu Documentation - IPTables].&lt;br /&gt;
&lt;br /&gt;
* You may also want to define routing rules with the command &#039;&#039;route&#039;&#039;. You can refer to the [http://doc.ubuntu-fr.org/routage Linux Ubuntu Documentation - routage] to use it.&lt;br /&gt;
&lt;br /&gt;
===Test IPTables on [[APF27 PPS]]===&lt;br /&gt;
To test IPTables on the target, we will implement a NAT router in the system and use it as a gateway through two computers.&lt;br /&gt;
&lt;br /&gt;
* First you have to enable full NAT and masquerading functionalities in Linux Kernel for your target. Please refer to the [[#full NAT router|Note for full NAT installation]] to set up these options and then rebuild Linux:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make linux26-clean&lt;br /&gt;
 $ make linux26&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Flash the new kernel and rootfs binaries on the target.&lt;br /&gt;
&lt;br /&gt;
* Connect an Ethernet cable from your host Linux to the Ethernet port of the target. &lt;br /&gt;
And connect the USB A-MiniA cable from your host Linux to your target USB OTG port.&lt;br /&gt;
&lt;br /&gt;
* Then you have to activate the target network interface for Ethernet and [[USB Gadget]]:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig eth0 192.168.0.208&lt;br /&gt;
&lt;br /&gt;
 # modprobe -r smsc95xx&lt;br /&gt;
 # modprobe -r g_ether&lt;br /&gt;
 # modprobe g_ether&lt;br /&gt;
 # ifconfig usb0 192.168.2.251&lt;br /&gt;
 Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)&lt;br /&gt;
 ULPI OTG Vendor ID 0x4cc    Product ID 0x1504&lt;br /&gt;
 g_ether gadget: using random self ethernet address&lt;br /&gt;
 g_ether gadget: using random host ethernet address&lt;br /&gt;
 usb0: MAC f6:cf:00:56:1b:64&lt;br /&gt;
 usb0: HOST MAC be:60:d1:56:89:fc&lt;br /&gt;
 g_ether gadget: Ethernet Gadget, version: Memorial Day 2008&lt;br /&gt;
 g_ether gadget: g_ether ready&lt;br /&gt;
 fsl-usb2-udc: bind to driver g_ether&lt;br /&gt;
 g_ether gadget: high speed config #1: CDC Ethernet (ECM)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As the USB gadget interface is connected, you must see the network &#039;&#039;Auto USB&#039;&#039; in your host&#039;s &#039;&#039;Network Connections&#039;&#039;.&lt;br /&gt;
** If you want to make your [[APF27 PPS]] a gateway, you have to use two differents sub-networks for your private network (your computer and the USB gadget interface) and for the remote network (the remote computer and the Ethernet interface).&lt;br /&gt;
** Edit then the &#039;&#039;Auto USB&#039;&#039; network to configure it:&lt;br /&gt;
*** The &#039;&#039;&#039;IP address&#039;&#039;&#039; must be in the same sub-network as the USB Gadget interface : for instance 192.168.2.225.&lt;br /&gt;
*** The &#039;&#039;&#039;Netmask&#039;&#039;&#039; : 255.255.255.0&lt;br /&gt;
*** The &#039;&#039;&#039;Gateway&#039;&#039;&#039; is your target&#039;s USB Gadget interface : here 192.168.2.251.&lt;br /&gt;
*** A &#039;&#039;&#039;DNS server&#039;&#039;&#039;: if you want to browse on Internet through the target. For instance 192.168.0.207.&lt;br /&gt;
*** &#039;&#039;&#039;Search domains&#039;&#039;&#039;: For instance armadeus-office.&lt;br /&gt;
** Then disconnect your host PC and reconnect to the &#039;&#039;Auto USB&#039;&#039; network.&lt;br /&gt;
&lt;br /&gt;
* Add the &#039;&#039;default&#039;&#039; route to be able to go on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # route add default gw 192.168.0.1 eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Configure the IP Advanced router to be able to forward the packets through the target:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # echo &amp;quot;1&amp;quot; &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then you have to create the rules for the NAT router/firewall with iptables:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # iptables -P INPUT ACCEPT&lt;br /&gt;
 # iptables -F INPUT &lt;br /&gt;
 # iptables -P OUTPUT ACCEPT&lt;br /&gt;
 # iptables -F OUTPUT &lt;br /&gt;
 # iptables -P FORWARD DROP&lt;br /&gt;
 # iptables -F FORWARD &lt;br /&gt;
 # iptables -t nat -F&lt;br /&gt;
 nf_conntrack version 0.5.0 (1024 buckets, 4096 max)&lt;br /&gt;
&lt;br /&gt;
 # iptables -A FORWARD -i eth0 -o usb0 -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT&lt;br /&gt;
 # iptables -A FORWARD -j LOG&lt;br /&gt;
&lt;br /&gt;
 # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test the gateway is correctly working, you can ping on the different interface and on the remote computer from your host:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping 192.168.2.251&lt;br /&gt;
 PING 192.168.2.251 (192.168.2.251) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.2.251: icmp_seq=1 ttl=64 time=0.736 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.208&lt;br /&gt;
 PING 192.168.0.208 (192.168.0.208) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.208: icmp_seq=1 ttl=64 time=0.719 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping 192.168.0.1&lt;br /&gt;
 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from 192.168.0.1: icmp_seq=1 ttl=63 time=1.60 ms&lt;br /&gt;
&lt;br /&gt;
 $ ping REMOTE_ADDRESS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have configured your network with a DNS server, you can even ping or browse an URL address on the Internet:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ping www.yahoo.fr&lt;br /&gt;
 PING any-rc.a01.yahoodns.net (87.248.120.148) 56(84) bytes of data.&lt;br /&gt;
 64 bytes from w2.rc.vip.ch1.yahoo.com (87.248.120.148): icmp_seq=1 ttl=49 time=90.3 ms&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If you have the IPSec activated on the remote computer and on your target, you can also securize the connection to the remote computer.&lt;br /&gt;
On the remote computer, put the file /etc/ipsec-tools.conf and run the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo /etc/init.d/setkey start&lt;br /&gt;
 * Flushing IPsec SA/SP database:                                                                    [ OK ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On your target, run:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # setkey -f /etc/ipsec-tools.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Then you can check with Wireshark that all datas going through the securized connection are well encrypted.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [https://help.ubuntu.com/community/IPSecHowTo IPSec HowTo Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/iptables IPTables Ubuntu Documentation]&lt;br /&gt;
* [http://doc.ubuntu-fr.org/routage Routing Ubuntu Documentation]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9286</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9286"/>
		<updated>2010-12-23T13:41:10Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Create SSH tunnel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L $TARGET_PORT:localhost:$HOST_PORT -C $USERNAME@$HOSTNAME -p $VIRTUALPORT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9285</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9285"/>
		<updated>2010-12-23T13:40:43Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Create SSH tunnel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L TARGET_PORT:localhost:HOST_PORT -C USERNAME@HOSTNAME -p VIRTUALPORT&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=WPA_supplicant&amp;diff=9284</id>
		<title>WPA supplicant</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=WPA_supplicant&amp;diff=9284"/>
		<updated>2010-12-23T13:38:24Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Stop it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When dealing with &amp;quot;strong&amp;quot; encryption of WiFi networks, you have to setup a WPA or WPA2 configuration.&lt;br /&gt;
To handle the requirements of these protocols during association, a userspace daemon is needed: it is called a WPA supplicant.&lt;br /&gt;
The most used one on Linux is &#039;&#039;wpa_supplicant&#039;&#039;; we will see here how to install and configure it.&lt;br /&gt;
&lt;br /&gt;
{{Note|wpa_supplicant is also able to handle WEP connections}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Networking  ---&amp;gt;&lt;br /&gt;
        [*]   wpa_supplicant&lt;br /&gt;
        [ ]     Enable WPA with EAP&lt;br /&gt;
        [*]     Install wpa_cli binary&lt;br /&gt;
        [ ]     Install wpa_passphrase binary&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
EAP is only needed if you plan to use WPA in Enterprise mode == with a Radius server.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
wpa_supplicant needs a configuration file in &#039;&#039;/etc/wpa_supplicant.conf&#039;&#039;.&lt;br /&gt;
Here is an example:&lt;br /&gt;
 ctrl_interface=/var/run/wpa_supplicant&lt;br /&gt;
 ctrl_interface_group=wheel&lt;br /&gt;
 network={&lt;br /&gt;
 ssid=&amp;quot;&#039;&#039;SSID&#039;&#039;&amp;quot;&lt;br /&gt;
 scan_ssid=1&lt;br /&gt;
 proto=WPA&lt;br /&gt;
 key_mgmt=WPA-PSK&lt;br /&gt;
 pairwise=TKIP&lt;br /&gt;
 psk=&amp;quot;&#039;&#039;PASSPHRASE&#039;&#039;&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Then you can create the Wifi connexion with WPA Supplicant:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig iwlan0 up&lt;br /&gt;
 # wpa_supplicant -iwlan0 -c /etc/wpa_supplicant.conf -Dwext -B dhclient&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stop it==&lt;br /&gt;
To stop WPA Supplicant daemon and switch off the connexion, you can use this command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # wpa_cli terminate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/README wpa_supplicant README]&lt;br /&gt;
* [http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Wireless]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=WPA_supplicant&amp;diff=9283</id>
		<title>WPA supplicant</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=WPA_supplicant&amp;diff=9283"/>
		<updated>2010-12-23T13:38:00Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When dealing with &amp;quot;strong&amp;quot; encryption of WiFi networks, you have to setup a WPA or WPA2 configuration.&lt;br /&gt;
To handle the requirements of these protocols during association, a userspace daemon is needed: it is called a WPA supplicant.&lt;br /&gt;
The most used one on Linux is &#039;&#039;wpa_supplicant&#039;&#039;; we will see here how to install and configure it.&lt;br /&gt;
&lt;br /&gt;
{{Note|wpa_supplicant is also able to handle WEP connections}}&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
$ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    Networking  ---&amp;gt;&lt;br /&gt;
        [*]   wpa_supplicant&lt;br /&gt;
        [ ]     Enable WPA with EAP&lt;br /&gt;
        [*]     Install wpa_cli binary&lt;br /&gt;
        [ ]     Install wpa_passphrase binary&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
EAP is only needed if you plan to use WPA in Enterprise mode == with a Radius server.&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
wpa_supplicant needs a configuration file in &#039;&#039;/etc/wpa_supplicant.conf&#039;&#039;.&lt;br /&gt;
Here is an example:&lt;br /&gt;
 ctrl_interface=/var/run/wpa_supplicant&lt;br /&gt;
 ctrl_interface_group=wheel&lt;br /&gt;
 network={&lt;br /&gt;
 ssid=&amp;quot;&#039;&#039;SSID&#039;&#039;&amp;quot;&lt;br /&gt;
 scan_ssid=1&lt;br /&gt;
 proto=WPA&lt;br /&gt;
 key_mgmt=WPA-PSK&lt;br /&gt;
 pairwise=TKIP&lt;br /&gt;
 psk=&amp;quot;&#039;&#039;PASSPHRASE&#039;&#039;&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Then you can create the Wifi connexion with WPA Supplicant:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ifconfig iwlan0 up&lt;br /&gt;
 # wpa_supplicant -iwlan0 -c /etc/wpa_supplicant.conf -Dwext -B dhclient&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stop it==&lt;br /&gt;
To stop WPA Supplicant daemon and switch off the connexion, you can use this command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
wpa_cli terminate&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* [http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/README wpa_supplicant README]&lt;br /&gt;
* [http://hostap.epitest.fi/wpa_supplicant/ wpa_supplicant Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Wireless]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9282</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9282"/>
		<updated>2010-12-23T13:36:10Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Test the tunnel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L &#039;&#039;TARGET_PORT&#039;&#039;:localhost:&#039;&#039;HOST_PORT&#039;&#039; -C &#039;&#039;USERNAME&#039;&#039;@&#039;&#039;HOSTNAME&#039;&#039; -p &#039;&#039;VIRTUALPORT&#039;&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&lt;br /&gt;
 Entering character mode&lt;br /&gt;
 Escape character is &#039;^]&#039;.&lt;br /&gt;
&lt;br /&gt;
 Ubuntu 9.10&lt;br /&gt;
 laptop-jeremie-ubuntu login: &lt;br /&gt;
&lt;br /&gt;
 Password: &lt;br /&gt;
 Last login: Tue Dec 21 15:01:50 CET 2010 from localhost on pts/6&lt;br /&gt;
 Linux laptop-jeremie-ubuntu 2.6.31-20-generic-pae #58-Ubuntu SMP Fri Mar 12 06:25:51 UTC 2010 i686&lt;br /&gt;
&lt;br /&gt;
 To access official Ubuntu documentation, please visit:&lt;br /&gt;
 http://help.ubuntu.com/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9281</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9281"/>
		<updated>2010-12-23T13:34:33Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Create SSH tunnel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L &#039;&#039;TARGET_PORT&#039;&#039;:localhost:&#039;&#039;HOST_PORT&#039;&#039; -C &#039;&#039;USERNAME&#039;&#039;@&#039;&#039;HOSTNAME&#039;&#039; -p &#039;&#039;VIRTUALPORT&#039;&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9280</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9280"/>
		<updated>2010-12-23T13:34:04Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Create SSH tunnel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L &#039;&#039;TARGET_PORT&#039;&#039;:localhost:&#039;&#039;HOST_PORT&#039;&#039; -C &#039;&#039;USERNAME&#039;&#039;@&#039;&#039;HOSTNAME&#039;&#039; -p &#039;&#039;VIRTUALPORT&#039;&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
 jeremie@192.168.0.225&#039;s password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
	<entry>
		<id>http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9279</id>
		<title>SSH</title>
		<link rel="alternate" type="text/html" href="http://wikilegacy.armadeus.com/index.php?title=SSH&amp;diff=9279"/>
		<updated>2010-12-22T16:50:00Z</updated>

		<summary type="html">&lt;p&gt;JeremieS: /* Target (Buildroot) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.&amp;lt;br&amp;gt;&lt;br /&gt;
In short, SSH allows you to connect to your board from a remote PC using a secured/encrypted Ethernet connection.&lt;br /&gt;
&lt;br /&gt;
==Dropbear==&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
We use the lightweight Dropbear SSH server. To install it on your rootfs, launch Buildroot configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   dropbear&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then rebuild your system and reflash your board.&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
* If you have reflashed your rootfs with dropbear installed, then at first startup it should generates your private and public keys:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 Generating RSA Key...&lt;br /&gt;
 Will output 1024 bit rsa secret key to &#039;/etc/dropbear/dropbear_rsa_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-rsa ........&lt;br /&gt;
 Fingerprint: md5 82:a2:a3:65:8c:e4:2b:ec:35:27:03:23:2c:f8:91:e9&lt;br /&gt;
 Generating DSS Key...&lt;br /&gt;
 Will output 1024 bit dss secret key to &#039;/etc/dropbear/dropbear_dss_host_key&#039;&lt;br /&gt;
 Generating key, this may take a while...&lt;br /&gt;
 Public key portion is:&lt;br /&gt;
 ssh-dss &lt;br /&gt;
 ........&lt;br /&gt;
 Fingerprint: md5 43:4d:e6:52:df:6b:1f:c3:93:e9:49:e3:92:e7:a1:b2&lt;br /&gt;
 Starting dropbear sshd:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Be sure to have setup a root password on your board. &#039;&#039;&#039;If not then:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 # passwd&lt;br /&gt;
 Changing password for root&lt;br /&gt;
 Enter the new password (minimum of 5, maximum of 8 characters)&lt;br /&gt;
 Please use a combination of upper and lower case letters and numbers.&lt;br /&gt;
 Enter new password: *****&lt;br /&gt;
 Re-enter new password: ******&lt;br /&gt;
 Password changed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* To test your SSH connection, then on your PC launch (replace 192.168.0.3 with your board IP):&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 [armadeus] $ ssh root@192.168.0.3&lt;br /&gt;
 The authenticity of host &#039;192.168.0.3 (192.168.0.3)&#039; can&#039;t be established.&lt;br /&gt;
 RSA key fingerprint is 82:a2:a3:65:8c:e4:2b:xx:xx:xx:xx:xx:2c:f8:91:e9.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
 Warning: Permanently added &#039;192.168.0.3&#039; (RSA) to the list of known hosts.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre class=&amp;quot;apf&amp;quot;&amp;gt;&lt;br /&gt;
 root@192.168.0.3&#039;s password:&lt;br /&gt;
 &lt;br /&gt;
 BusyBox v1.2.2 (2007.06.25-15:53+0000) Built-in shell (ash)&lt;br /&gt;
 Enter &#039;help&#039; for a list of built-in commands.&lt;br /&gt;
 #&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==OpenSSH==&lt;br /&gt;
&lt;br /&gt;
OpenSSH is a tool that allows securized communications between two computers. It can be used to create a securized tunnel between two ports of the connected computers. All datas that go through this tunnel are encrypted.&lt;br /&gt;
&lt;br /&gt;
===Setup===&lt;br /&gt;
&lt;br /&gt;
====Host PC (Ubuntu)====&lt;br /&gt;
* First you have to install telnetd to accept telnet connection from target and Wireshark, a network scanning tool, to check the data encryption :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install telnetd &lt;br /&gt;
 $ sudo /etc/init.d/xinetd restart&lt;br /&gt;
 $ sudo apt-get install wireshark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then install OpenSSH server if necessary :&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo apt-get install openssh-server openssl&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* You now have to configure your OpenSSH server to accept connections from the securized port you will use to mask the real host port over SSH connection.&lt;br /&gt;
To do that, you have to add the port to the file &#039;&#039;/etc/ssh/sshd_config&#039;&#039;.&lt;br /&gt;
For instance, we choose the port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
# Package generated configuration file&lt;br /&gt;
# See the sshd(8) manpage for details&lt;br /&gt;
&lt;br /&gt;
# What ports, IPs and protocols we listen for&lt;br /&gt;
Port 22&lt;br /&gt;
&#039;&#039;&#039;Port 32490&#039;&#039;&#039;&lt;br /&gt;
# Use these options to restrict which interfaces/protocols sshd will bind to&lt;br /&gt;
#ListenAddress ::&lt;br /&gt;
#ListenAddress 0.0.0.0&lt;br /&gt;
Protocol 2&lt;br /&gt;
# HostKeys for protocol version 2&lt;br /&gt;
HostKey /etc/ssh/ssh_host_rsa_key&lt;br /&gt;
HostKey /etc/ssh/ssh_host_dsa_key&lt;br /&gt;
#Privilege Separation is turned on for security&lt;br /&gt;
UsePrivilegeSeparation yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Target (APF27)====&lt;br /&gt;
The packages OpenSSH and OpenSSL must be compiled in Buildroot.&lt;br /&gt;
&lt;br /&gt;
* First launch the Buildroot menu configuration:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make menuconfig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Then select the packages:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;config&amp;quot;&amp;gt;&lt;br /&gt;
Package Selection for the target  ---&amp;gt;&lt;br /&gt;
    [*] Networking  ---&amp;gt;&lt;br /&gt;
        [*]   openssh&lt;br /&gt;
        -*-   openssl&lt;br /&gt;
        [*]      openssl binary&lt;br /&gt;
        [ ]      openssl additional engines&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* And compile your Buildroot with the command:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Create SSH tunnel===&lt;br /&gt;
* On the target, run the following command to create the tunnel between the two machines:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh -fN -L &#039;&#039;TARGET_PORT&#039;&#039;:localhost:&#039;&#039;HOST_PORT&#039;&#039; -C &#039;&#039;USERNAME&#039;&#039;@&#039;&#039;HOSTNAME&#039;&#039; -p &#039;&#039;VIRTUALPORT&#039;&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Enter then the password to connect to your host.&lt;br /&gt;
&lt;br /&gt;
* For instance, if you want to securize the Telnet port 23 toward the address toto@192.168.0.210 with the virtual port 32490:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ ssh -fN -L 23:localhost:23 -C toto@192.168.0.210 -p 32490&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Test the tunnel===&lt;br /&gt;
* To check that datas are correctly encrypted through the tunnel, launch Wireshark on your host PC and put a capture filter on your host address:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 $ sudo wireshark&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If you have securized a Telnet port, you can try to establish a connection between the system and your host with Telnet. &lt;br /&gt;
Run the following command on your system:&lt;br /&gt;
&amp;lt;pre class=&amp;quot;host&amp;quot;&amp;gt;&lt;br /&gt;
 # telnet localhost&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You have to connect to localhost because SSH will automatically redirect it to the address you specified when creating the tunnel.&lt;br /&gt;
&lt;br /&gt;
* When you enter the password to connect to your host, check in Wireshark that you can&#039;t see the protocol name (Telnet in our example) nor the password in the datagrams. You must only see the TCP protocol and crypted datas.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you use an [[APF27 PPS]] configured board, you can use the script &#039;&#039;test_ssh_tunnel.sh&#039;&#039; to test the OpenSSH tunnel.}}&lt;br /&gt;
&lt;br /&gt;
==Links==&lt;br /&gt;
* http://en.wikipedia.org/wiki/Secure_shell&lt;br /&gt;
* [http://matt.ucc.asn.au/dropbear/dropbear.html Dropbear Webpage]&lt;br /&gt;
* [[Telnet | Unsecured remote access with Telnet protocol]]&lt;br /&gt;
* [http://www.openssh.com/ OpenSSH Webpage]&lt;br /&gt;
* [http://www.wireshark.org/ Wireshark Webpage]&lt;br /&gt;
&lt;br /&gt;
[[Category:Network]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>JeremieS</name></author>
	</entry>
</feed>