Porting EmStar to New Platforms

by The EmStar Team
2004-04-30

Site and Mailing List Search:

Porting EmStar to a new platform involves several tasks. They are:

This page provides some help with some of these tasks.

Cross-compiling GLib

(Submitted by Vlasios Tsiatsis)

There are some instructions about cross compiling in the file glib-2.4.0/docs/reference/glib/html/glib-cross-compiling.html. I used those instructions below.

First, download and extract the glib-2.4.0 package. I assume that you extracted the package is a directory <working dir>.

$ cd glib-2.4.0
$ mkdir obj.i686
$ ./configure --prefix=<working dir>/glib-2.4.0/obj.i686
$ make
$ make install

This will build and install the libraries and some binaries (such as glib-genmarshal) in <working dir>/glib-2.4.0/obj.i686. This step is required for host systems that don't have the GLib executables already installed. Apparently the cross compilation procedure needs at least glib-genmarshal. Since I didn't have this exectuable, I had to build it.

Add <working dir>/glib-2.4.0/obj.i686/bin to your PATH so that glib-genmarshal can be found.

Then configure for the target machine, (e.g. the Xscale-based PASTA node). Create a file pasta.cache in glib-2.4.0 with the following lines:

lib_cv_long_long_format=ll
glib_cv_stack_grows=no
glib_cv_uscore=yes
ac_cv_func_posix_getpwuid_r=yes

I also had to edit file glib/giounix.c and add this define:

#define SSIZE_MAX LONG_MAX

I found that this macro was defined in /usr/local/arm/3.2.3/arm-linux/include/bits/posix1_lim.h, but apparently this header file was not included in giounix.c.

$ chmod a-w pasta.cache  #so that configure cannot overwrite it
$ mkdir obj.pasta
$ ./configure --cache-file=pasta.cache --host=arm-linux --enable-static  --prefix=<working dir>/glib-2.4.0/obj.pasta
$ make
$ make install

The --prefix switch defines the directory where the libraries/executables/header files will be installed. Since these files are for a different platform I put them in a different directory. The --host switch is automaticly performing the replacement of gcc with arm-linux-gcc, ld with arm-linux-ld and so on.

Modifying make.platform

The make/make.platform file encodes various platform specific definitions and linkages. Based on the definitions in this file, and a standard location for your compilers and toolchain, the EmStar build system should be able to build your code for the new platform.

There are only a few important things to change when adding a new platform:

Submitting a New Platform

To submit a new platform, please send patches to make.platform. along with a tar file of the tools you used. We can then patch these changes into the tree and put the tar file on our website so that other people can use EmStar with your platform.