QEMU + ARM test setup
From time to time we get inquiries regarding OPC UA server and client application suitability and performance on ARM platforms. This blog post is intended to serve as a starting point for users interested in testing Prosys Java applications on ARM platform virtual machine.
QEMU is a open-source software that performs hardware virtualization. It supports emulation of various architectures, including ARM. QEMU emulates the ARMv5TEJ instruction set and all the derivative processors families like ARM7, ARM9E, ARM10E and XScale. For example, QEMU powers the Android emulator which is part of the Android SDK. See http://wiki.qemu.org/Main_Page or http://en.wikipedia.org/wiki/QEMU for more information about the QEMU system itself.
This post covers the installation and basic operation of QEMU and couple of hints to get up and running with Prosys SampleConsoleServer and SampleConsoleClient fast and easy. This guide is made using Java SE Embedded 7 but also other Java versions intended to be used with ARM should work. There’s also a ARM version of Java SE, see http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html for more details.
From our experience until now it seems that QEMU works best with Linux platforms so we chose Ubuntu 12.04 as the host for the virtual machine. Qemu can be installed with:
apt-get install qemu-system
We chose Debian to be our virtual machine OS. To start our ARM-virtual machine we need suitable kernel, initrd (initial ramdisk) and disk image. We acquired these by downloading them from http://people.debian.org/~aurel32/qemu/armel/
Note that there’s also QEMU versions for Windows and Mac. Those might also get the job done.
Now we are ready to boot our virtual machine! Run command:
sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1"
Optionally you can also add “-m” option at the end of the command. This option lets you increase or decrease the amount of RAM in virtual machine. Note that 256 MiB is the maximum amount of RAM available.
If you are planning on testing only console applications, as is our case in this post, it’s recommended to use the “standard” version of the disk image. Running graphical user interface in normal QEMU setup can be really slow.
You should now see a virtual machine screen with Debian booting for the first time and then ending up at a login prompt. Default usernames and passwords are “root/root” and “user/user”. Of course these passwords are recommended to be changed immediately after logging in.
After succesful first boot you will probably want to make some useful basic configurations. As I am writing this from Finland my first configuration was
Java version 7 requires at least kernel version 2.6.28 and glibc version 2.9. These version numbers can be checked with:
Although if you have followed these instructions you already have correct versions.
Correct Java version for our test platform is ARMv5 Linux – Headless EABI, SoftFP ABI, Little Endian, which can be loaded from: http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html
Now the next step is to download the .tar.gz folder and unzip it to desired folder. Remember also to set Java path variable. This can be done for example by modifying file
to make changes come to use. Test that Java works by running
The output should look similar to below:
Acquiring SampleConsoleServer and SampleConsoleClient
Java SE Embedded ships without Java compiler (javac) which is understandable as embedded platforms are not intended to be used for developing applications but rather only to run them. “Normal” versions of SampleConsoleServer and SampleConsoleClient however require use of Java compiler so we have to make different packages for embedded platforms. This is pretty trivial, you can for example export runnable .jar-packages from Eclipse if you have SampleConsoleServer and SampleConsoleClient source code.
Move these newly created .jar packages to your virtual machine.
You now have all the essential parts ready. However at this default setup virtual machine puts empty quotations as domain name which causes SampleConsoleServer to exhibit errors. Edit the
file to avoid this error. In our case
was changed to
At this point we recommend installing screen-program to be able to run both Java programs easily at the same time. Run command
apt-get install screen
Here’s some screen commands to get you started if you’re not familiar with the program beforehand: Starting:
screen java -jar SampleConsoleServer.jar
Exiting: just normally exit the program that you run in screen Listing different screen instances:
Attaching to different screens:
screen -r [pid]
Testing the configuration
One good way to test that both the server and client application are working correctly is to make a subscription to MyLevel:
If you export SampleConsoleServer.jar and SampleConsoleClient.jar from Eclipse without modifications you will get Log4j-warnings at the startup of both .jar files.
log4j:WARN No appenders could be found for logger (com.prosysopc.ua.UaApplication). log4j:WARN Please initialize the log4j system properly.
You have to modify SampleConsoleClient.java and SampleConsoleServer.java accordingly.
// Load Log4j configurations from external file PropertyConfigurator.configureAndWatch(SampleConsoleServer.class .getResource("log.properties").getFile(), 5000);
Has to be changed to:
// Initialize log4j logging PropertyConfigurator.configure(SampleConsoleServer.class .getResource("log.properties"));
Customer Service Manager
Expertise and responsibility areas: Prosys OPC product and service sales and customer relationships
Prosys is a leading provider of professional OPC software and services with over 10 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.
Newest blog posts
OPC UA is getting popular in real-world installations and also going towards real-time with the latest announcements about support for field level.
Watch the short videos to get a quick overview of how to get started with OPC UA end-user products or with development. They are represented by Jouni Aro, the CTO of Prosys OPC.