Of JVMs and other software for ARM Linux
Random notes on the installation of Wonka, Kaffe, PCSC-lite, and Java Native Interface on ARM linux systems.
Wonka-0.9.6 2207 Kb
Wonka binary1042 Kb
Wre.jar (reduced packages, 1209 Kb uncompressed)
Instructions for compiling WONKA for arm-linux:
- Download Acunia Jam and unpack it. To build, type 'make' and copy the executable 'jam' to /usr/local/bin
- Download and unpack jamjar. To build, type 'jam' and copy the executable 'jamjar' to /usr/local/bin
- Download jikes) and install from the rpm.
- Download Wonka and unpack it. Enter the wonka directory as 'root' and execute the following commands:
export WONKA_TOP=`pwd`jam -sCPU=arm -sDEBUG=false -sWONKA_CONFIG=default wonka
jam -sCPU=arm -sDEBUG=false -sWONKA_CONFIG=default install
The wonka executable and related files can be found in the 'build-arm-linux' directory. The files that must be transferred to the target system are:
build-arm-linux/wonka/wonka (executable file)
build-arm-linux/fsroot (directory containing wre.jar)
Redundant files in 'fsroot' such as font files, png files etc may be removed. The size of wre.jar can be further reduced by removing unnecessary packages.
To unjar wre.jar: unzip wre.jar
To create wre.jar without compression: zip -0 -q -r -o wre.jar com java javax META-INF wonka
To create wre.jar with compression: zip -9 -q -r -o wre.jar com java javax META-INF wonka
To customize the features of wonka, edit the configuration file in 'Configuration/wonka/default'
To run wonka, type './wonka JavaClassName' on the target machine.
To remove object code before a complete rebuild remove 'wre.jar' and the directory 'build-arm-linux' and execute the command: 'jam -sCPU=arm -sDEBUG=false -sWONKA_CONFIG=default clean'
Instructions for compiling PCSC-lite for arm-linux:
- Unpack PCSC lite 1.1.1 source.
- Enter the 'src' directory and edit 'Makefile.am' and 'Makefile.in' to remove the compiler switch '-lfl'.
Makefile.am: Lines 16, 17, 24, 25, 34, 35
Makefile.in: Lines 92, 93, 94, 100, 101, 102 - Edit the file 'src/configfile.c' and add the following function:
int yywrap(void)
{
return 1;
} - To configure PCSC lite to build binaries in the folder '/home/foo/pcsc/build' execute:
CC=arm-linux-gcc ./configure --target=arm-linux-coff --enable-usb --enable-syslog --enable-daemon --enable-debug --enable-debugatr --prefix=/home/foo/pcsc/build enable-threadsafe - Execute 'make' and 'make install'
The pcsc executable will be created in: '/home/foo/pcsc/build/sbin/arm-linux-coff-pcscd'
Instructions for using native libraries (shared objects in linux) in Java using the Java Native Interface (JNI):
- Write java source code to load the shared object, and access the native methods.
System.loadLibrary ("Serial");
public static native int OpenSerial ();
public static native void WriteSerial (int refPort, String str);
public static native String ReadSerial (int refPort);
public static native void CloseSerial (int refPort);The above loads a linux shared object file: 'libSerial.so' located in one of the paths defined in the environment variable: $LD_LIBRARY_PATH
Four native functions are declared in the class.refPort = OpenSerial ();
WriteSerial (refPort, outStr);
inStr = ReadSerial (refPort);
CloseSerial (refPort);The above code segment shows the calls to the native methods from java.
- Compile the java source file using a java compiler like jikes, to produce the class file.
export CLASSPATH=/home/foo/java/wonka/open-wonka/wre.jarjikes Serial.java
CLASSPATH should point to the wonka JRE classes
- Create the header file for the native C file using the command:
export CLASSPATH=/home/foo/java/wonka/open-wonka/wre.jar:/home/foo/java/class/serial/javah -jni Serial
CLASSPATH points to the wonka JRE classes, and to the directory holding java class file Serial.class. Javah is distributed with Kaffe or SUN's J2EE. The above commands create Serial.h which can be included in the C source file.
- Create the C source file and compile using the following command:
arm-linux-gcc Serial.c -shared -I/home/foo/java/wonka/open-wonka/wonka/ include/ -I/home/foo/java/wonka/open-wonka/wonka/hal/cpu/arm/include/ -o libSerial.soPlace 'libSerial.so' in one of the directories defined in $LD_LIBRARY_PATH and run the java class.
Comments:
Comments are closed for this post.