OpenEmbedded Howto

Posted by on 2009-12-03 in mini2410-howto, mini2440-howto

MINI2440 Openembedded Howto

Version 1.0 Date: 10.09.2009

Introduction

First of all thank you very much for your interest in the mini2440 development! You probably are reading this because you are planning to create your own cool application using the mini2440 environment. You realized that the pre-installed android OS is cool and nifty, but too overdressed and/or too phoneish for your needs.

What we would like to show you here is a basic setup for your development that let you focus on your application rather than taking care of toolchains, dependencies etc.

Purpose

This document is meant to provide you with an overall insight in how to build software for the mini2440 using the openembedded environment. It is not an in detail explanation of how the openembedded environment works or the bitbake tool, please refer for this to www.openembedded.org.

Requirements

For successfully repetition of the following steps you’ll need a working Linux environment. Either as installed on your workstation or as a guest operating system in Virtualbox. You can obtain virtualbox for free form virtualbox.org As operating system all current Linux distributions will work, we tested successfully on DEBIAN, Ubuntu, OpenSuse and Fedora Core. Please consult the manual of virtualbox and/or your chosen Linux distribution in how to install Linux. Debian has shown to be the easiest choice, and you wouldn’t make anything wrong in using it, on the contrary.

You will also need approx. 30GB of hard disk storage so keep this in mind when you setup your virtual linux.

When you install linux please make sure you also install the following software packages:

  • python 2.4 or 2.5
  • psyco (if your linux distribution does not offer this, download from http://psyco.sourceforge.net/introduction.html )
  • git
  • GNU patch
  • GNU m4
  • GNU make
  • ccache
  • perl
  • diffstat
  • wget
  • ftp
  • svn
  • cvs
  • curl
  • md5sum
  • sha256sum
  • tar
  • bzip2
  • gzip
  • unzip
  • help2man
  • texinfo
  • texi2html

We also strongly advise to install the libsdl headers to be able to install/run the native qemu. Under DEBIAN it would be

apt install libsdl1.2-dev 

Installation

From this point on we need to have a running Linux environment and a basic understanding in how to use a terminal. So log into your Linux box and open a terminal.

Type in the following commands:

mkdir -p mini2440/build/conf ↩  cd mini2440 ↩ 

Now we are going to download the bitbake tool, which is openembedded’s >>make<< utility, you’ll use it a lot! please download the latest stable version from developer.berlios.de/projects/bitbake/

You can do so by typing:

wget http://prdownload.berlios.de/bitbake/bitbake-1.8.12.tar.gz ↩ 

extract the package with:

tar xzf bitbake-1.8.12.tar.gz ↩ 

and rename it with:

mv bitbake-1.8.12 bitbake ↩ 

create an empty file called source-me.txt

touch source-me.txt ↩ 

open it with an editor like vi, pico

pico source-me.txt ↩ 

copy from the appendix source-me.txt into pico. and save the result of your hard labor.

Congratulations, the first step is done! Now its time for a decision.

Stable

At this point you have to choose if you want to develop along with the cutting edge of mini2440’s Linux development or if you would prefer the stable branch. At the date of writing you can choose now between Linux verion 2.6.31x, which is considered stable or 2.6.31rcX which is considered development status.

To check out the stable version you issue the command

git clone git://repo.or.cz/openembedded/mini2440.git openembedded ↩ 

If you want one of the dev branches ( have a look with git branch -a ) make sure you checkout one of these…

After execution you’ll find a directory openembedded in your mini2440 folder.

Setting up OpenEmbedded

First you’ll have to copy a configuration file, that’s done by

cp openembedded/conf/local.conf.sample build/conf/local.conf  ↩ 

as you can see this is just a sample configuration file, you’ll have to edit it to your needs. You can do that with your editor of choice:

pico build/conf/local.conf  ↩ 

Please read the file #carefully# and I mean that. Set the following entries:

BBFILES = "${OETREE}/openembedded/recipes/*/*.bb" DISTRO  = "angstrom-2008.1" MACHINE = "mini2440" 

That’s it! Congratulation you mastered the second step.

Building u-boot

If you want to build u-boot for your mini2440, please take the following these steps: change to your mini2440 directory, once inside execute

source source-me.txt  ↩ 

the script catapults you into your mini2440/build directory. here you issue the command

bitbake u-boot  ↩ 

If this is your first time compiling software using openembedded you really can go home now. No i mean that, openembedded is going to download tons of software, you really don’t want to waste your time waiting for it. Best is, you start doing so, just before leaving office and let your workstation do the job over night. If you’re lucky and have a big connection to the internet you might considering waiting, however, don’t complain that there is no Pizza Service at 1:00h AM. But luckily this has to be done only once.
If all went smoothly you’ll find your u-boot binary in mini2440/build/tmp/deploy/images/glibc/mini2440/u-boot-mini2440-x.bin

But what if you are not happy with the provided u-boot? How to make changes?

Changes in OE

In your mini/build/tmp directory you’ll find a folder called work. Inside there you will find a folder u-bootXXX there inside is a folder git and this is where you can make changes to the sources.

you recompile it with:

bitbake -f -c compile u-boot ↩ 

be sure you changed back to the build directory… When the compilation is done, you should issue

bitbake u-boot ↩ 

This time it will update your deploy directory with the successfully compiled binary… This is a great feature esp. if you think of doing so when you create root images or kernels with modules etc. everything is just up to date, fantastic!

Building the kernel

Bulding the Linux kernel under OpenEmbedded is a piece of cake

bitbake virtual/kernel ↩ 

is all you have to do. And gain, if you want to do some customizations on your kernel a

bitbake -f -c compile virtual/kernel ↩ 

will do the job. DOn’t forget here to issue an additional

bitbake virtual/kernel ↩ 

which will create the modules and the uimage for you.

Building a root image

Building a root image and the installed applications in it depends obviously on your application. please have a look in openembedded/recipies/images/ to get a glimpse of what is possible. However not all images are suitable for the mini2440. A good start might be the minimal-image, and the console-image.

ipkg feeds server side

With ipkg you are able to install later whatever package you might need. For that you want to set up an apache serving your packages. Setting up an Apache webserver is out of the scope of this document.

Once you have your apache running, create a virtual host pointing to your mini2440/build/tmp/deplay/glibc/ipkg folder. Make also sure that your webserver has read access on those directories. In this example I created a virtual host ipkg.hiteg.local our server comes with DNS service and DHCPD. If you setup your device do either an DHCP setup on your local server or make sure that the device knows your server by editing the /etc/hosts file.

make sure that you periodically execute

bitbake package-index ↩ 

whenever you changed or added files. Look into your local.conf file, there you have also the opportunity to specify where openembedded puts the created packages and images. The variable TMPDIR would have to be changed for that. And because we speak about this, whenever you issue an git pull in openembedded you might encounter that the angstrom revision changed bitbake than wants you to recompile, rebuild everything. That’s quiet fine, but you might have sources which should not been deleted. It would be advisable to add ${DISTRO_PR} somewhere in your TMPDIR path. I do it like this:

TMPDIR = /storage/OE/build/angstrom${DISTRO_PR} 

ipkg device side

On your mini2440 you would have to do the following changes.

  • Clear out /var/ipkg/ directory
  • Clear out /etc/ipkg/ directory except for arch.conf
  • Add to /etc/ipkg the following files:

    • /etc/ipkg/all-feed.conf, contains the line:

      src/gz all http://ipkg.hiteg.local/all

    • /etc/ipkg/armv4t-feed.conf, contains:

      src/gz armv4t http://ipkg.hiteg.local/armv4t

    • /etc/ipkg/mini2440-feed.conf, contains:

      src/gz mini2440 http://ipkg.hiteg.local/mini2440

On the device as root run the command:

ipkg update ↩ 

You should now be able to list, install packages from your openembedded tree.

C/C++ Development IDE’s

This depends on what you want to develop, and which GUI platform you are going to use.

If you decide to go with GPE/GTK+ than you might want to use Anjuta as your IDE, there is a nice openembedded plugin available which makes life quiet easy, check it out.

If you prefer QT you’ll have to go with KDevelop/QT Designer for a smooth development.

And Eclipse seems to be always a clever choice too, when it comes to non-gui related development.

Debugging

OpenOCD is the JTAG environment of choice for the mini2440. In the appendix you’ll find two config files one for the parallel port adapter shipped with the mini2440 and one for the o-link USB adapter avail able on www.developmentboard.net. The latter might be a good choice for application debugging, the former is enough if you just want to bootstrap the mini in case something bad had happened.

However there is another alternative to real hardware at this point, and this is the qemu. This little feller simulates/emulates an mini2440 nearly 100% and comes with an GDB debugger build in. The fastest way to terminate any varmint in your area, the “überPesticide”. Honestly, you don’t want to miss it, the only downpart is that I, up to now, did not figure out how to let qemu polish my furniture, otherwise, EXCELLENT! Again, don’t miss it! Look here: http://code.google.com/p/mini2440/wiki/QEmuSDCardImage the git repository for mini2440 qemu can be found here: http://repo.or.cz/w/qemu/mini2440.git

Appendix

source_me.txt

export OETREE="${PWD}"   BBPATH=${OETREE}/:${OETREE}/build/:${OETREE}/openembedded/ PKGDIR=${OETREE}/build/  DL_DIR=${OETREE}/downloads echo Setting up dev env for MINI2440  if [ -z ${ORG_PATH} ] ; then     ORG_PATH=${PATH}     export ORG_PATH fi  if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then     ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}     export ORG_LD_LIBRARY_PATH fi  PATH=${OETREE}/bitbake/bin:${ORG_PATH}  cd $PKGDIR  LD_LIBRARY_PATH= export PATH LD_LIBRARY_PATH BBPATH export LANG=C export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"  echo "Altered environment for OE Development" 

openOCD config USB (openJTAG)

telnet_port 4444 gdb_port 2001  interface ft2232 jtag_speed 0 ft2232_vid_pid 0x1457 0x5118 ft2232_layout "jtagkey_prototype_v1" jtag_device 4 0x1 0xf 0xe ft2232_device_desc "USB<=>JTAG&RS232"  source [find target/samsung_s3c2440.cfg]  telnet_port 4444 gdb_port 3333  reset_config trst_and_srst 

openOCD config PARALLEL port (wiggler)

telnet_port 4444 gdb_port 2001  interface parport parport_port 0x378 parport_cable triton jtag_speed 0   source [find target/samsung_s3c2440.cfg]  telnet_port 4444 gdb_port 3333  reset_config trst_and_srst srst_pulls_trst 

Leave a reply