 |
Building phoneME advanced for the Freescale MX31 development board and Linux.
This page describes how to build the phoneME system for the MX31 development board from Freescale, Inc.. These instructions cover how to build for the development board only. If you are looking to port phoneME to an MX31 based device, such as the Mylo, this document may be of interest.
LTIB Toolchain
The mx31 dev board ships with a build tool called LTIB (http://savannah.nongnu.org/projects/ltib/) LTIB uses RPMs and as such is limited in terms of the distributions that it can run on. I did not have success with Gentoo but was able to get it up and running on a Fedora Core 5 instance.
From Host:
$ cat /proc/version
Linux version 2.6.15-1.2054_FC5 (bhcompile@hs20-bc1-3.build.redhat.com) (gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)) #1 Tue Mar 14 15:48:33 EST 2006
Getting LTIB
Available here, http://www.bitshrine.org/#ref_5, I ended up choosing the latest snapshot release from here - http://download.savannah.nongnu.org/releases/ltib/ltib-6.2.2-sv.tar.gz. This left me with a directory called ltib. From there I had to copy the configuration for the mx31 into ltib/config/platform, as it is not installed by default. Now run ./ltib and follow the menu instructions for configuring the toolchain for the MX31. Note to follow the instructions to get yourself in the sudo list if you are not already.
Verifying LTIB
Assuming you already have a bootable environment, we're just going to verify that we can build valid binaries for the target. To do this we will build helloworld for the MX31. Running the binary will give us a rough idea of the health of our build tools. To build helloworld from the ltib directory, execute:
Refer to doc/LtibFaq in your LTIB install directory for specifics.
$ ./ltib -m prep -p helloworld && ./ltib -m scbuild -p helloworld
This will produce a binary executable (ARM) in the directory rpm/BUILD/helloworld-1.0. You can verify the platform a given binary executable was generated for with the linux 'file' program:
# file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
You can get this onto your target environment and execute it. If there are problems, something is wrong with the toolchain.
Adding phoneME package to LTIB.
Now we will add the necessary metadata to LTIB to get it to build phoneME. Refer to the section "---++ How can I add a completely new package to the rootf filesystem" in the doc/LtibFaq for details.
I create a directory in dist/lfs-5.1 named phoneme_advanced. In there I copy the template file and make modifications such that the build section looks like this:
%Build
cd build/linux-arm-mx31
make bin
Adding phoneME source tree to LTIB
Get a snapshot of phoneME (I took the latest from SVN) and place the gzipped tarball in /opt/freescale/pkgs. LTIB will use this tarbal when starting a new build. For now we will let LTIB uncompress it and we will make a few changes.
Starting the LTIB prep stage
First we need LTIB to extract the sources:
./ltib -m prep -p phoneme_advanced
You should see ltib extract the tarball into rpm/BUILD/phoneme_advanced. We will now make some changes in the phoneME source tree.
Lets create our own packaged target. Go into build/ and copy the linux-arm-generic directory to linux-arm-mx31. Now we will modify the make file for the specific hardware characteristics of the MX31 dev board. This information is in addition to what was added to LTIB in a previous step. The following are variables that should be set that are not set in the generic makefile:
CC_ARCH_FLAGS = -msoft-float
CVM_JIT ?= false
CVM_TARGET_TOOLS_PREFIX=/opt/freescale/ltib/usr/spoof/
JDK_HOME=/usr/java/jdk1.5.0_09
CVM_DEFINES += -DAAPCS
# For the LTIB build
HOST_CC := $(BUILDCC)
HOST_CCC := $(BUILDCXX)
Note that you should verify where you have Java installed on your machine. Also, confirm that the directory /opt/freescale/ltib/usr/spoof exists. This is where LTIB puts the cross compilers. Also note that it may be better to distribute some of these settings to other files in the build system.
Build the package
Ok! We are ready to build phoneME from within LTIB now. Go to the root ltib directory and execute:
./ltib -m scbuild -p phoneme_advanced
This will cause ltib to build only the phoneme package from the source tree we just modified. This will take some time, but in the end, you should have Zip file in rpm/BUILD/phoneme_advanced/install. This file can be moved to your target and decompressed. Confirm that your JVM works by going into the directory it creates and execute from Target environment:
./bin/cvm -cp testclasses.zip Test
The happy conclusion should be -
*CONGRATULATIONS: test Test completed with 411 tests passed and 0 failures*
Notes
This is an ongoing process. I would like to get ARM VFP and JIT Compilation enabled, and contributors to phoneME are working with me on this. Any updates I get will be placed back to this page. Feel free to email me with questions and I'll provide help if I can.
|