當Java遇到OpenMoko
對許多人來說,openmoko真是個令人驚奇的平台,這不僅是個開放系統,而且也引入許多原生於桌面環境的技術,甫成立的GMAE (GNOME Mobile & Embedded Initiative) 就是個極佳的切入點。作為一個Free Java (VM) hacker,最大的樂趣就是廣泛讓Java技術散佈到世界上不同的角落,當然,也包含了openmoko,考量到openmoko的行為模式比較類似桌面系統,而非傳統的CDC/CLDC執行環境,所以我選擇了Kaffe與Cacao這兩個以GNU GPL發佈的Java Virtual Machine實做,這兩者都以GNU Classpath作為Class Library實做,所以有不錯的相容度。
經過一番努力,Kaffe與Cacao這兩個Free JVM都可在openmoko上運作,而我則對後者予以很大的關注,因為其ARM jit engine日前已經以GPL釋出,而且Cacao這兩年內的效能提昇幅度相當不錯。我在Planet Classpath寫了一篇紀錄「Cacao VM running on openmoko」,節錄如下:
Then, back to Free Java world, I met several hackers around the world in #kaffe, #classpath, and #cacao IRC channel. Since I had portd Kaffe to Xscale-based mobile phones, I decide to take Cacao for a try. After some slight modifications (with the help from twisti), Cacao works on OpenMoko GTA01, and here is the output for typical "Hello World" application in Java:
It is based on Cacao SVN (along with GPL'd ARM jit engine) + GNU Classpath version 0.95. However, I still manage to let gtk-peer work on Cacao inside GTA01 device. But I am of the opinion that it is really a good start point for joint of the power from Free Java (GNU Classpath, Cacao, Kaffe, etc.), OpenMoko, and Embedded Linux.root@fic-gta01:/var/tmp/cacao$ ls *.class
fp.class hello.class
root@fic-gta01:/var/tmp/cacao$ cd bin
root@fic-gta01:/var/tmp/cacao/bin$ ./cacao -cp .. hello
Hello world
root@fic-gta01:/var/tmp/cacao/bin$ uname -a
Linux fic-gta01 2.6.20.7-moko8 #1 PREEMPT Sat Apr 14
07:40:05 UTC 2007 armv4tl unknown
Also, I met guillaum1 in #cacao, who is the developer of MIDPath, and he suggested me to try the combination of cacao-cldc (cacao without GNU Classpath) + MIDPath. The design of MIDPath is very flexible, and it allows to have MIDP2 working on top of cacao-cldc (without Classpath) or standard cacao (i.e with Classpath). I will do that later.
很快收到許多回應:
- Mark Wielaard的blog「OpenMoko free java support with GNU Classpath & Cacao」
- Dalibor Topic的blog「All in a day's work」
- openmoko-app討論群組「Cacao jvm on openmoko」