2009年4月24日 星期五
kaffe cross compile for mipsel
Reguirement
jikes-1.22
kaffe-1.1.7
libffi-3.0.8
microwindows-0.91
流程
1.Build and install kaffe on host( X86 )
cd jikes-1.22
./configure --prefix=/usr --cache-file=/dev/null
make
sudo make install
cd microwindows-0.91
make
cd kaffe-1.1.7
./configure --prefix=/usr/local/kaffe --with-gc=kaffe-gc --enable-pure-java-math --with-staticlib --disable-shared --disable-alsa --without-kaffe-x-awt --without-kaffe-qt-awt --without-classpath-gtk-awt --disable-gtk-peer --disable-sound --with-jikes=/usr/bin/jikes --with-kaffe-nanox-awt --with-engine=intrp --with-nanox-include=../microwindows-0.91/src/include --with-nanox-library=../microwindows-0.91/src/lib/ --cache-file=/dev/null
make
sudo make install
sudo make check
Hello.java
public class Hello
{
public static void main (String[] args)
{
System.out.println ("Hello Kaffe");
}
}
jikes -classpath /usr/local/kaffe/jre/lib/glibj.zip Hello.java
/usr/local/kaffe/bin/kaffe -Xbootclasspath:/usr/local/kaffe/jre/lib/glibj.zip Hello
gigijoe@user-desktop:~/kaffe-1.1.7/hello$ /usr/local/kaffe/bin/kaffe -Xbootclasspath:/usr/local/kaffe/jre/lib/glibj.zip Hello
Hello Kaffe
/usr/local/kaffe/bin/kaffe -v -Xbootclasspath:/usr/local/kaffe/jre/lib/glibj.zip Hello >& Hello.log
Hello.log 裡面長這個樣子
Loading java/lang/Object.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
Loading java/io/Serializable.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
Loading java/lang/Cloneable.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
...
...
...
Loading java/nio/charset/CoderResult$1.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
Loading java/nio/charset/CoderResult$Cache.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
Loading java/nio/charset/CoderResult$2.class(/usr/local/kaffe/jre/lib/glibj.zip) [compressed]
Hello Kaffe
手工改寫Hello.log成底下的樣子.另存成glibjmin.make
/usr/local/kaffe/bin/jar cvf glibjmin.zip \
java/lang/Object.class \
java/io/Serializable.class \
java/lang/Cloneable.class \
...
...
...
java/nio/charset/CoderResult\$1.class \
java/nio/charset/CoderResult\$Cache.class \
java/nio/charset/CoderResult\$2.class
將glibjmin.make複製到 libraries/javalib/external/classpath/lib/
cd libraries/javalib/external/classpath/lib/
chmod 755 glibjmin.make
./glibjmin.make
這樣就產生glibjmin.zip
測試Nano-X AWT
開啟一個Terminal
cd microwindows-0.91/src
bin/nano-X -p
開啟一個Terminal
cd test/awt/WidgetsDemo/
jikes -classpath /usr/local/kaffe/jre/lib/glibj.zip WidgetsDemo.java
sudo /usr/local/kaffe/bin/kaffe -Xbootclasspath:/usr/local/kaffe/jre/lib/glibj.zip -Xkaffe-nanox-awt WidgetsDemo
2.Build and install mipsel kaffe
cd libffi-3.0.8
CC=mipsel-linux-uclibc-gcc AR=mipsel-linux-uclibc-ar RANLIB=mipsel-linux-uclibc-ranlib ./configure --host=mipsel-linux --target=mipsel-linux --prefix=/usr/local/MIPSEL_UCLIBC --cache-file=/dev/null
make
sudo PATH=$PATH:/usr/local/MIPSEL_UCLIBC/bin make install
cd microwindow-0.91 -->> 這是for target用的不要跟host上的混在一起囉
(Cross compile microwindow)
make
cd kaffe-1.1.7
KAFFEH=/usr/local/kaffe/bin/kaffeh CC=mipsel-linux-uclibc-gcc AR=mipsel-linux-uclibc-ar RANLIB=mipsel-linux-uclibc-ranlib ./configure --host=mipsel-linux --target=mipsel-linux --prefix=/usr/local/kaffe-mipsel --with-gc=kaffe-gc --enable-pure-java-math --with-staticlib --disable-shared --without-kaffe-x-awt --without-kaffe-qt-awt --without-classpath-gtk-awt --disable-gtk-peer --disable-sound --with-jikes=/usr/bin/jikes --with-kaffe-nanox-awt --with-engine=intrp --with-libffi --with-nanox-include=../microwindows-0.91/src/include --with-nanox-library=../microwindows-0.91/src/lib/ --cache-file=/dev/null
make
sudo PATH=$PATH:/usr/local/MIPSEL_UCLIBC/bin make install
sudo cp -a /usr/local/MIPSEL_UCLIBC/lib/libffi.so* /usr/local/kaffe-mipsel/lib
編譯的工作到此已完成,接著將kaffe-mipsel整個複製到target上.
以之前的Hello.class在target上測試
# /usr/local/kaffe-mipsel/bin/kaffe -Xbootclasspath:/usr/local/kaffe-mipsel/jre/lib/glibj.zip Hello
/usr/local/kaffe-mipsel/bin/kaffe: /usr/local/kaffe-mipsel/bin/kaffe: 55: uname: not found
Hello Kaffe
成功囉
將之前做出來的glibjmin.zip 複製到target上/usr/local/kaffe-mipsel/jre/lib/glibjmin.zip
在測試看看
# /usr/local/kaffe-mipsel/bin/kaffe -Xbootclasspath:/usr/local/kaffe-mipsel/jre/lib/glibjmin.zip Hello
/usr/local/kaffe-mipsel/bin/kaffe: /usr/local/kaffe-mipsel/bin/kaffe: 55: uname: not found
java.lang.NoClassDefFoundError: gnu/java/nio/charset/ISO_8859_1$Encoder
at gnu.java.nio.charset.ISO_8859_1.newEncoder (ISO_8859_1.java:92)
at java.lang.String.getBytes (String.java:356)
at java.io.PrintStream.writeChars (PrintStream.java:287)
at java.io.PrintStream.print (PrintStream.java:225)
at java.io.PrintStream.println (PrintStream.java:505)
at Hello.main (Hello.java:5)
喔喔,殘念了
把gnu/java/nio/charset/ISO_8859_1$Encoder.class加入glibjmin.make.
再產生glibjmin.zip
# /usr/local/kaffe-mipsel/bin/kaffe -Xbootclasspath:/usr/local/kaffe-mipsel/jre/lib/glibjmin.zip Hello
/usr/local/kaffe-mipsel/bin/kaffe: /usr/local/kaffe-mipsel/bin/kaffe: 55: uname: not found
Hello Kaffe
成功囉
3.Nano-X based AWT backend
http://www.sfr-fresh.com/unix/www/kaffe-1.1.9.tar.gz:a/kaffe-1.1.9/FAQ/FAQ.awt
cd kaffe-1.1.7/test/awt/WidgetsDemo
jikes -classpath /usr/local/kaffe/jre/lib/glibj.zip WidgetsDemo.java
將WidgetsDemo.class WidgetsDemo$Person.class複製到target上
/usr/local/kaffe-mipsel/bin/kaffe -Xbootclasspath:/usr/local/kaffe-mipsel/jre/lib/glibj.zip -Xkaffe-nanox-awt WidgetsDemo
/phone/bin/nano-X -p &
# /usr/local/kaffe-mipsel/bin/kaffe -Xbootclasspath:/usr/local/kaffe-mipsel/jre/lib/glibj.zip -Xkaffe-nanox-awt WidgetsDemo
/usr/local/kaffe-mipsel/bin/kaffe: /usr/local/kaffe-mipsel/bin/kaffe: 55: uname: not found
# ps
PID Uid VmSize Stat Command
1 root 376 S init
2 root SW [ksoftirqd/0]
3 root SW< [desched/0]
4 root SW< [events/0]
5 root SW< [khelper]
10 root SW< [kthread]
13 root SW< [kblockd/0]
26 root SW [khubd]
54 root SW [pdflush]
55 root SW [pdflush]
57 root SW< [aio/0]
56 root SW [kswapd0]
142 root SW [mtdblockd]
130 root SW [kseriod]
160 root SW< [IRQ 8]
163 root SW< [IRQ 15]
167 root SWN [jffs2_gcd_mtd3]
185 root SW< [IRQ 43]
203 root SW [scsi_eh_0]
204 root SW [usb-storage]
271 root 320 S /usr/sbin/telnetd -l /bin/login
272 root 436 S ftpd: accepting connections on port 21
283 root SW< [IRQ 27]
295 root SW< [IRQ 41]
324 root 400 S /sbin/udhcpc -s /phone/etc/udhcpc.script -i eth0 -p /
350 root SW< [IRQ 45]
354 root 284 S /phone/bin/thttpd -C /phone/web/html.conf
364 root 364 S /sbin/getty -L ttyS0 9600 vt100
365 root 348 S /sbin/syslogd -n -m 0
366 root 344 S /sbin/klogd -n
368 root 336 S /phone/bin/ntpclient -h ntp.ucsd.edu -i 86400 -so 8:0
1392 root 536 S -sh
1412 root SWN [jffs2_gcd_mtd0]
2208 root 684 S ftpd: 192.168.168.79: root: IDLE
2256 root 488 S /phone/bin/nano-X -p
2280 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2300 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2301 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2302 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2303 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2304 root 7148 S /usr/local/kaffe-mipsel/jre/bin/kaffe-bin -Xbootclass
2306 root 468 S -sh
2313 root 376 R ps
# /phone/bin/rfree
total used free slab buffers cached
Mem: 29680 28768 912 3620 248 16644
-/+ buffers/cache: 8256 17804 3620
Swap: 0 0 0
哈哈哈,成功啦
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言