HowTo Build

Requirements

The following build instructions are intended for a linux based OS. My build system is Ubuntu 11.10 (both 32-bit and 64-bit
should work). You need to have the following development tools for i686 or x64 installed:

  • gcc, g++, make, openjdk-6-jdk, patch, subversion, autoconf, automake, tar, bzip2, gzip, libc6-dev

Download the ARM GNU/Linux EABI cross-compiler arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 and unpack it (as root) to /opt:

# mkdir -p /opt
# tar xvfj /path/to/arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 -C /opt

Download the Java SE Development Kit 1.4.2_19 for Linux and unpack it (as root) to /opt:

# chmod a+x /path/to/j2sdk-1_4_2_19-linux-i586.bin
# cd /opt
# /path/to/j2sdk-1_4_2_19-linux-i586.bin

Download the phoneME sources

Check out phoneME from the subversion repository with this script: checkout

#!/bin/bash
mkdir -p /tmp/phoneme
cd /tmp/phoneme

svn checkout https://svn.java.net/svn/phoneme~svn/legal legal --username guest
for i in javacall pcsl midp cdc tools jpeg abstractions xmlparser restricted_crypto jsr172; do
      svn checkout https://svn.java.net/svn/phoneme~svn/components/$i/trunk $i --username guest
done

Make sure you have about 600 MB of space available in /tmp before your run the script:

# cd /tmp
# sh /path/to/checkout

Apply the patches

Download the following patches:

If you prefer one big path, download this patch instead: all.diff

Apply them as follows:

# cd /tmp/phoneme
# patch -p1

Add additional sources and packages

Download the following archives:

Unpack them as follows:

# cd /tmp/phoneme
# tar xvfz /path/to/xxx.tgz

Build the software

Save the following script: build

#!/bin/bash
export CVM_TARGET_TOOLS_PREFIX=/opt/arm-2011.09/bin/arm-none-linux-gnueabi-
#export CVM_TARGET_TOOLS_PREFIX=/scratchbox/compilers/cs2007q3-glibc2.5-arm7/bin/arm-none-linux-gnueabi-
export WORK_DIR=$PWD
export JAVA_HOME=/opt/j2sdk1.4.2_19
export JAVA_PATH=$JAVA_HOME
export JDK_HOME=$JAVA_HOME
export CVM_JAVABIN=$JAVA_HOME/bin
export CVM_PRELOAD_LIB=true
export JAVAME_LEGAL_DIR=$PWD/legal
export PATH=$JAVA_HOME:$PATH
export CVM_DEBUG=false
export CVM_JIT=true
export USE_AAPCS=true
export J2ME_CLASSLIB=foundation
export CVM_PRELOAD_LIB=true
export USE_MIDP=true
export USE_JPEG=true
export CVM_DUAL_STACK=true
export USE_JUMP=false
export USE_CDC_FILE_PROTOCOL=false
export ENABLE_ISOLATES=true
export USE_MULTIPLE_ISOLATES=true
export CVM_INCLUDE_COMMCONNECTION=true
export CVM_INCLUDE_JAVACALL=false
export USE_SSL=true
export ABSTRACTIONS_DIR=$WORK_DIR/abstractions
export JUMP_DIR=$WORK_DIR/jump
export MIDP_DIR=$WORK_DIR/midp
export PCSL_DIR=$WORK_DIR/pcsl
export TOOLS_DIR=$WORK_DIR/tools
export XMLPARSER_DIR=$WORK_DIR/xmlparser
export JAVACALL_DIR=$WORK_DIR/javacall
export RESTRICTED_CRYPTO_DIR=$WORK_DIR/restricted_crypto

echo "CVM_TARGET_TOOLS_PREFIX=$CVM_TARGET_TOOLS_PREFIX" >> cdc/build/linux-arm-generic/GNUmakefile

rm -rf tools/output
cd cdc/build/linux-arm-generic
make -f GNUmakefile bin VERBOSE_BUILD=true USE_VERBOSE_MAKE=true $@

And run it in /tmp/phoneme:

# cd /tmp/phoneme
# sh /path/to/build | tee build.log

If the compilation succeeds, you can find the binaries zipped together into an archive located in the /tmp/phoneme/cdc/install/ directory.
Note there are several more build steps required before you can run midlets, but you could try to run the test application on your N900 device:

# bin/cvm -cp testclasses.zip Test

This step is only meant to make sure you can produce proper binaries for the ARM platform. If the above test succeeds, you can immediately jump to the next step which is building cvm as a library.

Optional JSR support

To add support for JSR75, add the following parameters in the build script:

export USE_JSR_75=true
export JSR_75_DIR=/tmp/phoneme/jsr75
export JSR_75_PIM_HANDLER_IMPL=java

To add support for JSR179, add the following parameters:

export USE_JSR_179=true

To add support for JSR135, add the following parameters:

export USE_JSR_135=true

Build the libcvm.so library

Run the build script in /tmp/phoneme after setting the CVM_BUILD_SO environment variable:

# cd /tmp/phoneme
# export CVM_BUILD_SO=true
# sh /path/to/build | tee build2.log

This should give you the libcvm.so library instead of the cvm binary in /tmp/phoneme/cdc/build/linux-arm-generic/bin/libcvm.so

Build the custom Qt4-based cvm application

Download these sources:

Make sure you have the Maemo Madde utilities from the Qt SDK in your path, and build the sources with mad:

# export PATH=/opt/qtsdk/Maemo/4.6.2/bin:$PATH
# mad make clean
# mad qmake
# mad make

If you want to build the deb package, run

mad dpkg-buildpackage -b -r -uc -d

Good luck!