View source for Toolchain
From Openmoko
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Templates used on this page:
Return to Toolchain.
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page:
Templates used on this page:
Return to Toolchain.
![]() |
Languages: |
English • العربية • Български • Česky • Dansk • Deutsch • Esperanto • Eesti • Español • فارسی • Suomi • Français • עברית • Magyar • Italiano • 한국어 • Nederlands • Norsk (bokmål) • Polski • Português • Română • Русский • Svenska • Slovenčina • Українська • 中文(中国大陆) • 中文(台灣) • Euskara • Català |
A toolchain is a set of tools that allows you to compile code. For Openmoko, we have to differentiate between the following use-cases:
You should be reasonably familiar with Linux and its command line tools, have an x86-compatible computer with at least 1G of free disk space. You should have experience with compiling programs from source using your local compiler. The remainder of this document will also assume you have write access in your home directory (~) and /usr/local/ (becoming root if needed). If any of this is not the case, please call your local administrator for help.
Last but not least you should have a working setup that allows you to compile native software packages using the autotools build system (the triade of ./configure, make, make install).
A (partial) list of required packages -- please append as necessary:
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
sudo apt-get install uboot-mkimage
yum install gcc gcc-c++ autoconf automake binutils libtool glib2-devel \ ccache libXrender-devel intltool GConf2-devel mtools gettext-devel
Fedora-Core does not appear to have libmokoui2 available.
apt-get install build-essential ccache autoconf automake autotools-dev libtool \ gettext intltool curl uboot-mkimage mtools fakeroot alien check libglib2.0-dev \ libxrender-dev libgconf2-dev
NOTE: If you wish to improve an existing Openmoko application and you are running Debian or Ubuntu i386 (i.e. you can install a .deb), you may wish to skip the below and instead use:
Openmoko application development in 5 minutes by Andreas Dalsgaard. (based on the 2007.2 stack) |
The prebuilt toolchain can be downloaded from downloads.openmoko.org:
mkdir ~/sources cd ~/sources
wget http://downloads.openmoko.org/developer/toolchains/openmoko-x86_64-arm-linux-gnueabi-toolchain.tar.bz2 or wget http://downloads.openmoko.org/developer/toolchains/openmoko-i686-arm-linux-gnueabi-toolchain.tar.bz2
Next, you want to extract it on your filesystem. This toolchain is not relocatable, it needs to be installed into /usr/local/openmoko/. Now you have the following options:
cd / tar -xjvf ~/sources/openmoko-XYZ-arm-linux-gnueabi-toolchain.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
bitbake meta-toolchain-openmoko
Finally, everytime you want to use this toolchain, you need to alter some environment variables, so that your tools will be found. The toolchain provides a script to do that, so the only thing you need to do is to source it. Note that if you are not using a "sh" or "bash" shell (check with "echo $SHELL") that you need to start "sh" or "bash" first.
. /usr/local/openmoko/arm/setup-env
export PATH=$PATH:/usr/local/openmoko/arm/bin
Note: This is will only last for your current session. Add it to your shell startup scripts to make it permenant (~/.bashrc for instance).
Openmoko toolchain didn't include many libraries in default. However, it can download and install library what has already existed in Openmoko repository. (It refer to Testing Repository by default.)
. /usr/local/openmoko/arm/environment-setup
opkg-target update
opkg-target list |grep edje-dev
opkg-target install libedje-dev
To build the sample project you need to install libmokoui2-dev and gconf-dbus-dev in your opkg environment. Setup your environment like described there [1]. Now install the libarys with the following command:
opkg-target install libmokoui2-dev gconf-dbus-dev
In a chosen destination directory (in this example ~/):
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
. /usr/local/openmoko/arm/setup-env
opkg-target update opkg-target install libedje-dev opkg-target install packagekit-dev opkg-target install edbus-dev opkg-target install libetk-dev opkg-target install libts-dev
everything should work under the non-root account. Here is a useful link if you have problems with the command below ( https://kerneltrap.org/mailarchive/openmoko-devel/2008/9/17/3318834 )
om-conf openmoko-sample2
cd openmoko-sample2
make
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
In order to build your own project by using openmoko-sample2 files, some changes are needed:
cp -r /usr/local/openmoko/source/openmoko-sample2 ~/
mv openmoko-sample2 your-project-name cd your-project-name cd src rm *.c
cp your-sources . cd ..
PKG_NAME="your-project-name"
AC_INIT(your-project-name, 0.0.1, http://www.openmoko.org/) AC_CONFIG_SRCDIR(src/main.c)
cd data mv openmoko-sample.png your-project-name.png mv openmoko-sample.desktop your-project-name.desktop
dist_desktop_DATA = your-project-name.desktop dist_appicon_DATA = your-project-name.png
dist_desktop_DATA = your-project-name.desktop dist_appicon_DATA = your-project-name.png
Name=your-project-name Encoding=UTF-8 Version=0.0.1 Type=Application Exec=your-project-name
Icon=your-project-name
cd .. cd src
bin_PROGRAMS = your-project-name your_project_name_SOURCES = \ main.c your_project_name_LDADD = @DEPENDENCIES_LIBS@
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}
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
You may build the newest 2.6.28 kernel with these commands:
git clone git://git.openmoko.org/git/kernel.git linux-2.6 cd linux-2.6 git checkout -b mystable origin/andy-tracking mkdir GTA02 cp arch/arm/configs/gta02_moredrivers_defconfig GTA02/.config ./build GTA02 dummy
The dummy option is required for the modules to be nicely packaged into a .tar.gz package that can be extracted on the target, in addition to flashing/installing the kernel. The "dummy" just means "some parameter given", for which there is a check in the code eventually for some reason...
You may need to edit the ./build script for the toolchain directory.
Read more information about the different branches of Openmoko's Linux kernel at: http://git.openmoko.org/?p=kernel.git;a=summary
A different approach explained in more detail can be found at Howto compile Openmoko kernel for Neo Freerunner.
If it fails 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.
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.
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.
If you have written a cool application which you want to share with others, the best way to do that is to
See also Customizing the Openmoko Distribution.
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
../libtool: X--tag=CC: command not found
under Ubuntu 8.10. Try do this:
sudo apt-get remove libtool
wget http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_i386.deb
or
wget http://ftp.sjtu.edu.cn/ubuntu/pool/main/libt/libtool/libtool_1.5.26-1ubuntu1_amd64.deb
sudo dpkg -i libtool_1.5.26-1ubuntu1_i386.deb
The original message here