Arpith Chacko Jacob - since 1982...

  Of JVMs and other software for ARM Linux

Saturday 24th 2004f July 2004, 11:56:17 am. Posted in: Embedded. 650 words.  

Random notes on the installation of Wonka, Kaffe, PCSC-lite, and Java Native Interface on ARM linux systems.

Kaffe-1.1.0 for arm linux 6724 Kb
Wonka-0.9.6 2207 Kb
Wonka binary1042 Kb
Wre.jar (reduced packages, 1209 Kb uncompressed)

Instructions for compiling WONKA for arm-linux:

  1. Download Acunia Jam and unpack it. To build, type 'make' and copy the executable 'jam' to /usr/local/bin
  2. Download and unpack jamjar. To build, type 'jam' and copy the executable 'jamjar' to /usr/local/bin
  3. Download jikes) and install from the rpm.
  4. 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:

  1. Unpack PCSC lite 1.1.1 source.
  2. Enter the 'src' directory and edit '' and '' to remove the compiler switch '-lfl'. Lines 16, 17, 24, 25, 34, 35 Lines 92, 93, 94, 100, 101, 102
  3. Edit the file 'src/configfile.c' and add the following function:
    int yywrap(void)
    return 1;
  4. 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
  5. 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):

  1. 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: '' 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.

  2. 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.jar


    CLASSPATH should point to the wonka JRE classes

  3. 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.

  4. 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

    Place '' in one of the directories defined in $LD_LIBRARY_PATH and run the java class.


No Comments for this post yet...

Comments are closed for this post.