Getting Java on Openmoko
September 13th, 2008 By recluze

This post is an experience report on porting java on openmoko. This includes many pastes from other locations, so, this might be ugly to look at. First, I describe how we tried building Kaffe for openmoko. The openmoko devel environment includes kaffe-1.1.5, so make build-package-kaffe-gtk got it started. Some problems were faced which were addressed by looking at these two patches. (Bold text marks changes). I’ve lost the links to the posts but you can find them easily by searching for titles (or author names).

Patch 1 applied:
-----------------------------------------------
[kaffe] [PATCH] JIT on arm
Sascha Hauer s.hauer at pengutronix.de
Wed Oct 4 01:23:18 PDT 2006
Previous message: [kaffe] Kaffe porting on MIPS
Next message: [kaffe] Swing not supporting with kaffe+Nano-X
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all,
There is a comment in config/arm/linux/md.c which claims that Kernel 2.6
needs a VM_EXEC flag. Fact is that 2.6 never needed this flag, but since
2.6.9 it no longer ignores it.
I have two patches attached, the first one is the change in between 2.6.8
and 2.6.9 and the second one puts the arm jit back into business for kernels
>2.6.9
Have fun,
Sascha
diff -purN linux-2.6.8/arch/arm/kernel/traps.c linux-2.6.9/arch/arm/kernel/traps.c
--- linux-2.6.8/arch/arm/kernel/traps.c 2004-08-14 07:36:56.000000000 +0200
+++ linux-2.6.9/arch/arm/kernel/traps.c 2004-10-18 23:53:51.000000000 +0200
@@ -381,7 +381,7 @@ do_cache_op(unsigned long start, unsigne
{
struct vm_area_struct *vma;
- if (end < start)
+ if (end < start || flags)
return;
vma = find_vma(current->active_mm, start);
Index: kaffe-1.1.7/config/arm/linux/md.c
===================================================================
--- kaffe-1.1.7.orig/config/arm/linux/md.c
+++ kaffe-1.1.7/config/arm/linux/md.c
@@ -35,7 +35,7 @@ init_md(void)
void flush_dcache(void *start, void *end) {
__asm __volatile ("mov r0, %0\n"
"mov r1, %1\n"
- "mov r2, #4\n" /* this is VM_EXEC from linux/mm.h, needed for Kernel 2.6 */
+ "mov r2, #0\n"
"swi " __sys1(__ARM_NR_cacheflush) "\n"
: /* no return value */
: "r" ((long)start), "r" ((long)end)
--------------------------------
patch 2 appliedd
-----------------------------------------
[kaffe] CVS kaffe (robilad): build fix for arm linux interpreter
Kaffe CVS cvs-commits at kaffe.org
Sat Jan 26 17:52:02 PST 2008
Previous message: [kaffe] OpenSuse 10.3 - Kaffe compile make/ls/grep error
Next message: [kaffe] CVS kaffe (robilad): removed no longer needed cvsignore file
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
PatchSet 7720
Date: 2008/01/27 01:50:20
Author: robilad
Branch: HEAD
Tag: (none)
Log:
build fix for arm linux interpreter
Members:
ChangeLog:1.5221->1.5222
config/arm/linux/md.c:1.8->1.9
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5221 kaffe/ChangeLog:1.5222
--- kaffe/ChangeLog:1.5221 Tue Jan 22 23:21:21 2008
+++ kaffe/ChangeLog Sun Jan 27 01:50:20 2008
@@ -1,3 +1,8 @@
+2008-01-25  Dalibor Topic  
+
+ * config/arm/linux/md.c (flush_dcache): Only
+ declare for JIT engine.
+
2008-01-22  Dalibor Topic  
* kaffe/kaffeh/Makefile.am (kaffeh_LDADD, AM_CPPFLAGS):
Index: kaffe/config/arm/linux/md.c
diff -u kaffe/config/arm/linux/md.c:1.8 kaffe/config/arm/linux/md.c:1.9
--- kaffe/config/arm/linux/md.c:1.8 Sun Apr 22 23:39:20 2007
+++ kaffe/config/arm/linux/md.c Sun Jan 27 01:50:22 2008
@@ -26,6 +26,7 @@
#endif
}
+#ifdef TRANSLATOR
/**
* Shamelessly stolen from parrot... ([perl]/parrot/jit/arm/jit_emit.h arm_sync_d_i_cache)
*
@@ -41,3 +42,4 @@
: "r" ((long)start), "r" ((long)end)
: "r0","r1","r2");
}
+#endif
-----------------------------------------

After applying these changes, we compiled successfully, moved the images from build/tmp/work/… to the Freerunner, setup the libraries and tried running, only to get a Stackoverflow exception before the class file even loaded.

So, we moved to option #2. JamVM.

JamVM and classpath are two packages which were already in the openmoko environment and were built easily with default values. Ported the ipks for both packages to the device, installed and java works.

The problem is that JamVM will be using GNU Classpath which is known to have issues with some of the apps we’re used to. So, we’ll have to address these issues as they arise. For now, we can be happy that java is operational on our Freerunner.

2 Responses to " Getting Java on Openmoko "
 
shahbaz Khan
September 14th, 2008

I think it will be better if we put patches in attachment to these posts, i.e. put them in a text file and upload them and link them to relevant posts.

 
shazkhan
September 14th, 2008

It would be good if we would attach the patches as attachments.

Leave a Reply


(Required)

(Required)