Toolchain
From Openmoko
m |
m |
||
Line 21: | Line 21: | ||
mkdir ~/sources | mkdir ~/sources | ||
cd ~/sources | cd ~/sources | ||
− | wget http://downloads.openmoko.org/development/openmoko-Snapshot- | + | wget http://downloads.openmoko.org/development/openmoko-Snapshot-20071130-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 <tt>/usr/local/openmoko/</tt>: | Next, you want to extract it on your filesystem. This toolchain is ''not'' relocatable, it needs to be installed into <tt>/usr/local/openmoko/</tt>: | ||
cd / | cd / | ||
− | tar xjvf ~/sources/openmoko-Snapshot- | + | tar xjvf ~/sources/openmoko-Snapshot-20071130-arm-linux-gnueabi-toolchain.tar.bz2 |
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: | 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: | ||
Line 37: | Line 37: | ||
cd ~/sources | cd ~/sources | ||
− | wget http://downloads.openmoko.org/development/openmoko-Sample-Project- | + | wget http://downloads.openmoko.org/development/openmoko-Sample-Project-20071130.tar.bz2 |
mkdir ~/coding | mkdir ~/coding | ||
cd ~/coding | cd ~/coding | ||
− | tar xjvf ~/sources/openmoko-Sample-Project- | + | tar xjvf ~/sources/openmoko-Sample-Project-20071130.tar.bz2 |
Since this is the first time you configure the project, you need to call <tt>./autogen.sh</tt> instead of the usual <tt>./configure</tt> to configure your sources. | Since this is the first time you configure the project, you need to call <tt>./autogen.sh</tt> instead of the usual <tt>./configure</tt> to configure your sources. | ||
− | cd ~/coding/openmoko-Sample-Project- | + | cd ~/coding/openmoko-Sample-Project-20071130 |
− | ./autogen.sh --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/openmoko/sample | + | ./autogen.sh --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/openmoko/target/sample |
You can then call <tt>make install</tt> to compile the sourcetree and install it into the configured prefix. | You can then call <tt>make install</tt> to compile the sourcetree and install it into the configured prefix. | ||
Line 54: | Line 54: | ||
= Copying the sample project to the device and run it = | = Copying the sample project to the device and run it = | ||
− | Once <tt>make install</tt> finished successfully, your binaries and data will be found in /usr/local/openmoko/sample. You can now copy these onto the device (i.e. over USB ethernet or with an SD card) and run them there. | + | Once <tt>make install</tt> finished successfully, your binaries and data will be found in /usr/local/openmoko/target/sample. You can now copy these onto the device (i.e. over USB ethernet or with an SD card) and run them there. |
= Where to go from here = | = Where to go from here = | ||
− | |||
− | |||
{{todo|write}} | {{todo|write}} | ||
+ | |||
+ | = Advanced topics = | ||
== Installing additional libraries into the toolchain == | == Installing additional libraries into the toolchain == | ||
{{todo|write}} | {{todo|write}} | ||
+ | |||
+ | == Packaging your application == | ||
+ | |||
+ | We have included a script to make an ipkg out of your application. You need to supply the path to the filesystem, a version number, a description, and an author / contacts string. | ||
+ | |||
+ | xgenpackage /usr/local/openmoko/target/sample 1.0 "My Sample Project" "openmoko@openmoko.org" | ||
+ | |||
+ | 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. | ||
+ | |||
+ | {{todo|hint how to get the package included in OE}} | ||
= Troubleshooting = | = Troubleshooting = |
Revision as of 18:12, 27 November 2007
Contents |
Introduction
A toolchain is a set of tools that allows you to compile code. For OpenMoko, we have to differenciate the following use-cases:
- Developing a single application
For this, you should use a prebuilt toolchain from the OpenMoko project. Here you can find a recipe to get started with this toolchain leading you through a series of steps to compile a project and run it on your target device. You might have heard about OpenEmbedded, however as an application programmer, you should not be using OpenEmbedded.
- System Integration and customizing a distribution
For this task, you should use OpenEmbedded which builds its own cross compiler during the bootstrapping/build process. System Integration and customizing a distribution is out of scope of this page.
Prerequisites
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/. If this is not the case, please call your local administrator for help.
Downloading and installing the toolchain
The prebuilt toolchain can be downloaded from [downloads.openmoko.org]:
mkdir ~/sources cd ~/sources wget http://downloads.openmoko.org/development/openmoko-Snapshot-20071130-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/:
cd / tar xjvf ~/sources/openmoko-Snapshot-20071130-arm-linux-gnueabi-toolchain.tar.bz2
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:
source /usr/local/openmoko/setup-environment.sh
Using the toolchain to build a sample project
First, download the sample project and extract it into your filesystem:
cd ~/sources wget http://downloads.openmoko.org/development/openmoko-Sample-Project-20071130.tar.bz2
mkdir ~/coding cd ~/coding tar xjvf ~/sources/openmoko-Sample-Project-20071130.tar.bz2
Since this is the first time you configure the project, you need to call ./autogen.sh instead of the usual ./configure to configure your sources.
cd ~/coding/openmoko-Sample-Project-20071130 ./autogen.sh --host=arm-angstrom-linux-gnueabi --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/openmoko/target/sample
You can then call make install to compile the sourcetree and install it into the configured prefix.
make install
Copying the sample project to the device and run it
Once make install finished successfully, your binaries and data will be found in /usr/local/openmoko/target/sample. You can now copy these onto the device (i.e. over USB ethernet or with an SD card) and run them there.
Where to go from here
TODO: write (See: To-Do List) |
Advanced topics
Installing additional libraries into the toolchain
TODO: write (See: To-Do List) |
Packaging your application
We have included a script to make an ipkg out of your application. You need to supply the path to the filesystem, a version number, a description, and an author / contacts string.
xgenpackage /usr/local/openmoko/target/sample 1.0 "My Sample Project" "openmoko@openmoko.org"
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.
TODO: hint how to get the package included in OE (See: To-Do List) |
Troubleshooting
TODO: write (See: To-Do List) |
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à |