Embedded: Resin On Raspberry Pi
From Resin 4.0 Wiki
Line 24: | Line 24: | ||
* [http://elinux.org/RPi_raspi-config raspi-config on the Raspberry Pi Wiki] | * [http://elinux.org/RPi_raspi-config raspi-config on the Raspberry Pi Wiki] | ||
− | I recommend you run "sudo apt-get update" and then "sudo apt-get upgrade". This will take something like | + | I recommend you run "sudo apt-get update" and then "sudo apt-get upgrade". This will take something like 40 minutes, but it's good to have all the latest updates. |
== Java == | == Java == | ||
Line 33: | Line 33: | ||
* To install OpenJDK 7, simply run "sudo apt-get install openjdk-7-jdk". java will install in your path using [http://www.linuxalt.com/ /etc/alternatives] | * To install OpenJDK 7, simply run "sudo apt-get install openjdk-7-jdk". java will install in your path using [http://www.linuxalt.com/ /etc/alternatives] | ||
* To install Oracle JDK download [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SE 7 JDK, Linux ARM v6/v7 Soft Float ABI] from Oracle. There's nice step-by-step instructions at [http://www.savagehomeautomation.com/pi-jdk Savage Home Automation - Raspberry Pi - Installing Oracle Java Development Kit]. | * To install Oracle JDK download [http://www.oracle.com/technetwork/java/javase/downloads/index.html Java SE 7 JDK, Linux ARM v6/v7 Soft Float ABI] from Oracle. There's nice step-by-step instructions at [http://www.savagehomeautomation.com/pi-jdk Savage Home Automation - Raspberry Pi - Installing Oracle Java Development Kit]. | ||
+ | |||
+ | If you're getting this error when running java, "error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory", it means you're trying to run Java on hard-float Rasbian. [http://www.raspberrypi.org/downloads Get the soft-float version]. | ||
+ | |||
+ | == Resin == | ||
+ | |||
+ | * Download Resin 4.0.35 or later from [http://www.caucho.com/download/ www.caucho.com]. 4.0.35 was the first version to include changes necessary to compile Resin's native libraries on a Raspberry Pi | ||
+ | * We'll install Resin Pro, but Resin Open-Source will run fine also. Resin Open-Source still has some native optimizations that need to be compiled. | ||
+ | * Resin's native optimizations are always optional - it will run fine in pure Java mode with most features still available. | ||
+ | |||
+ | 1. Download, unzip, and install Resin. There's nothing different here than any other Resin installation. Just make sure Java can be found. It must either be in the path or JAVA_HOME set as an environment variable. | ||
+ | |||
+ | wget http://www.caucho.com/download/resin-pro-4.0.35.zip | ||
+ | unzip resin-pro-4.0.35.zip | ||
+ | cd resin-pro-4.0.35 | ||
+ | ./configure | ||
+ | |||
+ | You should get a configuration summary that looks like this: | ||
+ | |||
+ | Resin Configuration Summary: | ||
+ | |||
+ | RESIN : 4.0.35 | ||
+ | home : /usr/local/share/resin-4.0.35 | ||
+ | root : /var/resin | ||
+ | conf : /etc/resin | ||
+ | log : /var/log/resin | ||
+ | plugins : common resin_os resin resinssl | ||
+ | init : /etc/init.d/resin | ||
+ | |||
+ | JAVA_HOME : /usr/java/bin/.. | ||
+ | |||
+ | JNI : 32-bit | ||
+ | include : -I/usr/java/bin/../include -I/usr/java/bin/../include/linux | ||
+ | CFLAGS : | ||
+ | cflags_shlib : -fPIC | ||
+ | ld_shlib : gcc | ||
+ | ldflags_shlib : -shared -fPIC | ||
+ | libs_shlib : | ||
+ | epoll() for keepalives | ||
+ | |||
+ | OPENSSL : OpenSSL 1.0.1c 10 May 2012 | ||
+ | include : /usr/include | ||
+ | lib : | ||
+ | libraries : -lssl -lcrypto | ||
+ | |||
+ | make | ||
+ | make install | ||
+ | |||
+ | Resin will install to the standard directories /usr/local/share/resin, /var/resin, /etc/resin... | ||
+ | |||
+ | If you're on Resin Pro, now is the time to copy a license file to /etc/resin/licenses | ||
+ | |||
+ | cp /home/pi/10101.license /etc/resin/licenses/ | ||
+ | |||
+ | There's really only 1 change required to run on Raspberry Pi. On Oracle JDK you MUST modify /etc/resin/resin.properties to change the jvm_mode parameter, as Java will NOT run on Raspberry Pi in server mode! Resin automatically uses -server unless this parameter is set: | ||
+ | |||
+ | vi /etc/resin/resin.properties | ||
+ | |||
+ | jvm_mode : -client | ||
+ | |||
+ | On OpenJDK, you have a couple choices. -server implies -zero, the [http://openjdk.java.net/projects/zero/ Zero-Assembler Project VM]. There's also -jamvm, [http://jamvm.sourceforge.net/ JamVM]. Older version of OpenJDK had [http://www.cacaojvm.org/ Cacao JVM], but that appears to have been removed in recent releases and replace with [http://oss.readytalk.com/avian/ Avain VM], although with -avian I get missing library errors... | ||
+ | |||
+ | root@raspberrypi:/# resinctl start | ||
+ | Error occurred during initialization of VM | ||
+ | Server VM is only supported on ARMv7+ VFP | ||
+ | |||
+ | If you're seeing the message above, you need to modify /etc/resin/resin.properties and set "jvm_mode : -client". Oracle JDK won't run in -server mode on a Raspberry Pi. |
Revision as of 00:00, 14 February 2013
Contents |
Resin on Raspberry Pi
We are currently in the early stages of modifying Resin to run on a Raspberry Pi.
Caucho Wiki Raspberry Pi Pages:
- Java On Raspberry Pi Performance
- Resin Changes To Support Raspberry Pi
- Paul's Raspberry Pi Journal
- sddd - Paul's improved dd for SD Card script for OSX
Resin on Raspberry Pi : Installation and Configuration
Preface
I'm going to assume you already have a working Raspberry Pi with Soft-float Raspbian Wheezy installed and updated, accessible via SSH. If not, here are some links to help get you started:
- Soft-float Debian Wheezy Download
- Easy SD Card Setup on the Raspberry Pi Wiki
- sddd - Paul's improved dd for SD Card script for OSX
- Adafruit's First time configuration lesson
- raspi-config on the Raspberry Pi Wiki
I recommend you run "sudo apt-get update" and then "sudo apt-get upgrade". This will take something like 40 minutes, but it's good to have all the latest updates.
Java
- Java 6 and 7 do not support ARMv6 hardware floating-point calculations, so you must use the Soft-float version of Raspbian
- There is an early-access JDK 8 with hard-float support, but we have not tested Resin on JDK 8 yet
- Resin will run on both OpenJDK and Oracle JDK. I recommend Oracle JDK 7 for performance. See Java On Raspberry Pi Performance for the results of performance tests of Oracle JDK and OpenJDK on Raspberry Pi with Resin.
- To install OpenJDK 7, simply run "sudo apt-get install openjdk-7-jdk". java will install in your path using /etc/alternatives
- To install Oracle JDK download Java SE 7 JDK, Linux ARM v6/v7 Soft Float ABI from Oracle. There's nice step-by-step instructions at Savage Home Automation - Raspberry Pi - Installing Oracle Java Development Kit.
If you're getting this error when running java, "error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory", it means you're trying to run Java on hard-float Rasbian. Get the soft-float version.
Resin
- Download Resin 4.0.35 or later from www.caucho.com. 4.0.35 was the first version to include changes necessary to compile Resin's native libraries on a Raspberry Pi
- We'll install Resin Pro, but Resin Open-Source will run fine also. Resin Open-Source still has some native optimizations that need to be compiled.
- Resin's native optimizations are always optional - it will run fine in pure Java mode with most features still available.
1. Download, unzip, and install Resin. There's nothing different here than any other Resin installation. Just make sure Java can be found. It must either be in the path or JAVA_HOME set as an environment variable.
wget http://www.caucho.com/download/resin-pro-4.0.35.zip unzip resin-pro-4.0.35.zip cd resin-pro-4.0.35 ./configure
You should get a configuration summary that looks like this:
Resin Configuration Summary: RESIN : 4.0.35 home : /usr/local/share/resin-4.0.35 root : /var/resin conf : /etc/resin log : /var/log/resin plugins : common resin_os resin resinssl init : /etc/init.d/resin JAVA_HOME : /usr/java/bin/.. JNI : 32-bit include : -I/usr/java/bin/../include -I/usr/java/bin/../include/linux CFLAGS : cflags_shlib : -fPIC ld_shlib : gcc ldflags_shlib : -shared -fPIC libs_shlib : epoll() for keepalives OPENSSL : OpenSSL 1.0.1c 10 May 2012 include : /usr/include lib : libraries : -lssl -lcrypto
make make install
Resin will install to the standard directories /usr/local/share/resin, /var/resin, /etc/resin...
If you're on Resin Pro, now is the time to copy a license file to /etc/resin/licenses
cp /home/pi/10101.license /etc/resin/licenses/
There's really only 1 change required to run on Raspberry Pi. On Oracle JDK you MUST modify /etc/resin/resin.properties to change the jvm_mode parameter, as Java will NOT run on Raspberry Pi in server mode! Resin automatically uses -server unless this parameter is set:
vi /etc/resin/resin.properties jvm_mode : -client
On OpenJDK, you have a couple choices. -server implies -zero, the Zero-Assembler Project VM. There's also -jamvm, JamVM. Older version of OpenJDK had Cacao JVM, but that appears to have been removed in recent releases and replace with Avain VM, although with -avian I get missing library errors...
root@raspberrypi:/# resinctl start Error occurred during initialization of VM Server VM is only supported on ARMv7+ VFP
If you're seeing the message above, you need to modify /etc/resin/resin.properties and set "jvm_mode : -client". Oracle JDK won't run in -server mode on a Raspberry Pi.