OpenEmbedded GP2X development environment

From wiki.gp2x.org

cnaviroldro

Contents

What is this?

This is a manual for developers who want to setup a build environment which is based on OpenEmbedded. At a later point I will add information on how to make the GP2X ready to install pre-built packages made with OE.

Disclaimer

Can this wreck my GP2X? Yes and you should not follow these steps if have absolutely no idea what this is all about. I do not expect embedded development knowledge but you should be familiar with the shell and the Unix environment.

Furthermore this is not yet ready for prime time. I am not an expert with OpenEmbedded and am sure that there is stuff to be tweaked and fixed. However without doing something one cannot get better. Maybe someone else can fine tune this manual and provide more hints how to do things in a better way.

Preface

OpenEmbedded is a full featured development and package management environment targetted for a wide range of embedded devices. There are many ways to cross compile and package software for a different target architecture. OpenEmbbedded is one attempt to generalize all ideas that are of interest for such an endeavour. When you build your own cross compilation for the GP2X you have an environment that only supports one device in one special configuration (glibc 2.2.5, Linux 2.4, ...). With OpenEmbedded you get all that and much more.

One of the best features is that it allows people (= developers and users) to collaborate. If someone wrote a patch to get a special version of the GCC to compile, then this patch can be easily shared among the other developers. If someone makes additions to the SDL library backend (like hardware accelerated surfaces) this patch can be integrated in the OE build environment which in turn allows the developers to release an IPK file which users can install conveniently.

Vision

For me the GP2X is a small computer with an ARM 200 Mhz CPU and not just a game console. One of the greatest things all modern GNU/Linux distribution have is a package management. It allows users to install software in a convenient way by issuing simple commands. The package management then resolves dependencies and makes sure these are installed before. When you want to get rid of a certain software all the files are removed cleanly from the system.

Free software is developed in a non-centralistic and often completely independent way. With more and more free software developed and maintained every day it becomes increasingly difficult to handle all these programs by the user alone. Without a package management every user had to read the homepage of a program' author to see whether there are new and interesting versions. Today news sites take over this job but you still have to click through a web interface to download a file, unpack it and put it on your SD in order to run an application.

OpenEmbedded maintains over 6000 software packages for various architecture. By cooperating with these people we can benefit from their additions and they can benefit from ours. In the end this will result in the most convenient experience for the user of the software.

I hope that someday there will be a GNU/Linux distribution based on OpenEmbedded for the GP2X. One that not only features libraries, applications and games but also the Linux kernel.

OpenEmbedded documentation

The OE developers have a fine Wiki which explains all the steps that are neccesary to set up the OpenEmbedded build system. If you are new to OE you should read that first and then come back here. Without reading the documentation you will not understand what this is all about. The only thing I suggest at this time is to use the main development branch of OpenEmbedded which is called org.openembedded.dev.

Some things to make life easier

Get the USB Gadget Serial module for the GP2X and run a shell with it. I have copied this stuff into my NAND and am very happy with it. From the GNU/Linux side you can use Minicom to connect to your GP2X.

Furthermore I formatted my SD card with ext2 because libraries need symlinks and symlinks do not work on FAT filesystems. Using this update your GP2X will not access the NAND memory so often, mounts media with the noatime option and brings support for ext2 formatted SD cards.

The OE configuration

For the remainder of this document OE_ROOT denotes the directory where you have prepared your OpenEmbedded installation.

I have written a distribution configuration file named gp2xoe.conf and a build configuration file named local.conf which you may use as a base for your installation. Keep in mind the the local.conf is adjusted to the paths on my computer. I will provide a better base file later. You can download these two files from here.

Building

Now you should choose an application you want to compile for the GP2X. Take a look at the OE_ROOT/org.openembedded.dev/packages folder to get an idea. If you have one, run bitbake nameOfYouApp from the build directory and take a longer nap.

Pimping the GP2X with a package management

Build the ipkg-native package or install the tools from your distribution source (in Gentoo this is named ipkg-utils). If you built the OE variant you have to put the binaries into your path before anything interesting can be done.

Build sed.

In the OE_ROOT/build/tmp/deploy/ipk folder you will find tons of IPK files. Use ipkg-unbuild on libipkg0_0.99.154-r2_arm.ipk and ipkg_0.99.154-r2_arm.ipk to unpack them.

Now copy all IPK files and the libipkg0_0.99.154-r2_arm and ipkg_0.99.154-r2_arm directories to your SD card.

After putting the SD card into the GP2X do the following:

Copy the library file contained in libipkg0_0.99.154-r2_arm/usr/lib to /usr/lib on your GP2X. Copy the contents of ipkg_0.99.154-r2_arm/usr/bin to /usr/bin. With this crude package method you are now able to install the glibc. Do a ipkg-cl install libc6_2.2.5-r5_arm.ipk to perform this.

After this step you are able to install libraries in a clean way (because ldconfig is now part of the system). Do this for libipkg0_0.99.154-r2_arm.ipk and then install ipkg_0.99.154-r2_arm.ipk.

You still notive errors? This is because Busybox' builtin sed is not powerful enough. Install sed_4.1.2-r1_arm.ipk (or the version you built). Now remove the file /bin/sed and create a symlink from /bin/sed.sed to /bin/sed. That is all.

Now your GP2X has a fine package management and is able to install all kinds of IPKs.


Some final words

Currently libraries and software are installed in the 24 MiB big NAND memory. This is very suboptimal. I plan to install a few important libraries into /lib (NAND) and put everything else into /usr/lib which should live on a SD card.

Personal tools