Sunday, January 13, 2013

Groove your Raspberry Pi

After playing with the GPIO by using Python as a programming language with my nephews, I was tempted to augment the Raspberry Pi (RPI) with Groovy programming language. Just image what you can do with a small machine and a modern programming language. To do that, you need to install Java and Groovy. Here I provide straightforward instructions to quickly groove your RPI.

Get a new 4GB+ SD card and flash the "Soft-float Debian, wheezy" image. The image is available at http://www.raspberrypi.org/downloads

Since you need more space to install Java and Groovy, you need to resize a partition or create a new partition. Here I provide instructions to resize the root file system for simplification. To resize the root file system, use raspi-config tool and select expand_rootfs; it will use all available space for that partition. Then reboot your RPI.

After run df -h to verify if the root file system has been resized.

Get Java 7 soft floating-point for embedded Linux (ARMv6/7 Linux - Headless EABI, VFP, SoftFP ABI, Little Endian) http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html

Create a java directory where you will unpack Java:
mkdir /home/pi/java
cd /home/pi/java
tar -zxvf ejre-7u10-fcs-b18-linux-arm-vfp-client_headless-28_nov_2012.tar.gz

Verify that java is properly installed by doing
./ejre1.7.0_10/bin/java -version

Get Groovy at http://groovy.codehaus.org/Download, here I use version 1.8.8 but you can use the latest.

Create a groovy directory where you will unpack Groovy:
mkdir /home/pi/groovy
cd /home/pi/groovy
unzip groovy-binary-1.8.8.zip

Set Java and Groovy home environment variables add their bin directory to the PATH environment variable.
export JAVA_HOME=/home/pi/java/ejre1.7.0_10
export GROOVY_HOME=/home/pi/groovy/groovy-1.8.8
export PATH=$PATH:$JAVA_HOME/bin:$GROOVY_HOME/bin

Verify Groovy installation by doing
groovy -v
groovy -e "println 'Hello World'"

Voilà you have grooved your Rapsberry Pi!

No comments:

Post a Comment