Toolchain/fr

From Openmoko

Revision as of 15:57, 7 October 2008 by Pierrebrua (Talk | contribs)

Jump to: navigation, search


Contents

Introduction

Une suite d'outils de développement est un ensemble de logiciels qui permet de compiler du code. Dans le cadre du projet Openmoko, il faut séparer les différents cas qu'on peut rencontrer :

(a) Développer une application unique
Le plus approprié est d'utiliser un environnement de compilation croisée préparé d'avance par le projet Openmoko. Sur cette page vous trouverez une procédure qui décrit pas à pas comment démarrer avec cet environnement, générer un fichier exécutable et le déclencher sur la plateforme choisie. Il se peut que vous ayez entendu parler d' OpenEmbedded mais en tant que développeur d'applications vous ne devriez pas l'utiliser.
(b) Intégration de composants système ou personnalisation d'une distribution logicielle
Pour cela vous devriez utiliser OpenEmbedded qui construit son propre environnement de compilation croisée lors de la phase de construction. L'intégration de composants système et la personnalisation d'une distribution ne sont pas abordés dans cette page.

Utilisation élémentaire de l'environnement de compilation croisée

Prérequis

Pour mettre en place cet environnement, vous devez être à l'aise avec Linux et les outils en ligne de commande ainsi que disposer d'un ordinateur compatible x86 avec au moins 1Go de place libre sur le disque dur. Vous devez avoir l'habitude de compiler des programmes à partir du code source en utilisant le compilateur de votre distribution. La suite de ce document adopte comme hypothèse que vous avez accès en écriture à votre répertoire racine (~) ainsi qu'au répertoire /usr/local (en tant que superutilisateur si besoin). Si ce n'est pas le cas, veuillez contacter l'administrateur système pour assistance.

Dernier point important : vous devez disposer d'un environnement fonctionnel qui permette de compiler des logiciels (en mode natif) par l'intermédiaire des outils de la suite logicielle autotools (le triplet ./configure, make, make install).

Une liste (incomplète?) des logiciels nécessaires -- merci de compléter cette liste au besoin :

  • For most Linux version you might only need to install the packages
    • autoconf, automake
    • binutils, gcc, gcc-c++
    • libtool
    • ccache
    • intltool
  • Pour la distribution Ubuntu 8.04 ( le versions antérieure n'intègrent pas libmokoui2 ) la commande suivante installe les éléments nécessaires :
sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \
ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check
  • Pour la distribution Ubuntu 8.10 la commande additionnelle est requise :
sudo apt-get install uboot-mkimage
  • Pour la distribution Fedora-Core la commande suivante déclenchée en tant que super-utilisateur est nécessaire :
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \
ccache libXrender-devel intltool GConf2-devel mtools gettext-devel

Fedora-Core ne semble pas contenir la bibliothèque libmokoui2.

Téléchargement et installation

NOTE: Si vous désirez améliorer une application existante et que vous avez une distribution Debian ou Ubuntu i386 (i.e. avec des paquets .deb), vous préférerez peut-être éviter la phase suivante et plutôt utiliser la méthode décrite à

Développement d'applications Openmoko en 5 minutes par Andreas Dalsgaard. (procédure basée sur la distribution 2007.2)


La suite d'outils de développement précompilée peut être téléchargée à downloads.openmoko.org:

  • Créez un répertoire de destination pour les logiciels, par exemple :
 mkdir ~/sources
 cd ~/sources
  • Téléchargez le paquet adapté à votre architecture de processeur (x86_64 or i686) :
 wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2
ou
 wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
NOTE: Certaines personnes ont des problèmes avec la version 20080521 des outils. Si vous observez des erreurs, essayez une version différente. (information valide en date du 23 juillet 2008)


Ensuite vous aurez à décompresser ce paquet dans votre système. Cet environnement doit obligatoirement être installé dans le répertoire /usr/local/openmoko/. Vous avez les possibilités suivantes :

  • La décompresser directement en tant que super-utilisateur en utilisant la commande su (ou en préfixant votre commande avec "sudo" si vous utilisez Debian/Ubuntu) :
  cd /
  tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2
  • Sur les variantes de Debian (par exemple Ubuntu), vous pouvez utiliser alien(+fakeroot) pour créer un paquet facile à installer à partir du fichier .tar.bz2 :
  bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2
  gzip openmoko-*-arm-linux-gnueabi-toolchain.tar
  fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz
  sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb
  • La suite de développement précompilée n'est disponible que pour architectures x86_64 ou i686. Si vous le désirez vous pouvez la recréer sous OpenEmbedded avec la commande :
  bitbake meta-toolchain-openmoko

Pour finir, vous devez modifier certaines variables d'environnement pour que les outils utilisés par la suite de développement soient trouvés. La suite de développement intègre un script qui effectue cela, il suffit de l'exécuter via la commande source de votre interpréteur de commande. Si vous n'utilisez pas l'un des interpréteurs "sh" ou "bash" (vous pouvez vérifier avec la commande "echo $SHELL"), vous devez démarrer "sh" ou "bash" d'abord.

. /usr/local/openmoko/arm/setup-env
  • Vous devez au moins ajouter le répertoire /usr/local/openmoko/arm/bin à votre variable d'environnement $PATH, sinon les étapes suivantes (om-conf et make) ne fonctionneront pas.
export PATH=$PATH:/usr/local/openmoko/arm/bin 

Note: Cela ne fonctionnera que pour votre session en cours. Rajoutez cette commande à votre script de démarrage (~/.bashrc par exemple) pour rendre cette modification permanente.

Installation de nouvelles bibliothèques

La suite d'outils Openmoko ne contient pas beaucoup de bibliothèques par défaut. Ceci dit on peut télécharger et installer des bibliothèques complémentaires. Par défaut on utilise le répertoire de paquets Testing pour ces bibliothèques complémentaires.

  • Vous devez modifier certaines variables d'environnement avant de télécharger des bibliothèques complémentaires :
 . /usr/local/openmoko/arm/environment-setup
  • Etape 1 : mise à jour la base de données opkg (Remarque : utilisez l'alias opkg-target et non opkg)
opkg-target update
  • Etape 2 : choisissez un paquet que vous voulez rajouter. Le paquet edje par exemple. Si vous voulez développer un projet qui utilise le composant edje de Enlightenment, vous pouvez utiliser opkg-target list pour afficher les nombreux paquets installables. La commande grep vous sera d'une grande aide.(Rappelez-vous, vous devez installer le paquet -dev package et pas seulement libedje.)
opkg-target list |grep edje-dev
  • Etape 3 : installation
opkg-target install libedje-dev
  • Etape 4 : préparez-vous une tasse de thé et attendez.

Création d'un projet exemple

In a chosen destination directory (in this example ~/):

  • copy the downloaded sample application source:
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
  • Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:
. /usr/local/openmoko/arm/setup-env
  • You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.
om-conf openmoko-sample2
  • Optionally now you can modify the source code in openmoko-sample2/src. Before the next step, go into the sample directory.
cd openmoko-sample2
  • If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh". Otherwise, to build the application from the source code just type:
make
  • If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them. Also see "Troubleshooting" section at the end of this page for known issues.


If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix.

om-conf --prefix=/usr/local/openmoko openmoko-sample2
cd openmoko-sample2
make install

Comment créer son propre projet à partir du projet exemple

In order to build your own project by using openmoko-sample2 files, some changes are needed:

  • copy the downloaded sample application source
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/

  • rename the folder with the name of your project (in this example your-project-name) and delete old sample files
mv openmoko-sample2 your-project-name
cd your-project-name
cd src
rm *.c
  • copy your sources (in this example your-sources) into src/
cp your-sources .
cd ..
  • now in the main folder modify autogen.sh by updating the following lines
PKG_NAME="your-project-name"
  • modify configure.ac by updating the following lines ('main.c' should be the main file in your project)
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/)    
AC_CONFIG_SRCDIR(src/main.c)
  • go into data/ folder and rename these files with the name of your project
cd data
mv openmoko-sample.png your-project-name.png
mv openmoko-sample.desktop your-project-name.desktop
  • modify Makefile.am inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify Makefile.in inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify your-project-name.desktop by updating the following lines
Name=your-project-name
Encoding=UTF-8
Version=0.0.1
Type=Application
Exec=your-project-name
  • and by adding the following line
Icon=your-project-name
  • move into src/ folder
cd ..
cd src
  • modify Makefile.am by updating the following lines
bin_PROGRAMS = your-project-name	
your_project_name_SOURCES = \				
 		main.c 
your_project_name_LDADD  = @DEPENDENCIES_LIBS@
  • be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names

Création du paquet associé à votre application

We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.

om-make-ipkg openmoko-sample2

Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your Neo and install it:

scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202:
ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk

Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.

You can also supply the version number, a description, and an author / contacts string in a control file:

om-make-ipkg myapp myapp_control

A template of myapp_control:

Package: $appname
Version: 0.1
Description: package built by openmoko toolchain
Section: openmoko/applications
Priority: optional
Maintainer: $USER
Architecture: armv4t
Homepage: http://www.openmoko.org/
Depends: 
Source: ${SRC}

Autres articles sur des sujets connexes qui pourront vous intéresser

Using the external toolchain is an easy way to build applications for your Neo. If you are familiar with this procedure, you might also want to look into

==

Compilation du noyau Openmoko à partir de l'entrepôt git en utilisant la suite d'outils

git clone git://git.openmoko.org/git/kernel.git linux-2.6
cd linux-2.6
git checkout -b mystable origin/stable
cp defconfig-gta02 .config
./build

Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"

to:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"

I also had to change the 'build' script to hardcode the path to the compiler.

Utilisation des bibliothèques fournies par la suite d'outils

Add the necessary libraries to the _LDADD field in src/Makefile.am, for example:

openmoko_sample2_LDADD  = @DEPENDENCIES_LIBS@ -lmokogsmd2

make sure to run om-conf again after this.

Ajouter des bibliothèques complémentaires à la suite d'outils

Sooner or later you will want to compile an application that has dependencies which can't be fulfilled by the precompiled toolchain, e.g. some obscure libraries.

In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:

cd ~/source
wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2
tar xjf uriparser-0.6.0.tar.bz2
cd uriparser-0.6.0
./configure --host=arm-angstrom-linux-gnueabi \
--prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr
make
make install

That's it.

Avoir votre application intégrée à OpenEmbedded

If you have written a cool application which you want to share with others, the best way to do that is to

  1. upload your application source code to a public location
  2. submit a BitBake recipe to OpenEmbedded, preferably via the OpenEmbedded bugtracker.

See also Customizing the Openmoko Distribution.

Résolution de problèmes

  • Some Versions of the Toolchain have corrupt .la files. If you compile an application using the Toolchain and you receive a '/space/fic/openmoko-daily/neo1973/work/armv4t-angstrom-linux-gnueabi/pango-1.18.3-r0/pango-1.18.3/pango/libpangoft2-1.0.la' error, you are affected. To fix that you should go to your "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib" directory and open the affected .la files and change "/space/fic..." to "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib". You have to fix more than one .la file. For the pango error you have to change "libpangocairo-1.0.la", but there are more corrupt .la files.

Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:

       #!/bin/sh
       DIR=/usr/local/openmoko/arm
       for la in `find $DIR -iname \*.la`; do
        dependency_libs=
        . $la
        for lib in $dependency_libs ; do
        delib=`echo $lib | grep -E .la$`
        if [ -z $delib ] ; then
         echo -n
        elif [ -f $delib ]; then
         echo -n
        else
         basedelib=`basename $delib`
         replacedelibs=`find $DIR -iname $basedelib`
         found=0
         for replacedelib in $replacedelibs ; do
         if [ $replacedelib == $delib ]; then
          found=1
         fi
         done
         if [ $found -gt 0 ] ; then
          echo -n
         else
           sed_delib=`echo $delib | sed 's/\//\\\\\//g'`
           sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`
           # A bit slow, we could chain expressions for speed. :)
           cp $la $la.old
           cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new
           mv $la.new $la
           rm $la.old
         fi
        fi
        done
       done
  • Merci d'utiliser la liste de diffusion associée au développement Openmoko-Devel.
Personal tools


Introduction

Une suite d'outils de développement est un ensemble de logiciels qui permet de compiler du code. Dans le cadre du projet Openmoko, il faut séparer les différents cas qu'on peut rencontrer :

(a) Développer une application unique
Le plus approprié est d'utiliser un environnement de compilation croisée préparé d'avance par le projet Openmoko. Sur cette page vous trouverez une procédure qui décrit pas à pas comment démarrer avec cet environnement, générer un fichier exécutable et le déclencher sur la plateforme choisie. Il se peut que vous ayez entendu parler d' OpenEmbedded mais en tant que développeur d'applications vous ne devriez pas l'utiliser.
(b) Intégration de composants système ou personnalisation d'une distribution logicielle
Pour cela vous devriez utiliser OpenEmbedded qui construit son propre environnement de compilation croisée lors de la phase de construction. L'intégration de composants système et la personnalisation d'une distribution ne sont pas abordés dans cette page.

Utilisation élémentaire de l'environnement de compilation croisée

Prérequis

Pour mettre en place cet environnement, vous devez être à l'aise avec Linux et les outils en ligne de commande ainsi que disposer d'un ordinateur compatible x86 avec au moins 1Go de place libre sur le disque dur. Vous devez avoir l'habitude de compiler des programmes à partir du code source en utilisant le compilateur de votre distribution. La suite de ce document adopte comme hypothèse que vous avez accès en écriture à votre répertoire racine (~) ainsi qu'au répertoire /usr/local (en tant que superutilisateur si besoin). Si ce n'est pas le cas, veuillez contacter l'administrateur système pour assistance.

Dernier point important : vous devez disposer d'un environnement fonctionnel qui permette de compiler des logiciels (en mode natif) par l'intermédiaire des outils de la suite logicielle autotools (le triplet ./configure, make, make install).

Une liste (incomplète?) des logiciels nécessaires -- merci de compléter cette liste au besoin :

  • For most Linux version you might only need to install the packages
    • autoconf, automake
    • binutils, gcc, gcc-c++
    • libtool
    • ccache
    • intltool
  • Pour la distribution Ubuntu 8.04 ( le versions antérieure n'intègrent pas libmokoui2 ) la commande suivante installe les éléments nécessaires :
sudo apt-get install gcc g++ autoconf automake binutils libtool libglib2.0-dev \
ccache libxrender-dev intltool libmokoui2-dev libgconf2-dev mtools fakeroot alien check
  • Pour la distribution Ubuntu 8.10 la commande additionnelle est requise :
sudo apt-get install uboot-mkimage
  • Pour la distribution Fedora-Core la commande suivante déclenchée en tant que super-utilisateur est nécessaire :
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \
ccache libXrender-devel intltool GConf2-devel mtools gettext-devel

Fedora-Core ne semble pas contenir la bibliothèque libmokoui2.

Téléchargement et installation

NOTE: Si vous désirez améliorer une application existante et que vous avez une distribution Debian ou Ubuntu i386 (i.e. avec des paquets .deb), vous préférerez peut-être éviter la phase suivante et plutôt utiliser la méthode décrite à

Développement d'applications Openmoko en 5 minutes par Andreas Dalsgaard. (procédure basée sur la distribution 2007.2)


La suite d'outils de développement précompilée peut être téléchargée à downloads.openmoko.org:

  • Créez un répertoire de destination pour les logiciels, par exemple :
 mkdir ~/sources
 cd ~/sources
  • Téléchargez le paquet adapté à votre architecture de processeur (x86_64 or i686) :
 wget http://downloads.openmoko.org/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2
ou
 wget http://downloads.openmoko.org/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
NOTE: Certaines personnes ont des problèmes avec la version 20080521 des outils. Si vous observez des erreurs, essayez une version différente. (information valide en date du 23 juillet 2008)


Ensuite vous aurez à décompresser ce paquet dans votre système. Cet environnement doit obligatoirement être installé dans le répertoire /usr/local/openmoko/. Vous avez les possibilités suivantes :

  • La décompresser directement en tant que super-utilisateur en utilisant la commande su (ou en préfixant votre commande avec "sudo" si vous utilisez Debian/Ubuntu) :
  cd /
  tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.tar.bz2
  • Sur les variantes de Debian (par exemple Ubuntu), vous pouvez utiliser alien(+fakeroot) pour créer un paquet facile à installer à partir du fichier .tar.bz2 :
  bunzip2 openmoko-*-arm-linux-gnueabi-toolchain.tar.bz2
  gzip openmoko-*-arm-linux-gnueabi-toolchain.tar
  fakeroot alien -d openmoko-*-arm-linux-gnueabi-toolchain.tar.gz
  sudo dpkg -i openmoko_*-arm-linux-gnueabi-toolchain*.deb
  • La suite de développement précompilée n'est disponible que pour architectures x86_64 ou i686. Si vous le désirez vous pouvez la recréer sous OpenEmbedded avec la commande :
  bitbake meta-toolchain-openmoko

Pour finir, vous devez modifier certaines variables d'environnement pour que les outils utilisés par la suite de développement soient trouvés. La suite de développement intègre un script qui effectue cela, il suffit de l'exécuter via la commande source de votre interpréteur de commande. Si vous n'utilisez pas l'un des interpréteurs "sh" ou "bash" (vous pouvez vérifier avec la commande "echo $SHELL"), vous devez démarrer "sh" ou "bash" d'abord.

. /usr/local/openmoko/arm/setup-env
  • Vous devez au moins ajouter le répertoire /usr/local/openmoko/arm/bin à votre variable d'environnement $PATH, sinon les étapes suivantes (om-conf et make) ne fonctionneront pas.
export PATH=$PATH:/usr/local/openmoko/arm/bin 

Note: Cela ne fonctionnera que pour votre session en cours. Rajoutez cette commande à votre script de démarrage (~/.bashrc par exemple) pour rendre cette modification permanente.

Installation de nouvelles bibliothèques

La suite d'outils Openmoko ne contient pas beaucoup de bibliothèques par défaut. Ceci dit on peut télécharger et installer des bibliothèques complémentaires. Par défaut on utilise le répertoire de paquets Testing pour ces bibliothèques complémentaires.

  • Vous devez modifier certaines variables d'environnement avant de télécharger des bibliothèques complémentaires :
 . /usr/local/openmoko/arm/environment-setup
  • Etape 1 : mise à jour la base de données opkg (Remarque : utilisez l'alias opkg-target et non opkg)
opkg-target update
  • Etape 2 : choisissez un paquet que vous voulez rajouter. Le paquet edje par exemple. Si vous voulez développer un projet qui utilise le composant edje de Enlightenment, vous pouvez utiliser opkg-target list pour afficher les nombreux paquets installables. La commande grep vous sera d'une grande aide.(Rappelez-vous, vous devez installer le paquet -dev package et pas seulement libedje.)
opkg-target list |grep edje-dev
  • Etape 3 : installation
opkg-target install libedje-dev
  • Etape 4 : préparez-vous une tasse de thé et attendez.

Création d'un projet exemple

In a chosen destination directory (in this example ~/):

  • copy the downloaded sample application source:
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
  • Remember to set the proper environment variables (again with "sh" or "bash") for openmoko:
. /usr/local/openmoko/arm/setup-env
  • You need to create a build configuration for this application. This also checks if all needed libraries, tools, etc.. is available on your system. If this fails see the notes about the needed packages in the section "Prerequisites" mentioned earlier.
om-conf openmoko-sample2
  • Optionally now you can modify the source code in openmoko-sample2/src. Before the next step, go into the sample directory.
cd openmoko-sample2
  • If you are using an older version of the toolchain, you may have to create the makefile by running "./autogen.sh". Otherwise, to build the application from the source code just type:
make
  • If there are errors (i.e. "You need to install gnome-common from the GNOME CVS") deal with them. Also see "Troubleshooting" section at the end of this page for known issues.


If you want to install this project on host for staging usage later, a shared library, for example, you can do the following to install it into a given configured prefix.

om-conf --prefix=/usr/local/openmoko openmoko-sample2
cd openmoko-sample2
make install

Comment créer son propre projet à partir du projet exemple

In order to build your own project by using openmoko-sample2 files, some changes are needed:

  • copy the downloaded sample application source
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/

  • rename the folder with the name of your project (in this example your-project-name) and delete old sample files
mv openmoko-sample2 your-project-name
cd your-project-name
cd src
rm *.c
  • copy your sources (in this example your-sources) into src/
cp your-sources .
cd ..
  • now in the main folder modify autogen.sh by updating the following lines
PKG_NAME="your-project-name"
  • modify configure.ac by updating the following lines ('main.c' should be the main file in your project)
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/)    
AC_CONFIG_SRCDIR(src/main.c)
  • go into data/ folder and rename these files with the name of your project
cd data
mv openmoko-sample.png your-project-name.png
mv openmoko-sample.desktop your-project-name.desktop
  • modify Makefile.am inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify Makefile.in inside data/ by updating the following lines
dist_desktop_DATA = your-project-name.desktop
dist_appicon_DATA = your-project-name.png
  • modify your-project-name.desktop by updating the following lines
Name=your-project-name
Encoding=UTF-8
Version=0.0.1
Type=Application
Exec=your-project-name
  • and by adding the following line
Icon=your-project-name
  • move into src/ folder
cd ..
cd src
  • modify Makefile.am by updating the following lines
bin_PROGRAMS = your-project-name	
your_project_name_SOURCES = \				
 		main.c 
your_project_name_LDADD  = @DEPENDENCIES_LIBS@
  • be sure to put instead of main.c all your .c and .h files and modify all the '-' characters with '_' in the variable names

Création du paquet associé à votre application

We have included a script to make an ipkg out of your application. Note that this is not needed to test your application on the Neo (for that you can just scp the resulting binary and data over), however it's very handy if you want to distribute your application to others.

om-make-ipkg openmoko-sample2

Now you got openmoko-sample2_0.1_armv4t.ipk , you can `scp' it to your Neo and install it:

scp openmoko-sample2_0.1_armv4t.ipk root@192.168.0.202:
ssh root@192.168.0.202 opkg install openmoko-sample2_0.1_armv4t.ipk

Note that while you can redistribute the generated ipkg, be aware that this is a bare-bones ipk that contains no further information, i.e. you will lack library dependencies. See below how to fix this.

You can also supply the version number, a description, and an author / contacts string in a control file:

om-make-ipkg myapp myapp_control

A template of myapp_control:

Package: $appname
Version: 0.1
Description: package built by openmoko toolchain
Section: openmoko/applications
Priority: optional
Maintainer: $USER
Architecture: armv4t
Homepage: http://www.openmoko.org/
Depends: 
Source: ${SRC}

Autres articles sur des sujets connexes qui pourront vous intéresser

Using the external toolchain is an easy way to build applications for your Neo. If you are familiar with this procedure, you might also want to look into

==

Compilation du noyau Openmoko à partir de l'entrepôt git en utilisant la suite d'outils

git clone git://git.openmoko.org/git/kernel.git linux-2.6
cd linux-2.6
git checkout -b mystable origin/stable
cp defconfig-gta02 .config
./build

Will fail with error message "arm-angstrom-linux-gnueabi-ld: unrecognized option '-Wl,-rpath-link,/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/lib'" until /usr/local/openmoko/arm/setup-env is modified. LDFLAGS should be changed from:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-rpath-link,${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -Wl,-O1"

to:

export LDFLAGS="-L${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -rpath-link ${OMTOOL_DIR}/arm/arm-angstrom-linux-gnueabi/lib -O1"

I also had to change the 'build' script to hardcode the path to the compiler.

Utilisation des bibliothèques fournies par la suite d'outils

Add the necessary libraries to the _LDADD field in src/Makefile.am, for example:

openmoko_sample2_LDADD  = @DEPENDENCIES_LIBS@ -lmokogsmd2

make sure to run om-conf again after this.

Ajouter des bibliothèques complémentaires à la suite d'outils

Sooner or later you will want to compile an application that has dependencies which can't be fulfilled by the precompiled toolchain, e.g. some obscure libraries.

In that case, feel free to request the inclusion of additional libraries into the next release of the Openmoko toolchain. Until then, here is how you enhance your already installed toolchain. Say, we want to add the library called liburiparse:

cd ~/source
wget http://downloads.sourceforge.net/uriparser/uriparser-0.6.0.tar.bz2
tar xjf uriparser-0.6.0.tar.bz2
cd uriparser-0.6.0
./configure --host=arm-angstrom-linux-gnueabi \
--prefix=/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr
make
make install

That's it.

Avoir votre application intégrée à OpenEmbedded

If you have written a cool application which you want to share with others, the best way to do that is to

  1. upload your application source code to a public location
  2. submit a BitBake recipe to OpenEmbedded, preferably via the OpenEmbedded bugtracker.

See also Customizing the Openmoko Distribution.

Résolution de problèmes

  • Some Versions of the Toolchain have corrupt .la files. If you compile an application using the Toolchain and you receive a '/space/fic/openmoko-daily/neo1973/work/armv4t-angstrom-linux-gnueabi/pango-1.18.3-r0/pango-1.18.3/pango/libpangoft2-1.0.la' error, you are affected. To fix that you should go to your "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib" directory and open the affected .la files and change "/space/fic..." to "/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib". You have to fix more than one .la file. For the pango error you have to change "libpangocairo-1.0.la", but there are more corrupt .la files.

Attached is a beta fix for the .la problem. Untar the .tar.bz2 as root, and execute the following bash script as root:

       #!/bin/sh
       DIR=/usr/local/openmoko/arm
       for la in `find $DIR -iname \*.la`; do
        dependency_libs=
        . $la
        for lib in $dependency_libs ; do
        delib=`echo $lib | grep -E .la$`
        if [ -z $delib ] ; then
         echo -n
        elif [ -f $delib ]; then
         echo -n
        else
         basedelib=`basename $delib`
         replacedelibs=`find $DIR -iname $basedelib`
         found=0
         for replacedelib in $replacedelibs ; do
         if [ $replacedelib == $delib ]; then
          found=1
         fi
         done
         if [ $found -gt 0 ] ; then
          echo -n
         else
           sed_delib=`echo $delib | sed 's/\//\\\\\//g'`
           sed_replacedelib=`echo $replacedelib | sed 's/\//\\\\\//g'`
           # A bit slow, we could chain expressions for speed. :)
           cp $la $la.old
           cat $la | sed "s/$sed_delib/$sed_replacedelib/g" > $la.new
           mv $la.new $la
           rm $la.old
         fi
        fi
        done
       done
  • Merci d'utiliser la liste de diffusion associée au développement Openmoko-Devel.