Labels

06/10/2010

build cross compile tools for overo arm processor

First of all, I need to understand the open-embedded (OE) build system.OE is a software framework to create Linux distributions. OE downloads the source code and cross compiles it for you as needed. OE builds everything from scratch including the cross compilation toolchain.

Depending on your distribution, it is likely you will need to install additional software. If you would like to install these packages up front, the following list includes most of the necessary packages:

git

subversion

gcc

patch (this and gcc are often bundled with other developer tools in the build-essential package)

help2man (Centos 5 package available from atrpms repository)

diffstat

texi2html (texinfo on SUSE)

makeinfo (texinfo on Ubuntu)

ncurses-devel (libncurses5-dev on Ubuntu)

cvs

gawk

python-dev

python-pysqlite2 (python-sqlite2 on SUSE)

unzip

chrpath

ccache

Only the first two packages (git and svn) are required to be installed up front. Otherwise you can proceed and you will be prompted to install needed packages later in the process.

Note 1: If you are using an Ubuntu distribution, it is likely that /bin/sh is linked to /bin/dash. If this is the case, then you will need to change /bin/sh to link to /bin/bash. Neglecting to do this will cause target system init file corruption and your build image will not boot! Run "sudo dpkg-reconfigure dash" and answer no when asked whether you want to install dash as /bin/sh.

Build system checkout

First you'll want to check out the source files for OE build system (roughly 250 MB). With a typical DSL connection this step should take less than 20 minutes. You should have at least 10GB of free space on your hard drive in order to do a complete build of the kernel and root file system images.

These instructions will assume that you are installing the build system in your home directory under "overo-oe". If you decide to put it elsewhere you will need to make appropriate alterations to the steps below.

First we will create the "overo-oe" directory and cd into it:

$ mkdir -p ~/overo-oe$ cd ~/overo-oe

Then we will install the OE metatdata, and check out the Overo branch (you can safely ignore the warnings you will get from the git commands):

Creating the OE configuration files and profile

We now will create a profile script and the configuration files required to tailor OE to our needs.

To make this a somewhat easier task, there is a template for the required files in the OpenEmbedded installation we just did.

Copy these files to your overo-oe directory:

$ cd ~/overo-oe$ cp -r org.openembedded.dev/contrib/gumstix/build .

If you have followed the example installation and placed the build system in overo-oe in your home directory, you are now ready to proceed to the next step. If you have installed the build system in a different location you will need to edit overo-oe/build/profile and change the definition of OVEROTOP as appropriate.

Source code caching

As part of the build process OpenEmbedded downloads source code tarballs for the Linux kernel, compiler, and other software packages. By default this source code cache will be placed in overo-oe/sources. If you would like this cache to be located elsewhere, now is the time to edit build/conf/site.conf and set DL_DIR as appropriate.

Environment setup

OpenEmbedded requires some environment setup in order to function properly. There are a couple of ways to handle this requirement.

OPTION A: BASH PROFILE

With most distributions, adding this environment setup to ~/.bashrc will work for both GUI shells and login shells. If your distribution does not source .bashrc for login shells, you may need to use ~/.bash_profile instead of ~/.bashrc (or modify ~/.bash_profile so that it does source ~/.bashrc).

f you chose Option A for environment setup (bash profile method),·log out/log back in or close your terminal window and open a new one so that the environment changes you enabled above will take effect.

OPTION B: COMMAND LINE SOURCING

If you don't want to modify your standard terminal profile for some reason, you can do this environment setup on a per session basis by sourcing overo-oe/build/profile prior to issuing any build commands:

$ . ~/overo-oe/build/profile

or alternatively:

$ source ~/overo-oe/build/profile

If you chose Option B (command line sourcing), issue the command to source the environment setup.

Your first build

You can build a basic kernel and non-gui root file system image in one step with:

$ bitbake omap3-console-image

If your build machine is missing any essential packages, bitbake will notify you about them at this point. Install the recommended packages and try the bitbake command again. There are many other bitbake targets for different images.

You will also get a message from bitbake suggesting that you install the psyco JIT compiler for better performance. It isn't necessary to install psyco right now, though it is a good idea to install it at some point.

You may also notice another message complaining about not finding user.collection/packages/*/*.bb. Don't concern yourself with this -- you will create this directory later when you create your first package for your own code.

This initial build will take a bit of time since it will need to download all the source code and build the cross compilation tools. Subsequent builds will be much faster. When the build completes, you will find the root file system image and the kernel image in $HOME/overo-oe/tmp/deploy/glibc/images/overo.

Part 2

use oe to build overo system image file.

after bitbake omap3-console-image has been succeed

$cd /overo-oe/tmp/sysroots/x86_64-linux/usr/armv7a/bin/

This folder contains all cross compile tools. We gonna to use the same compile tools to compile Qt compiler and Qt libraries.

On our normal pc, Qt creator compiles programs for i386 processor. These programs could not run in gumstix, because it got ARM processor. In order to solve this problem, we need to re-compile these programs which created in normal pc for ARM processor.

We use the same oe cross compile tools to compile Qt libraries and Qt-ARM-compiler.