Porting EmStar to New Platforms
|
|
Site and Mailing List Search:
|
Porting EmStar to a new platform involves several tasks. They are:
-
Modify make/make.platform to set up the appropriate settings for your platform: e.g. kernel headers, flags, and so on.
-
Cross-compile GLib for your new platform.
-
Bundle up your compiler, kernel headers, modifications to make.platform and cross-compiled GLib and submit them to us for inclusion!
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:
-
Define the toolchain "root". Typically the toolchain is bundled in a single directory that includes the compiler and the kernel headers. Most platforms define a variable that refers to the root of this tree.
-
Redefine CC, AR, LD, etc. Each platform has an if clause that defines these variables to point to the appropriate binaries in the toolchain.
-
Define KCFLAGS to point to the correct kernel headers. KCFLAGS is added to compilations of kernel sources, and needs to include the path of the kernel headers.
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.