User Tools

Site Tools


doc:appunti:prog:openmoko_compile

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:prog:openmoko_compile [2009/10/18 09:49] niccolodoc:appunti:prog:openmoko_compile [2009/12/17 12:20] (current) niccolo
Line 83: Line 83:
 I pacchetti vengono installati sotto **''/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/''**. I pacchetti vengono installati sotto **''/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/''**.
  
-==== Compiling a large project: Navit ====+===== Compiling a large project: Navit =====
  
-Please, improve the page [[http://wiki.navit-project.org/index.php/Navit_on_freerunner|Navit on FreeRunner]].+Remember to improve the page [[http://wiki.navit-project.org/index.php/Navit_on_freerunner|Navit on FreeRunner]]
 + 
 +How to cross-compile a large project like Navit for the OpenMoko/FreeRunner, using a GNU/Linux box and the toolchain.
  
 First of all, edit the ''/usr/local/openmoko/arm/environment-setup'' script and add the followig line: First of all, edit the ''/usr/local/openmoko/arm/environment-setup'' script and add the followig line:
Line 93: Line 95:
 </file> </file>
  
-After toolchain installation, install (with **''opkg-target''**) some OpenMoko **''-dev''** packages required to compile Navit:+After toolchain installation, install (with **''opkg-target''**) some OpenMoko **''-dev''** packages required to compile Navit. Depending upon permissions of ''/usr/local/openmoko/'' directory, you may need root privileges:
  
 <code> <code>
 . /usr/local/openmoko/arm/environment-setup . /usr/local/openmoko/arm/environment-setup
 +opkg-target list
 opkg-target install gpsd-dev opkg-target install gpsd-dev
 opkg-target install gtk+-dev opkg-target install gtk+-dev
Line 102: Line 105:
 </code> </code>
  
-Now we check-out Navit sources from the SVN repository and run **''om-conf''** to prepare the ''automake'', ''autoconf'' and ''make'' files to run into the OpenMoko toolchain:+Now we check-out Navit sources from the SVN repository and we make an archive just in case we need the pristine sources in the future:
  
 <code> <code>
 svn co https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit svn co https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit
-om-conf navit+tar zcvf navit-svn-2670.tar.gz navit
 </code> </code>
 +
 +Instead of running the traditional **''./autogen.sh; ./configure''** in the navit source tree, we must run the **''om-conf''** script, which will modify the ''automake'', ''autoconf'' and ''make'' files to run into the OpenMoko toolchain.
 +
 +Because Navit on the OpenMoko FreeRunner requires some configure options, we will pass them to the script. Run ''om-conf'' from the directory containing the source tree (not inside it):
 +
 +<code>
 +om-conf --host=arm-angstrom-linux-gnueabi --enable-avoid-unaligned --enable-avoid-float \
 +    --enable-cache-size=20971520 --with-saxon=saxon-xslt --with-xslts=openmoko \
 +    --enable-svg2png-scaling=16,32,48,96 --enable-svg2png-scaling-flag=32,48 \
 +    navit
 +</code>
 +
 +In the example above we used some **''./configure''** options, among them:
 +
 +**''%%--with-saxon=saxon-xslt%%''**\\ This is because we have the Debian libsaxon-java package, where the executable is called ''saxon-xslt'' instead of ''saxon''.
 +
 +**''%%--enable-svg2png-scaling=16,32,48,96%%''**\\ For each .svg icon, render a png image of the specified size. Images will be named **''icon_XX_YY.png''**.
 +
 +**''%%--enable-svg2png-scaling-flag=32,48%%''**\\ Same as above, but only for country flag icons.
 +
  
 It's time to cross-compile: It's time to cross-compile:
Line 119: Line 142:
  
 === Using the toolchains === === Using the toolchains ===
 +
 +The OpenMoko toolchain provides the **''om-make-ipkg''** utility. It requires the **directory** name where to execute the ''make install'' and the name of the **control file**:
 +
 +<code>
 +. /usr/local/openmoko/arm/environment-setup
 +om-make-ipkg navit navit-control
 +</code>
 +
 +The control file is described [[http://wiki.openmoko.org/wiki/Toolchain#Packaging_your_application|here]].
 +
 +If you need more control files (e.g. a ''postinst'' or alike) you have to tweak with the ''om-make-ipkg'' script.  Here it is the script I use, it looks for the control files into an **''opkg''** directory, so you have to pass just the directory name containing the source tree.
 +
 +<code bash>
 +#!/bin/sh -e
 +
 +error_exit () {
 +        echo usage: $(basename ${0}) [app_dir_name] [ipkg_control_file]
 +        exit 1
 +}
 +
 +test x${OMTOOL_DIR} = x && . /usr/local/openmoko/arm/setup-env
 +. ${OMTOOL_DIR}/arm/scripts/functions
 +S=${1}
 +(test x${S} = x || test ! -d ${S}) && error_exit
 +appname=$(basename ${S})
 +tmpdir=/tmp/${appname}-ipkg-tmp
 +test -e "${tmpdir}" && echo Cannot use ${tmpdir} because it already exists. && exit 1
 +make -C ${S} install DESTDIR="${tmpdir}"
 +# Copy control files to destination directory.
 +cp -pr opkg/* ${tmpdir}
 +ipkg-build -o 0 -g 0 ${tmpdir}
 +rm -rf ${tmpdir}
 +</code>
 +
 +Control files and other files are arranged into the ''opkg'' directory as needed, here it is an example:
 +
 +<code>
 +opkg/CONTROL/postinst
 +opkg/CONTROL/control
 +opkg/etc/rcS.d/S96overcommit_memory.sh
 +</code>
  
 === Using opkg-utils === === Using opkg-utils ===
  
-This is an OpenMoko porting of the ipkg tools. Ipkg is obsolete, you should use opkg, but documentation is scarce.+The **[[http://handhelds.org/moin/moin.cgi/Ipkg|ipkg]]** tool is obsolete, OpenMoko uses the **[[http://wiki.openmoko.org/wiki/Opkg|opkg]]** instead, but documentation is scarce. 
 + 
 +The current opkg code is in [[http://code.google.com/p/opkg/|Google code]], but you can try this one:
  
-Simply do an: 
 <code> <code>
 svn co http://svn.openmoko.org/trunk/src/host/opkg-utils svn co http://svn.openmoko.org/trunk/src/host/opkg-utils
 </code> </code>
-and use the instructions of ipkg's website but the software from this checkout, the opkg-build.+ 
 +and use the instructions of ipkg's website but the software from this checkout. The main script is **''opkg-build''**.
  
 ===== Qemu and the GTA02 FreeRunner ===== ===== Qemu and the GTA02 FreeRunner =====
doc/appunti/prog/openmoko_compile.1255852151.txt.gz · Last modified: 2009/10/18 09:49 by niccolo