Apr 212014

This is heavily based on this Wiki entry. Go there to read more about the background of toolchains.

As a quick summary for you: we want compilation to be faster than on the Raspberry Pi. MUCH faster.

Set up crosscompiling

Create / use an Ubuntu machine. I use 12.04 LTS.

You can check your Ubuntu version with lsb_release –a

Run the commands:

sudo add-apt-repository ppa:linaro-maintainers/toolchain

This will add the linaro toolchain repository.

sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"

This will add the universe repository and all other available repositories (universe being the one we need additionally).

aptitude update

To get the contents from the repositories. Now install the crosscompiling toolchain:

apt-get install gcc-arm-linux-gnueabi

dpkg -L gcc-arm-linux-gnueabi

This will show the location of the newly installed libraries.

Official note:

Note that this toolchain defaults to ARMv7 with Thumb2. If you want to use it for older processors you have to add “-marm” into CFLAGS.

Apr 192014

libavg is a German project to ease the building of multimedia applications – this can be anything from a movie / touch interface installation in a museum to a quick demo of a future application you throw together yourself, before (if needed) delving into “hardcore” programming.

libavg supports a variety of text, graphics, audio and video output, and a variety of input possibilities (e.g. multitouch). Have a look at their showcase to see some of the possibilites.

Luckily for us, libavg has been ported and optimized for the Pi, and they provide a pre-compiled package.


Follow the instructions on https://www.libavg.de/site/projects/libavg/wiki/RPI for installing the tarball (see link at the bottom of the page, which you can “wget”.

There are also instructions for compiling from source, using QEMU, on that page.


After installation, you can test libavg with the classic “hello world” program.

Please refer to this page https://www.libavg.de/site/projects/libavg/wiki/HelloWorld for the source.

One gotcha: X Windows needs to be running in order for the program to execute. (“startx”). Else the software will complain:

RuntimeError: No available video device


Video playback is NOT hardware accelerated on the Pi currently with libavg.  In my test a H.264 encoded low-res movie was played at normal speed, but seemed quite choppy. Audio was OK. Decoding and rendering happens via the CPU (as per the “node” idea – combining multiple videos / other nodes for output), which maxes it out. The same video works fine using omxplayer, though.

In this blog article the team announces intentions to work on OpenMax IL integration. In the same article, a comment states that as per January of 2014 there has been no work done in this area, lacking necessary manpower & knowledge resources for the development.


libavg has an extensive documentation, for instance this page for area nodes (including the video node).

It also has a blog, with some interesting entries, for example:

Video decoding using libav and ffmpeg – detailing some of the problems behind video decoding in general, and libav/ffmpeg in particular.

Apr 032014

What is this about?

How to set up a Raspbian system as a read-only system in a couple of easy steps.


This penguin has been doing a lot of reading as of lately.

Why is this of interest to me?

The filesystem on the Raspberry Pi’s SD card, as every filesystem on every computer, can be corrupted if you disconnect the power suply.

Once you make the filesystem read-only (all changes go to a RAM-Disk), you will be able to disconnect the power supply whenever you want.

An additional bonus is less wear on the SD card – sometimes you do NOT want the logfiles which a standard Linux / Raspbian will write to anyway. Our solution will write those to a RAM-Disk and discard them on reboot / power cycling.

Last but not least, you can set up a known state to boot into, experiment, and if things go wrong, simply reboot.

How-To make Raspbian read-only

all commands to be run as root (sudo su) if not specified otherwise.

This how-to is based on another how-to I found on the Internet, in German. Thanks guys!

Disable swap

dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d dphys-swapfile disable

Install UnionFS

UnionFS is an overlaying filesystem (you can mount from several different locations into the same folder). In case of collisions, UnionFS uses priorities for the filesystems. It is frequently used to create RAM-Disk Overlays for read-only systems, for instance also with Live CDs.

aptitude install unionfs-fuse

Create mount script

nano /usr/local/bin/mount_unionfs

Add the following content to this file:

 ROOT_MOUNT=$(awk '$2=="/" {print substr($4,1,2)}' < /etc/fstab)
 if [ $ROOT_MOUNT = "rw" ]
   /bin/mount --bind ${DIR}_org ${DIR}
   /bin/mount -t tmpfs ramdisk ${DIR}_rw
   /usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}

make it executable:

 chmod +x /usr/local/bin/mount_unionfs

Update /etc/fstab:

nano /etc/fstab

Modify the file to read (adjust partitions for NOOBS!) as follows:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    ro                0       2
/dev/mmcblk0p2  /               ext4    ro,noatime        0       1
mount_unionfs   /etc            fuse    defaults          0       0
mount_unionfs   /var            fuse    defaults          0       0
none            /tmp            tmpfs   defaults          0       0

Prepare the directories

cp -al /etc /etc_org
mv /var /var_org
mkdir /etc_rw
mkdir /var /var_rw

At this point your Raspberry Pi should be read-only already. You can verify this with


This command should show something like the following:

/dev/root on / type ext4 (ro,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=215824k,nr_inodes=53956,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=44820k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=89620k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
/dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
ramdisk on /etc_rw type tmpfs (rw,relatime)
unionfs-fuse on /etc type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
ramdisk on /var_rw type tmpfs (rw,relatime)
unionfs-fuse on /var type fuse.unionfs-fuse (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
none on /tmp type tmpfs (rw,relatime)

This indicates to you that the filesystems are mounted read-only and unionfs is active.

Clean up the Log directory

mount -o remount,rw /
for f in $(find . -name \*log); do > $f; done
cd /var_org/log
rm -f *.gz


Another reboot and you’re done!


How-To Install additional Packages after “read-only-modding”

You’ve got to remount the root filesystem as readable. For instance, as root, you can do:

mount -o remount,rw /
aptitude update
aptitude install stress
Mar 152014

By default, osssink will not work on the Raspberry Pi with gstreamer-1.0.

As root, enter the following:

modprobe snd-pcm-oss

And then you should be able to play your audio files, for instance using:

gst-launch-1.0 playbin uri=file:///home/pi/tina.wav

AIFF files can be played with:

gst-launch-1.0 playbin uri=file:///home/pi/tina.aiff

Alternatively this will give you a test tone:

gst-launch-1.0 audiotestsrc ! audioconvert ! audioresample ! autoaudiosink

You can use


to control the volume (using the arrow keys).

Mar 152014

With this interesting tool you can redirect input over the network – control other Linux boxes as if you were physically sitting in front of them and using a USB mouse and keyboard.

The project’s GitHub repository is found here:


More documentation is available on this site: http://hetgrotebos.org/wiki/uinput-mapper

Here is an introduction how to set up keyboard and mouse forwarding via SSH to a second Linux box.


Installing uinput-mapper

as user root (sudo su):

aptitude install git-core

cd /opt

git clone https://github.com/MerlijnWajer/uinput-mapper.git

cd uinput-mapper


This will check out the tool into the /opt directory. This is not a requirement per se, you can also install it in a different directory of your liking.

make will build the file “uinputmapper/uinput_gen.py”

Use the same procedure on the server.

Connect to server

Test the connection by logging in via SSH and the appropriate key to the server (you need to set this private / public authentication up first, of course – see this article, for instance).

ssh root@

Should log you in to the remote server. Change the username, (the path to the key if needed – can be specified with the –i option), and the IP address according to your setup.

Log out again.

Have a look at the input devices on your “local” machine, from which you will be redirecting the input:

ls -alh /dev/input/*

Sometimes, keyboards will create two devices – one for the additional (multimedia?) keys.

Connect (with error / stdin logging)

./input-read -G /dev/input/event0 -G /dev/input/event1 -D | ssh root@ “/opt/uinput-mapper/input-create &>>/tmp/errorlog “

If nothing happens, have a look at /tmp/errorlog on your server:

Traceback (most recent call last):
  File “/opt/uinput-mapper/input-create”, line 73, in <module>
    fd, ev = in_f.load()

Try connecting with the compatibility option for Python < 2.7 in this case.

./input-read -C -G /dev/input/event0 -G /dev/input/event1 -D | ssh root@ “/opt/uinput-mapper/input-create -C &>>/tmp/errorlog2 “

please note, that the compatibility flag needs to be given on BOTH sides (local and remote part) of the command.

You can verify your Python version like this:

root@cloudsource2:/opt/uinput-mapper# python –version
Python 2.7.3

If everything works allright, you can leave away the last part (starting with the ampersand “& …”) which just redirects standard output and error from the server for debugging.

Optimization WordPress Plugins & Solutions by W3 EDGE