Building JamVM and GNU Classpath and Jikes (for Java support in webOS) with scratchbox2

From WebOS Internals
Revision as of 23:57, 1 January 2012 by Yannick56 (talk | contribs) (add part Links used to do the webOS port)
Jump to navigation Jump to search

NOTE : JamVM doesn't work, there is a problem with segmentation fault to fix

Requirements

First, follow the tutorial WebOS Internals PDK to set up the cross compilation environment.

Next install gcj needed for compiling Gnu Classpath

sudo apt-get install gcj

Compiling

Create your working folder :

cd /home/ubuntu
mkdir java-project
cd java-project

Go in ARM mode in your ScratchBox 2 :

sb2 -M /srv/preware/cross-compile/staging/mapping-armv7

Install GNU Classpath

Create the folders :

mkdir -p /usr/local/bin/
mkdir -p /usr/local/include/
mkdir -p /usr/local/lib/
mkdir -p /usr/local/share/
wget ftp://ftp.gnu.org/gnu/classpath/classpath-0.98.tar.gz
tar xzvf classpath-0.98.tar.gz
cd classpath-0.98
./configure --prefix=/usr/local --disable-examples --without-x --disable-gtk-peer --disable-gconf-peer --disable-plugin --disable-alsa --disable-dssi
make
make install
cd ..

Install Zlib needed by JamVM

cd /srv/preware/cross-compile/packages/common
rm -Rf /srv/preware/cross-compile/packages/common/zlib/build
make -C zlib ARCH=armv7 stage

Install JamVM

cd /home/ubuntu/java-project
wget http://freefr.dl.sourceforge.net/project/jamvm/jamvm/JamVM%201.5.4/jamvm-1.5.4.tar.gz
tar xzvf jamvm-1.5.4.tar.gz
cd jamvm-1.5.4
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_RUN_LIBRARY_PATH=$LD_RUN_LIBRARY_PATH:/usr/local/lib
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" ./configure --prefix=/usr/local --with-classpath-install-dir=/usr/local
make
make install
cd ..

Install Jikes

wget http://freefr.dl.sourceforge.net/project/jikes/Jikes/1.22/jikes-1.22.tar.bz2
bzip2 -d jikes-1.22.tar.bz2
tar xvf jikes-1.22.tar
cd jikes-1.22 
./configure --prefix=/usr/local
make
make install
cd ..

Quit Scratch Box : exit

Installing the files on your device

cd /srv/preware/cross-compile/staging/armv7/usr
sudo chown -R root:root *
sudo tar cvf local.tar *
copy the local.tar on your webos device connected as USB key on your computer

On your computer connect at your webOS device

novacom -t open tty://

Move the files in the good folders :

cd /media/internal
mkdir java-project
mv local.tar java-project
cd java-project
tar Pxvf local.tar
chmod -R 755 *
chown root:root *
cd bin
cp -p * /usr/local/bin
cp -p -r include lib man share /usr/local

Fix missing symbolic links :

cd /usr/local/lib
ln -s libjvm.so.0.0.0 libjvm.so
ln -s libjvm.so.0.0.0 libjvm.so.0
ln -s libz.so.1.2.3 libz.so
ln -s libz.so.1.2.3 libz.so.1
ln -s /usr/local/share/classpath/glibj.zip rt.jar
cd classpath
ln -s libjavaio.so.0.0.0 libjavaio.so
ln -s libjavaio.so.0.0.0 libjavaio.so.0
ln -s libjavalangmanagement.so.0.0.0 libjavalangmanagement.so
ln -s libjavalangmanagement.so.0.0.0 libjavalangmanagement.so.0
ln -s libjavalangreflect.so.0.0.0 libjavalangreflect.so
ln -s libjavalangreflect.so.0.0.0 libjavalangreflect.so.0
ln -s libjavalang.so.0.0.0 libjavalang.so
ln -s libjavalang.so.0.0.0 libjavalang.so.0
ln -s libjavanet.so.0.0.0 libjavanet.so
ln -s libjavanet.so.0.0.0 libjavanet.so.0
ln -s libjavanio.so.0.0.0 libjavanio.so
ln -s libjavanio.so.0.0.0 libjavanio.so.0
ln -s libjavautil.so.0.0.0 libjavautil.so
ln -s libjavautil.so.0.0.0 libjavautil.so.0

Links used to do the webOS port

Patches used for the JamVM port for Iphone http://test.saurik.com/iphone/jamvm/

IPhone Java http://web.archive.org/web/20071230000038/http://iphone.fiveforty.net/wiki/index.php/IPhone_Java

Talk:IPhone Java http://web.archive.org/web/20071230050607/http://iphone.fiveforty.net/wiki/index.php/Talk:IPhone_Java