Christian's Blog Linux, programming, hacking, electronics, Python… These are the things I love. en-us Mon, 18 May 2015 00:00:00 +0200 <![CDATA[Building a real-time kernel for the Nvidia Jetson TK1]]> Building a real-time kernel for the Nvidia Jetson TK1
NVIDIA Jetson TK1 development kit

NVIDIA Jetson TK1 development kit

Patching the kernel L4T kernel

Get the kernel source

[chris@thinkpad Tegra]$ wget
[chris@thinkpad Tegra]$ tar -xf kernel_src.tbz2
[chris@thinkpad Tegra]$ head kernel/Makefile

# To see a list of typical targets execute "make help"
# More info can be located in ./README
# Comments in this file are targeted only to the developer, do not
[chris@thinkpad Tegra]$

Get the PREEMPT_RT patch

[chris@thinkpad Tegra]$ wget
[chris@thinkpad Tegra]$ wget
[chris@thinkpad Tegra]$

Commit everything to git

[chris@thinkpad Tegra]$ gunzip patch-3.10.*
[chris@thinkpad Tegra]$ cd kernel
[chris@thinkpad kernel]$ git init
[chris@thinkpad kernel]$ git add .
[chris@thinkpad kernel]$ git commit -m "Added 3.10.40 L4T kernel source"
[chris@thinkpad kernel]$ cp ../patch-3.10.* .
[chris@thinkpad kernel]$ git add -f patch-3.10.*
[chris@thinkpad kernel]$ git commit -m"Added RT patch files"
[chris@thinkpad kernel]$

Apply the patch

With the stock kernel from it’s quite easy to build a real time kernel, the patch will apply cleanly and normally you won’t encounter any build errors or stability issues. But the L4T kernel source has quite some modifications:

[chris@thinkpad TK1]$ wget
[chris@thinkpad TK1]$ tar -xf linux-3.10.40.tar.xz
[chris@thinkpad TK1]$ tar -xf kernel_src.tbz2
[chris@thinkpad TK1]$ git diff --dirstat linux-3.10.40 kernel
   3.2% kernel/arch/arm/boot/dts/tegra124-platforms/
  15.4% kernel/arch/arm/mach-tegra/
   3.1% kernel/arch/
   3.5% kernel/drivers/gpu/nvgpu/gk20a/
   3.9% kernel/drivers/input/
   4.4% kernel/drivers/media/platform/tegra/
   3.1% kernel/drivers/misc/
   3.7% kernel/drivers/net/wireless/bcmdhd/include/
   6.4% kernel/drivers/net/wireless/bcmdhd/
   6.7% kernel/drivers/net/wireless/sd8897/mlan/
   5.2% kernel/drivers/net/wireless/sd8897/mlinux/
   3.2% kernel/drivers/video/tegra/dc/
   3.2% kernel/drivers/video/
  18.8% kernel/drivers/
   4.0% kernel/include/
   4.3% kernel/sound/soc/codecs/
   3.1% kernel/sound/soc/
   3.6% kernel/
[chris@thinkpad TK1]$

So it won’t be that easy and we will have some more work.


Mon, 18 May 2015 00:00:00 +0200 <![CDATA[Debugging the Linux kernel via JTAG on the NVIDIA Jetson TK1 / Jetson Pro DevKit]]> Debugging the Linux kernel via JTAG on the NVIDIA Jetson TK1 / Jetson Pro DevKit
NVIDIA Jetson TK1 development kit

NVIDIA Jetson TK1 development kit

While it might not be possible to debug the Tegra K1 SOC in those development kits using cheaper debugging hardware or OpenOCD, it is possible using a TRACE32-ICD (In-Circuit Debugger) and the TRACE32-PowerView software from Lauterbach.

The Hardeware

I’m using a LA-7708 DEBUG-USB2 along with a LA-7843 JTAG CORTEX-A/R adapter connected to either the Jetson TK1 or Jetson Pro development kit.

LA-7708 DEBUG-USB2 connected to Jetson TK1

LA-7708 DEBUG-USB2 connected to Jetson TK1


Sat, 16 May 2015 00:00:00 +0200 <![CDATA[Building the Yocto GENIVI Baseline]]> Building the Yocto GENIVI Baseline
Yocto GENIVI Baseline inside QEMU

Yocto GENIVI Baseline inside QEMU

About the Yocto GENIVI Baseline

Yocto Project:

The Yocto Project is a Linux Foundation workgroup whose goal is to produce tools and processes that will enable the creation of Linux distributions for embedded software.


GENIVI Alliance:

The GENIVI Alliance is a non-profit automotive industry alliance committed to driving the broad adoption of an In-Vehicle Infotainment (IVI) open-source development platform. The GENIVI Alliance was founded on March 2, 2009 by BMW Group, Delphi, GM, Intel, Magneti-Marelli, PSA Peugeot Citroen, Visteon, and Wind River Systems.


The Yocto GENIVI Baseline is a GENIVI compliant reference system based on the Yocto Project.

Build a QEMU image that contains GENIVI components

Note: This will need around 27 GB of free hard disk space.


Thu, 18 Dec 2014 00:00:00 +0100 <![CDATA[Recap: Yocto Project Developer Day - ELCE 2014]]> Recap: Yocto Project Developer Day - ELCE 2014 ../../../_images/IMG_2950_small.JPG ../../../_images/IMG_2945_small.JPG ../../../_images/IMG_2958_small.JPG


Some days have passed since the Yocto Project Developer Day, now it’s time for a recap.

Preliminary Note

If you have not taken part in the Yocto Project Developer Day then this article should give you all the information you need to work through the Advanced Lab: IoT Development on your own and learn more about embedded Linux development with the Yocto Project.

All you need is a PC running Linux. If you want to test your code on real hardware too then you will also need some LEDs, Resitors, Buttons (parts list) and either the MinnowBoard Max, the BeagleBone Black or the WandBoard Quad.

The Yocto Project Developer Day

This Year it was my first time at the Embedded Linux Conference Europe, it was really a great time. I also took the opportunity to attend the Advanced Lab: IoT Development at the co-located Yocto Project Developer Day which will be the topic for this article.

The registration fee was $79.00 and we could choose either the MinnowBoard Max, the BeagleBone Black or the WandBoard Quad to deploy our code on and keep everything in the end.

I took the WandBoard Quad which has a Freescale i.MX6 Quad processor, 2GB of DDR3 memory, microSD slot, HDMI, USB, USB OTG, SATA, Gigabit LAN, WiFi (802.11n), Bluetooth and some other interfaces. Pretty impressive in my opinion :)

We got plenty of cool stuff, thanks to the sponsors (Yocto Project, SanDisk, Texas Instruments, Intel Corporation, Wind River Systems, ExpEmb, TechNexion)

We got plenty of cool stuff, thanks to the sponsors (Yocto Project, SanDisk, Texas Instruments, Intel Corporation, Wind River Systems, ExpEmb, TechNexion).

Advanced Lab: IoT Development

Advanced Lab: IoT Development - David Reyna, Mark Hatle, Wind River Systems

This advanced hands-on lab leads attendees through the decision process to determine the contents of an image for an IoT-focused device. The lab requires attendees to use their own laptops to connect to a virtual private cloud server, where they will perform the builds as if they were local and then see the results using their chosen board, with any needed peripherals provided. You will use the provided board and then take it home with you, and the lab will continue to be accessible after the conference. (slides (mirror))

IoT Hero

IoT Hero

The Mission

The Mission


Thu, 04 Dec 2014 00:00:00 +0100 <![CDATA[Getting started with the Papilio Pro and Xilinx ISE on Linux]]> Getting started with the Papilio Pro and Xilinx ISE on Linux
Papilio Pro with LEDs and OV2640 camera module

Papilio Pro with LEDs and OV2640 camera module

My Papilio Pro arrived some days (weeks...) ago, let’s get started^^

First have a look at the Papilio Quick Start Guide:

Check that the Hardware is OK

If I get new hardware the first thing I always do is to check if its working properly. Sometimes you have to flash a basic Hello World example yourself but the Papilio Pro should have been flashed with a bitstream file already that:

  • Toggles all of the even numbered pins
  • Configures all of the odd number pins as inputs. When a odd number pin is asserted it will cause the even pin next to it to stop blinking and stay at 3.3V.
  • Sends the ASCII table at 9600 8N1 over the serial port in a continuous loop.

Lets check that, connect the Papilio via USB to your PC and use screen to open the serial port:

[chris@thinkpad ~]$ sudo screen /dev/ttyUSB1 9600
ASCII Table ~ Character Map
!, dec: 33, hex: 21, oct: 41, bin: 100001
", dec: 34, hex: 22, oct: 42, bin: 100010
#, dec: 35, hex: 23, oct: 43, bin: 100011
$, dec: 36, hex: 24, oct: 44, bin: 100100
%, dec: 37, hex: 25, oct: 45, bin: 100101
&, dec: 38, hex: 26, oct: 46, bin: 100110
', dec: 39, hex: 27, oct: 47, bin: 100111
(, dec: 40, hex: 28, oct: 50, bin: 101000
), dec: 41, hex: 29, oct: 51, bin: 101001
*, dec: 42, hex: 2A, oct: 52, bin: 101010
+, dec: 43, hex: 2B, oct: 53, bin: 101011
,, dec: 44, hex: 2C, oct: 54, bin: 101100
-, dec: 45, hex: 2D, oct: 55, bin: 101101
., dec: 46, hex: 2E, oct: 56, bin: 101110
/, dec: 47, hex: 2F, oct: 57, bin: 101111
0, dec: 48, hex: 30, oct: 60, bin: 110000
1, dec: 49, hex: 31, oct: 61, bin: 110001
2, dec: 50, hex: 32, oct: 62, bin: 110010
3, dec: 51, hex: 33, oct: 63, bin: 110011
4, dec: 52, hex: 34, oct: 64, bin: 110100
5, dec: 53, hex: 35, oct: 65, bin: 110101
6, dec: 54, hex: 36, oct: 66, bin: 110110
7, dec: 55, hex: 37, oct: 67, bin: 110111
8, dec: 56, hex: 38, oct: 70, bin: 111000
9, dec: 57, hex: 39, oct: 71, bin: 111001
:, dec: 58, hex: 3A, oct: 72, bin: 111010
;, dec: 59, hex: 3B, oct: 73, bin: 111011
<, dec: 60, hex: 3C, oct: 74, bin: 111100
=, dec: 61, hex: 3D, oct: 75, bin: 111101
>, dec: 62, hex: 3E, oct: 76, bin: 111110
?, dec: 63, hex: 3F, oct: 77, bin: 111111
@, dec: 64, hex: 40, oct: 100, bin: 1000000
A, dec: 65, hex: 41, oct: 101, bin: 1000001
B, dec: 66, hex: 42, oct: 102, bin: 1000010
C, dec: 67, hex: 43, oct: 103, bin: 1000011
Really kill this window [y/n]
[screen is terminating]
[chris@thinkpad ~]$

So this looks good, now the pins, you can easily check this if you connect an LED with a series resistor to 5V and PIN14 like seen in the tittle image. Then the LED should blink. Yippee!


Fri, 12 Sep 2014 00:00:00 +0200 <![CDATA[Installing Xilinx ISE inside a Docker Container]]> Installing Xilinx ISE inside a Docker Container
Installing Xilinx ISE WebPACK inside a Docker Container

Installing Xilinx ISE WebPACK inside a Docker Container

Xilinx ISE WebPACK is a proprietary IDE that can be used for synthesis and analysis of VHDL designs.

This is a follow-up post from Sandboxing proprietary applications with Docker, so you might want to read this first.


ISE WebPACK can be downloaded at no charge from the URL below after you have signed up on the Xilinx website.

I have chosen to download ISE Design Suite - 14.7 Full Product Installation, Full Installer for Linux (TAR/GZIP - 6.09 GB). It’s quite a huge file so its a good idea to use some download manager like wget.


Instead of installing it directly on your host system we will install it into a Docker container that we have already prepared in the previous post.

To launch it just use the dockapp script with the -u option to make sure that the container has no network access:

[chris@thinkpad ~]$ dockapp run -u
[chris@thinkpad ~]$ dockapp view
Docker container without network access

Docker container without network access

The dockapp script will mount /home/$USER/share/docker/ automatically as /share inside the docker container so that we can easily access the installation tarball Xilinx_ISE_DS_Lin_14.7_1015_1.tar:

root@58f422d5ae63:/# ls -l share/
total 6385388
-rw-rw-r--. 1 app  app           5 Sep  4 15:40 Text File
-rw-------. 1 app  app  6538618880 Oct 18  2013 Xilinx_ISE_DS_Lin_14.7_1015_1.tar
-rwxrwxr-x. 1 app  app        1405 Sep  9 15:05 dockapp-start
-rw-r--r--. 1 root root          5 Sep  7 14:19 test.txt

Now we have two possibilities, install Xilinx ISE as root:

  • The setup will make changes to the root file system and we should commit them to a new Docker image, see here how this works.
  • The setup will be able to install Xilinx cable drivers

or install it it as unprivileged user:

  • From a security standpoint it should not make a huge difference since everything is running inside a container (at least in the future):

    Recent improvements in Linux namespaces will soon allow to run full-featured containers without root privileges, thanks to the new user namespace. This is covered in detail here. Moreover, this will solve the problem caused by sharing filesystems between host and guest, since the user namespace allows users within containers (including the root user) to be mapped to other users in the host system.

  • Installing Xilinx cable drivers will fail, but probably I don’t need them and you can install them later or rerun the setup.

I will start with installing it as unprivileged user app:

root@58f422d5ae63:/# su app
app@58f422d5ae63:/$ cd share/
app@58f422d5ae63:/share$ tar -xf Xilinx_ISE_DS_Lin_14.7_1015_1.tar
app@58f422d5ae63:/share$ cd Xilinx_ISE_DS_Lin_14.7_1015_1
app@58f422d5ae63:/share/Xilinx_ISE_DS_Lin_14.7_1015_1$ ./xsetup
Xilinx Setup inside a Docker container

Xilinx Setup inside a Docker container

It’s not possible to disable Xilinx’s WebTalk feature during installation... But luckily for us we have already disabled the network connection for the Docker container^^

Enables WebTalk to send software, IP and device usage statistics to Xilinx. For more information on WebTalk, please see Section 13 of the Xilinx End-User License Agreement and the WebTalk FAQ at:


Mon, 08 Sep 2014 00:00:00 +0200 <![CDATA[Sandboxing proprietary applications with Docker]]> Sandboxing proprietary applications with Docker


Docker is an open-source project that automates the deployment of applications inside software containers, providing that way an additional layer of abstraction and automatization of operating system-level virtualization on Linux. Docker uses resource isolation features of the Linux kernel such as cgroups and kernel namespaces to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting virtual machines.

Getting Started

The Docker documentations is very good, so this is where you should start:

Installing Docker

Just follow the guide for your Linux distribution:

On Fedora it looks like this:

[chris@thinkpad ~]$ sudo yum -y install docker-io
[chris@thinkpad ~]$ sudo systemctl start docker
[chris@thinkpad ~]$ sudo systemctl enable docker
[chris@thinkpad ~]$ sudo usermod -a -G docker chris # to run docker without sudo


To securely use USB devices inside Docker containers we need at least Docker 1.2.0. Since Fedora 20 is still shipping Docker 1.1.2 we have to enable the updates-testing repository while installing docker:

[chris@thinkpad ~]$ sudo yum --enablerepo=updates-testing install docker-io

User Guide

Now follow the user guide to get a bit familiar with the basics of Docker:

Docker Security

Some notes about Docker security:

Docker supports a so called “privileged” mode that was previously necessary to access USB devices for example (docker run -t -i -privileged -v /dev/bus/usb:/dev/bus/usb ubuntu bash). But this mode is really unsafe and should not longer be used. The Docker 1.2 release introduced two new flags for docker run --cap-add and --cap-drop that give a more fine grain control over the capabilities of a particular container.

One of the (many!) features of Docker 0.6 is the new “privileged” mode for containers. It allows you to run some containers with (almost) all the capabilities of their host machine, regarding kernel features and device access. [...] Note, however, that there are serious security implications there: since the private Docker instances run in privileged mode, they can easily escalate to the host, and you probably don’t want this!

Dockerizing your Application

The Interactive Approach


Start a new Docker container with Ubuntu 14.04, the first time you start it it will download the Ubuntu 14.04 base image (213 MB) automatically:

[chris@thinkpad ~]$ docker run ubuntu:14.04 /bin/echo 'Hello world'



[chris@thinkpad ~]$ docker run -i -t fedora /bin/bash
[chris@thinkpad ~]$ docker run -i -t fedora:20 /bin/bash

Let’s see what we can do with that image (

[chris@thinkpad ~]$ docker run -it ubuntu:14.04 /bin/bash
root@65a77c4901b3:/# echo "test"> test.txt
root@65a77c4901b3:/# cat test.txt
root@65a77c4901b3:/# exit
[chris@thinkpad ~]$ docker run -it ubuntu:14.04 /bin/bash
root@c688e3146470:/# cat test.txt
cat: test.txt: No such file or directory

As seen above, if we change something and start the image again a new container will be created and all changes are gone, but nothing is lost as we can restart old containers (

The command docker ps shows all our running containers:

[chris@thinkpad ~]$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED
c688e3146470        ubuntu:14.04        "/bin/bash"         About a minute ago

STATUS              PORTS               NAMES
Up About a minute                       drunk_torvalds
[chris@thinkpad ~]$

Whereas docker ps -a lists all containers:

[chris@thinkpad ~]$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED
c688e3146470        ubuntu:14.04        "/bin/bash"         4 minutes ago
65a77c4901b3        ubuntu:14.04        "/bin/bash"         5 minutes ago

STATUS                     PORTS               NAMES
Up 4 minutes                                   drunk_torvalds
Exited (0) 4 minutes ago                       stupefied_mestorf
[chris@thinkpad ~]$

We can use the name of the old container (stupefied_mestorf) to start it again and reattach:

[chris@thinkpad ~]$ docker start stupefied_mestorf
[chris@thinkpad ~]$ docker attach stupefied_mestorf
root@65a77c4901b3:/# cat test.txt

Short form (with container ID or container name):

[chris@thinkpad ~]$ docker start -ai 65a77c4901b3
root@65a77c4901b3:/# cat test.txt


Sat, 06 Sep 2014 00:00:00 +0200 <![CDATA[Let's be paranoid and secure our penguins]]> Let’s be paranoid and secure our penguins Docker

The goal of this article is to give a short overview of practical solutions to run untrusted proprietary applications under Linux while limiting the damage that they can do and to prevent possible privacy exploits.

There is a interesting section in the Arch Linux Wiki about Securing Skype that got me thinking about it:

There are a couple of reasons you might want to restrict Skype’s access to your computer: The skype binary is disguised against decompiling, so nobody is (still) able to reproduce what it really does and it produces encrypted traffic even when you are not actively using Skype.

Trust the Vendor

Just assume the software has no security flaws, no remote exploitable bugs, AutoUpdate uses a secure HTTPS connection and checks the certificates, that it does not gather usage statistics or send crash reports that may contain sensitive information...

[chris@thinkpad ~]$ sudo ./proprietary_crap.bin

Pros: No additional work needed

Cons: No protection, the software may break your system, or worse

Comment: It just feels not right, I want a clean system without programs where I don’t know what they are doing in the background.

Different User Account

So this is probably the easiest solution, just add a new user account.


  • Easy to set up

    [chris@thinkpad ~]$ sudo useradd evil
    [chris@thinkpad ~]$ sudo passwd evil
    Changing password for user evil.
    New password:
    Retype new password:
    passwd: all authentication tokens updated successfully.
    [evil@thinkpad ~]$
  • Easy to use “su - special_user”

    [chris@thinkpad ~]$ su - evil
    [evil@thinkpad ~]$ ps -Af|grep chris |tail -n1
    chris    22265     1  0 02:04 ?        00:00:17 okular /var/tmp/sandboxing-notes.pdf --icon okular -caption Okular
    [evil@thinkpad ~]$ ls /home/chris/.gnupg/
    ls: cannot access /home/chris/.gnupg/: Permission denied
    [evil@thinkpad ~]$
  • No extra work needed to start X11 applications

    [evil@thinkpad ~]$ firefox &
    [1] 7628
    [evil@thinkpad ~]$


  • Full network access, using iptables to restrict network access for a single user way too complex and thus prone to security lapses

  • Running on the same X server

    Any application that has access to the X server can do a lot of things. It can snoop on other applications that display windows on the same server. It can log key presses. It can rebind keys. It can inject key presses into other applications. It has access to the clipboard. –

  • See the full process list with command arguments “ps -Af” and more...

  • What about SUID binaries?


  • The user evil should not be allowed to use sudo.
  • At least it protects your files in your home directory a little bit.


Fri, 05 Sep 2014 00:00:00 +0200 <![CDATA[Review: Saleae Logic16 Logic Analyzer]]> Review: Saleae Logic16 Logic Analyzer

My newest toy is a sixteen channel Saleae logic analyzer:

../../../_images/saleae_logic16_1_small.jpg ../../../_images/saleae_logic16_2_small.jpg ../../../_images/saleae_logic16_3_small.jpg

The Saleae Logic16 is one of the very few cross platform logic analyzers available, with application software that runs under Linux, Windows, and on the Mac.

Below you will find my first impressions, if you would like to know something more specific then ask in the comments or have a look at the Saleae homepage.


It works with logic levels between 1.8V and 5V, you either select 1.8V to 3.6V or 3.6 to 5.0V from the menu. The lower voltage settings should work in most circumstances. The 5V setting is provided to reduce the likelihood of channel to channel crosstalk when using 5V signals.

The inputs are protected against overvoltage (high DC impedance, low-capacitance diode clamps) and a resettable fuse protects the USB ground return line.

It can sample 2 channels at 100MHz, 4 channels at 50MHz, 8 channels at 25MHz or all 16 channels at 12.5MHz and can record up to 10 billion samples.

The aluminum case looks high-end and the carrying case is really nice and handy.

I haven’t opened the device and don’t know what’s inside, I would guess some kind of FPGA but that’s all I can tell at the moment. (Update: a very nice review on YouTube:


The software is cross platform and works on Linux, Windows, & Mac. There is also an SDK available for writing your own analyzer plugins in c++ and a device API, which provides low-level access to the logic analyzer.


  • Download the Logic 1.1.15 (64-bit).zip from or the beta version from
  • Extract it somewhere
  • And run the install_driver script, which only copies the udev rules file 99-SaleaeLogic.rules to /etc/udev/rules.d/99-SaleaeLogic.rules


  • Supported Protocols: asynchronous serial, I2C, SPI, CAN, 1-Wire, UNI/O, I2S/PCM, MP Mode 9-bit Serial (i.e. Multidrop and Multiprocessor mod), Manchester, DMX-512, Parallel, JTAG*, LIN*, Atmel SWI*, MDIO*, BiSS C*, PS/2 Keyboard/Mouse*, HDLC*, HMDI CEC*, and USB 1.1*. (* currently in beta)
  • Measure pulse wide and period and calculate frequency
  • Measurement cursors
  • Export data in different formats
  • ...

Some experiments

Generally a logic analyzer has the advantage (compared to using another micro controller, what I’ve done until now), that you can not only see the decoded data, but also the timings and that you can analyze unspecified protocols. A logic analyzer has also mush more channels than an oscilloscope and can capture a large amount of digital data.

Async serial

Recently I bought some cheap FT232RL USB to TTL serial adapters from eBay that work with 3.3V and 5V logic levels.

After adding a serial decoder and specifying which channel should be decoded I can see the decoded characters right above the signal:

Saleae Logic16: Decoding "Test\r\n"

Saleae Logic16: Decoding “Test\r\n”


Sun, 01 Dec 2013 00:00:00 +0100 <![CDATA[Arch Linux ARM: Network tools missing]]> Arch Linux ARM: Network tools missing


The newest Arch Linux ARM image for the OLinuXino ( ships without the tools needed to configure a wireless connection.


Other people are experiencing the same problem, why remove such fundamental tools, and the hint pacman -S wireless_tools is not very helpful if you have no internet connection.

So how should I install additional tools if can’t setup an internet connection.

Let’s try to download them on another PC, copy them to the SD card and then install them on the OLinuXino.


Sat, 30 Nov 2013 00:00:00 +0100 <![CDATA[Installing CadSoft Eagle 6.5 in Fedora 19 x86_64]]> Installing CadSoft Eagle 6.5 in Fedora 19 x86_64

“Linux users please download the file and run it. This self-extracting shell script will guide you through the setup process. You may need to click on the above link with the right mouse button and select “Save Link As…”. To run this file you need to make it executable, or enter “sh” in a shell window. System requirements: Linux based on kernel 2.6 for Intel computers, X11 with a minimum color depth of 8 bpp, 32-bit runtime environment with the libraries and”


32-bit runtime libraries

[chris@thinkpad ~]$ sudo yum install glibc.i686 libXrender.i686 libXrandr.i686 libXcursor.i686 libXi.i686 freetype.i686 fontconfig.i686 libstdc++.i686 zlib.i686 and

[chris@thinkpad ~]$ sudo yum install openssl-libs.i686
[chris@thinkpad ~]$ sudo ln -s /usr/lib/ /usr/lib/
[chris@thinkpad ~]$ sudo ln -s /usr/lib/ /usr/lib/ and

Not longer needed.

[chris@thinkpad Downloads]$  yum install glibc-devel.i686 zlib-devel.i686
[chris@thinkpad Downloads]$ wget
[chris@thinkpad Downloads]$ tar -xzf libpng-1.4.12.tar.gz
[chris@thinkpad Downloads]$ cd libpng-1.4.12
[chris@thinkpad libpng-1.4.12]$ ./configure --prefix=/usr --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
[chris@thinkpad libpng-1.4.12]$ make
[chris@thinkpad libpng-1.4.12]$ sudo make install
[chris@thinkpad Downloads]$ wget
[chris@thinkpad Downloads]$ tar -xzf jpegsrc.v8d.tar.gz
[chris@thinkpad Downloads]$ cd jpeg-8d/
[chris@thinkpad jpeg-8d]$ ./configure --prefix=/usr --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
[chris@thinkpad jpeg-8d]$ make
[chris@thinkpad jpeg-8d]$ sudo make install

And finally Eagle

[chris@thinkpad Downloads]$ wget
[chris@thinkpad Downloads]$ sh

Now you only need to create a menu entry in your launcher and the install is complete.

Thu, 28 Nov 2013 00:00:00 +0100 <![CDATA[Tiny, hackable (?) quadcopter from China for EUR 22 / USD 35]]> Tiny, hackable (?) quadcopter from China for EUR 22 / USD 35

I have a cool new gadget that is probably hackable too! Have a look:

I’ve ordered it on 21st of September from eBay and received it on 12th of October.


Sun, 13 Oct 2013 00:00:00 +0200 <![CDATA[Embedded development with open source tools on Windows]]> Embedded development with open source tools on Windows
Hello World from MinGW

Hello World from MinGW

Get a proper editor

You probably want to install Notepad++ or Programmer’s Notepad:

Install the GCC ARM Embedded toolchain

GNU Tools for ARM Embedded Processors:

Download the Windows installer from, for example:

And install it clicking everywhere next but choose a path without spaces, like C:\tools\gcc-arm-4.7-2013q3.

GCC ARM install location

GCC ARM install location


Thu, 10 Oct 2013 00:00:00 +0200 <![CDATA[Received my MC HCK prototype boards]]> Received my MC HCK prototype boards
My first MC HCK

My first MC HCK


The MC HCK (pronounced: “McHack” [mæk hæk]) is a small, cheap, and versatile microcontroller platform that supports USB for easy programming, and can be built at home for $5. The MC HCK enables everybody to build big and small projects, because spending >$20 for other microcontroller boards is just too much.

Quick Specs

Dimensions: 50mm x 20mm
Platform: ARM Cortex-M4 (DSP, no FPU)
MCU: Freescale MK20DX32VLF5: 8KB RAM, 32KB program flash + 32KB data flash
Data Sheet:
Reference Manual:
Application Notes etc:
Interface: USB, I2C, SPI, UART, I2S
Programming: via USB bootloader (DFU, Direct Firmware Update)
Debugging: A second MC HCK can be used as debug adapter
Board options: mounting hole, LiPo charger, nRF24L01+ directly pluggable, up to 8Mbit flash, LDO, buck regulator, boost regulator, RTC crystal

I’ve already ordered a MC HCK prototype kit in July (, they were ready for dispatch on 30th September and now I have received them.


MC HCK Envelope

MC HCK Envelope

The letter contained the following components:

MC HCK Prototype Kit Contents

MC HCK Prototype Kit Contents


Mon, 07 Oct 2013 00:00:00 +0200 <![CDATA[Porting Linux to a new board]]> Porting Linux to a new board


This post is work in process.

I haven’t done this before so I’m a bit nervous whether I get everything working but lets try it.

It’s gorgeous to have a device that will become a consumer device and a goal to do some real development instead of just doing generic experiments with the OLinuXino boards. Now I’m forced to dig through the code to solve all the problems. It makes a lot of fun and I’m also learning a lot.

About the iMX233 Audio Development Board

You can think of the iMX233 Audio Development Board like of a iMX233 based development board to build yourself a MP3 player with the ability to record audio. If I’m correct then it uses the same audio codec like the Apple 8GB iPod nano [1] [2]. The contour of the later handheld device is already printed on the board. I don’t know what the future brings, but it might get released as open source hardware. For more information please visit:


Sat, 31 Aug 2013 00:00:00 +0200 <![CDATA[Debugging the iMX233-OLinuXino via SJTAG with OpenOCD]]> Debugging the iMX233-OLinuXino via SJTAG with OpenOCD

What you will need


OlinuXino Micro, iMX233-SJTAG, SEGGER J-Link, ARM-USB-TINY



Sat, 24 Aug 2013 00:00:00 +0200 <![CDATA[iMX233-OLinuXino: Current State]]> iMX233-OLinuXino: Current State

This post is work in process so print it into an PDF file if you want to keep an older version as reference.

The Kernel

Please have a look at Building a kernel 3.x for the iMX233-OLinuXino for more detailed build instructions.

You can use a kernel straight from

[chris@thinkpad OLinuXino]$ git clone git:// linux-stable.git
[chris@thinkpad OLinuXino]$ cd linux-stable.git/
[chris@thinkpad linux-stable.git]$ git checkout v3.12
[chris@thinkpad linux-stable.git]$


There is also linux-next with some more bleeding edge kernels:

[chris@thinkpad OLinuXino]$ git clone git:// linux-next.git
[chris@thinkpad linux-next.git]$ git checkout next-20130909

To add support for i2c we need to apply the following patch:

[chris@thinkpad linux-stable.git]$ wget
[chris@thinkpad linux-stable]$ patch -p1 < 0001-ARM-imx23-olinuxino-Add-i2c-support.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
patching file arch/arm/boot/dts/imx23.dtsi
Hunk #1 succeeded at 306 with fuzz 2 (offset -1 lines).
Hunk #2 succeeded at 472 (offset -1 lines).
[chris@thinkpad linux-stable.git]$

And to get a spi device we need to apply the following patch:

[chris@thinkpad linux-stable.git]$ curl -L -o 0005-ARM-imx23-olinuxino-Add-spidev.patch
[chris@thinkpad linux-stable.git]$ patch -p1 < 0005-ARM-imx23-olinuxino-Add-spidev.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
[chris@thinkpad linux-stable]$

Now lets configure and build the kernel:


Sat, 04 May 2013 00:00:00 +0200 <![CDATA[Building ROS on Fedora 19]]> Building ROS on Fedora 19

About ROS

ROS (Robot Operating System) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license.


ROS is really a huge software package (a big mess!) and is unlikely that the official installation guide for Fedora ( will work without issues. Last time it took me several days to fix all build failures. This time I will document my odyssey.


Mon, 29 Apr 2013 00:00:00 +0200 <![CDATA[Upgraded to Fedora 19 Alpha alias Schrödinger’s Cat]]> Upgraded to Fedora 19 Alpha alias Schrödinger’s Cat
Fedora 19 Alpha KDE Splash Screen

Fedora 19 Alpha KDE Splash Screen

Fedora, formerly Fedora Core, is an RPM-based, general purpose collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and owned by Red Hat. The Fedora Project’s mission is to lead the advancement of free and open source software and content as a collaborative community.


Last weekend I was brave enough to install the KDE spin of Fedora 19 Alpha on my main working laptop and as by now everything is running great.

So get it now (torrents), have a look at the release schedule for the final release date or study the feature list to see what’s new.

Up until then I was still running Fedora 17 alias Beefy Miracle but slowly it feels old and I had to install some more recent packages from Fedora 18 to be able to compile other programs.

So it was time to upgrade to and since i know how to fix a broken system I decided to skip Fedora 18 and directly install Fedora 19 Alpha.

I’ve done a clean install and before the upgrade I’ve backed up the most important configuration files as well as my home directory. I was able to crash the installer four or five times but then everything went well.

Before the upgrade I’ve created a list of all my installed packages:

[chris@fedora-17 ~]$ rpm -qa --queryformat "%{NAME}.%{ARCH}\n" >packages_thinkpad_F19.log

So that I can reinstall them all at once:

[chris@fedora-19 ~]$ sudo yum -y --skip-broken install $(cat ./packages_thinkpad_before_F19.log )

This will also install a lot of packages that I don’t need anymore (1643 packages +192 dependent packages) but it will save a me lot of time as I don’t have to find all dependencies again when compiling something from source and disk space is cheap nowadays.

You can find my current package list here: packages_thinkpad_F19.log

I’m very happy that sagemath has finally made it into Fedora (sudo yum install sagemath).

Now I have to rebuild all packages that I had installed from sources and then I’m finished.

Btw. I’m running kernel 3.9.0-0.rc8.git0.2.fc19.x86_64 and KDE 4.10.2 at the moment.

If I encounter any update problems or other issues until the final release I will update the blog post below. Lets see how it evolves.


Mon, 29 Apr 2013 00:00:00 +0200 <![CDATA[How to find performance bottlenecks in your application]]> How to find performance bottlenecks in your application
This is a part of a KCachegrind window

This is a part of a KCachegrind window

Profiling your application to find performance bottlenecks is easier then you may think, I’m using gperftools and KCachegrind to profile Laustracker that makes heavy use of OpenCV functions.

Before you can start profiling you need to install the following tools:

[chris@thinkpad ~]$ sudo yum install pprof gperftools-libs kdesdk-kcachegrind


Wed, 27 Feb 2013 00:00:00 +0100 <![CDATA[Code formatting using shell script]]> Code formatting using shell script

This is a little script to automatically format source code of different languages, just copy it into a directory that is in your PATH.

You can also add an alias to your ~/.bashrc

alias cstyle='cs style'
alias cclean='cs clean'
# (or short cs)
#   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   A little script to automatically apply my preferred coding style
#   to all .c, .cpp, .h, .java and .py files in and below the current directory
#   Just copy it into a directory that is in your PATH and rename the file to cs.
#   Author: Christian Jann <christian 0x2e jann 0x40 ymail 0x2e com>
#   URL:
#   Requirements:
#     * astyle (
#     * autopep8 (
#       (only if it finds Python files)

case "$1" in
        echo "Formating source files..."
        # Modified kdelibs coding style as defined in

        find -regex ".*\.\(c\|cpp\|h\|java\)" -exec \
            astyle --indent=spaces=4 --brackets=break \
              --indent-labels --pad-oper --unpad-paren --pad-header \
              --keep-one-line-statements --convert-tabs \
              --indent-preprocessor "{}" \;

        # Other variants:
          # Maybe use --mode=java for java files, --mode=c

          # find . -perm -200 -regex ".*[.][CHch]p*" -exec astyle \
          #    --suffix=none --style=ansi --convert-tabs "{}" \;

          # find -regex ".*[.][CHch]p*" -exec astyle  --style=attach "{}" \;

          # astyle --indent=spaces=4 --brackets=break \
          #     --indent-labels --pad-oper --unpad-paren --pad-header \
          #     --keep-one-line-statements --convert-tabs \
          #     --indent-preprocessor \
          #     `find -type f -name '*.c'` \
          #     `find -type f -name '*.cpp'` \
          #     `find -type f -name '*.h'` \
          #     `find -type f -name '*.java'`

        # Apply coding conventions for Python code
        # sudo pip-python install --upgrade autopep8
        for file in $(find . -name "*.py")
          #echo "Creating backup: $file.orig"
          #cp -v $file{,.orig}
          cp $file{,.orig}

          #echo "Formating file: $file"
          autopep8 -i "$file"

          diff "$file" "$file.orig" >> /dev/null  \
            && echo "Unchanged  $file" || echo "Formatted  $file"
        echo "Deleting temporary files and backup copies..."
        #find . \( -name "*.orig" -or -name "*~" \) -exec rm -v "{}" \;
        #find -regex ".*\(orig\|~\|pyc\|bak\)" -delete
        find -regex ".*\(orig\|~\|pyc\|bak\)" -exec rm -v "{}" \;
        echo "run 'cs style' to format all"\
            ".c .cpp .h .java and .py files recursively"

        echo "run 'cs clean' to delete temporary"\
            "files and backup copies (*.orig)"


Wed, 20 Feb 2013 00:00:00 +0100 <![CDATA[Laustracker: Using computer vision to track little robots moving through a labyrinth]]> Laustracker: Using computer vision to track little robots moving through a labyrinth
Laustracker3D using OpenSceneGraph

Laustracker3D using OpenSceneGraph


Sun, 17 Feb 2013 00:00:00 +0100 <![CDATA[The "cu" command]]> The “cu” command

From a given occasion a short introduction to the cu command.

The cu command is used to call up another system and act as a dial in terminal. It can also do simple file transfers with no error checking.

minicom is another popular serial communication program. Unfortunately, many users have reported problems using it with U-Boot and Linux, especially when trying to use it for serial image download. It’s use is therefore discouraged.

Other alternatives are screen, picocom and kermit.

Install the “cu” command

[chris@thinkpad ~]$ sudo yum install uucp

Configure the “cu” command

[chris@thinkpad ~]$ sudo vim /etc/uucp/sys
[chris@thinkpad ~]$ cat /etc/uucp/sys
# This is an example of a sys file. This file is syntax compatible
# with Taylor UUCP (not HDB, not anything else). Please check uucp
# documentation if you are not sure how to configure Taylor UUCP config files.
# Edit the file as appropriate for your system, there are sample files
# in /usr/share/doc/uucp-1.07/samples.

# Everything after a '#' character is a comment.

# /dev/ttyUSB0 at 115200 bps:
system          USB0@115200
port            serial0_115200
time            any

[chris@thinkpad ~]$ sudo vim /etc/uucp/port
[chris@thinkpad ~]$ cat /etc/uucp/port
# This is an example of a port file. This file is syntax compatible
# with Taylor UUCP (not HDB, not anything else). Please check uucp
# documentation if you are not sure how to configure Taylor UUCP config files.
# Edit the file as appropriate for your system, there are sample files
# in /usr/share/doc/uucp-1.07/samples.

# Everything after a '#' character is a comment.

# /dev/ttyUSB0 at 115200 bps:

port            serial0_115200
type            direct
device          /dev/ttyUSB0
speed           115200
hardflow        false

[chris@thinkpad ~]$

Connect to the serial line

[chris@thinkpad ~]$ cu USB0@115200

U-Boot 2013.01-00033-g852e10a-dirty (Feb 07 2013 - 16:21:11)

CPU:   Freescale i.MX23 rev1.4 at 454 MHz
DRAM:  64 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0
mmc0 is current device
462 bytes read in 0 ms
Loaded environment from uEnv.txt
Importing environment from mmc ...
3684752 bytes read in 0 ms
8450 bytes read in 0 ms
Booting from mmc ...
## Booting kernel from Legacy Image at 42000000 ...
  Image Name:   Linux-3.7.6-dirty
  Image Type:   ARM Linux Kernel Image (uncompressed)
  Data Size:    3684688 Bytes = 3.5 MiB
  Load Address: 40008000
  Entry Point:  40008000
  Verifying Checksum ... OK
## Flattened Device Tree blob at 41000000
  Booting using the fdt blob at 0x41000000
  Loading Kernel Image ... OK
  Using Device Tree in place at 41000000, end 41005101

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.7.6-dirty (chris@thinkpad) (gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded Processors) ) #1 Tue Feb 5 11:02:16 CET 2013

Copy a file over the serial line

Create a test file on your Linux PC:

[chris@thinkpad ~]$ echo "This is a test file" >> testfile.txt
[chris@thinkpad ~]$ cat testfile.txt
This is a test file
[chris@thinkpad ~]$

To copy a file from the local system to the remote system, enter:

[root@olinuxino ~]# ~p testfile.txt
Remote file name [testfile.txt]:
[file transfer complete]
[root@olinuxino ~]# ls
fixterm  led_blink  testfile.txt  wconfig
[root@olinuxino ~]# cat testfile.txt
This is a test file
[root@olinuxino ~]#

To copy a file from the remote system to the local system, enter:

[root@olinuxino ~]# ~t /var/log/messages.log
Local file name [messages.log]: olinuxino_messages.log
[file transfer complete]
[root@olinuxino ~]#
[chris@thinkpad ~]$ du -h olinuxino_messages.log
512K    olinuxino_messages.log
[chris@thinkpad ~]$ tail olinuxino_messages.log
Dec 31 18:34:32 olinuxino kernel: [ 2065.160000] wlan0: Selected IBSS BSSID ee:73:d9:ca:2e:92 based on configured SSID
Dec 31 18:34:32 olinuxino dhcpcd[141]: version 5.6.4 starting
Dec 31 18:34:32 olinuxino dhcpcd[141]: all: configured as a router, not a host
Dec 31 18:34:33 olinuxino dhcpcd[141]: wlan0: broadcasting for a lease
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: offered from
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: acknowledged from
Dec 31 18:34:36 olinuxino dhcpcd[141]: wlan0: checking for
Dec 31 18:34:41 olinuxino dhcpcd[141]: wlan0: leased for 3600 seconds
Dec 31 18:34:52 olinuxino dhcpcd[141]: forked to background, child pid 169
Dec 31 18:54:53 olinuxino -- MARK --
[chris@thinkpad ~]$


[root@olinuxino ~]# ~.

[chris@thinkpad ~]$
Sun, 10 Feb 2013 00:00:00 +0100 <![CDATA[U-Boot for the iMX233-OLinuXino]]> U-Boot for the iMX233-OLinuXino

Get U-Boot

[chris@thinkpad OLinuXino]$ git clone git:// u-boot.git
Cloning into 'u-boot.git'...
remote: Counting objects: 200191, done.
remote: Compressing objects: 100% (37411/37411), done.
remote: Total 200191 (delta 161097), reused 198842 (delta 159910)
Receiving objects: 100% (200191/200191), 50.43 MiB | 2.17 MiB/s, done.
Resolving deltas: 100% (161097/161097), done.
[chris@thinkpad OLinuXino]$ cd u-boot.git/
[chris@thinkpad u-boot.git]$ git checkout v2013.07 -b tmp
Switched to a new branch 'tmp'
[chris@thinkpad u-boot.git]$


Thu, 07 Feb 2013 00:00:00 +0100 <![CDATA[Lets play: CLI snake on the OLinuXino]]> Lets play: CLI snake on the OLinuXino
CLI snake over 115200 baud serial line

CLI snake over 115200 baud serial line


Thu, 07 Feb 2013 00:00:00 +0100 <![CDATA[A new SD card image for the iMX233-OLinuXino]]> A new SD card image for the iMX233-OLinuXino

Download the latest Arch Linux ARM SD card image

First download the latest image for the OLinuXino from

[chris@thinkpad Downloads]$ wget
[chris@thinkpad Downloads]$

Copy the image to your SD card

Now uncompress the image and add a timestamp to make it easier to distinguish different images:

[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 188339953 Jun  4 21:45 ArchLinuxARM-olinuxino-latest.img.gz
[chris@thinkpad Downloads]$ mv ArchLinuxARM-olinuxino-latest.img.gz  ArchLinuxARM-olinuxino-$(date +%Y-%m-%d -r ArchLinuxARM-olinuxino-latest.img.gz).img.gz
[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 188339953 Jun  4 21:45 ArchLinuxARM-olinuxino-2013-06-04.img.gz
[chris@thinkpad Downloads]$ gzip -d ArchLinuxARM-olinuxino-2013-06-04.img.gz
[chris@thinkpad Downloads]$ ls -l Arch*
-rw-rw-r--. 1 chris chris 2001731584 Jun  4 21:45 ArchLinuxARM-olinuxino-2013-06-04.img
[chris@thinkpad Downloads]$

The directory listing under will also tell you the modification time of the image. Our image has now the name ArchLinuxARM-olinuxino-2013-06-04.img.

The default behaviour of gzip is to delete the .gz file after it decompresses, if you want to keep it use the -c option to uncompress the file to stdout:

[chris@thinkpad Downloads]$ gzip -dc ArchLinuxARM-olinuxino-2013-06-04.img.gz > ArchLinuxARM-olinuxino-$(date +%Y-%m-%d -r ArchLinuxARM-olinuxino-latest.img.gz).img


Mon, 04 Feb 2013 00:00:00 +0100 <![CDATA[Using the Watchdog Timer in Linux]]> Using the Watchdog Timer in Linux

The Software Watchdog

First: build the Linux kernel with watchdog support, the full guide is located here:

Device Drivers  --->
  [*] Watchdog Timer Support  --->
    -*-   WatchDog Timer Driver Core
    <*>   Software watchdog

After a reboot with the new kernel there should be a /dev/watchdog file:

[root@alarm ~]# ls -l /dev/watchdog
crw------- 1 root root 10, 130 Jan  1 01:00 /dev/watchdog
[root@alarm ~]#

Next: you will need to install a watchdog daemon:

[root@alarm ~]# pacman -Sy watchdog
:: Synchronizing package databases...
core is up to date
extra                    450.8 KiB  7.72K/s 00:58 [######################] 100%
community                483.5 KiB  6.38K/s 01:16 [######################] 100%
alarm is up to date
aur is up to date
resolving dependencies...
looking for inter-conflicts...

Targets (1): watchdog-5.12-2

Total Download Size:    0.04 MiB
Total Installed Size:   0.18 MiB

Proceed with installation? [Y/n] y
:: Retrieving packages from extra...
watchdog-5.12-2-arm       41.9 KiB  76.1K/s 00:01 [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
(1/1) installing watchdog                          [######################] 100%
[root@alarm ~]#


Sat, 02 Feb 2013 00:00:00 +0100 <![CDATA[How to check the memory usage of your embedded Linux system]]> How to check the memory usage of your embedded Linux system

After reading a forum post here I had to check the the memory usage off my OLinuXino too.

I have a bit more free men but also not that mush:

[root@alarm ~]# cat /proc/version
Linux version 3.7.4-dirty (chris@thinkpad) (gcc version 4.7.3 20121207 (release) [ARM/embedded-4_7-branch revision 194305] (GNU Tools for ARM Embedded3
[root@alarm ~]# cat /proc/meminfo |head -n 10
MemTotal:          52188 kB
MemFree:           17636 kB
Buffers:            2380 kB
Cached:            19232 kB
SwapCached:            0 kB
Active:             9036 kB
Inactive:          17256 kB
Active(anon):       4708 kB
Inactive(anon):      168 kB
Active(file):       4328 kB
[root@alarm ~]# ps -aux |head -n 10
root         1  2.1  4.8   4768  2516 ?        Ss   01:00   0:03 /usr/lib/systemd/systemd
root         2  0.0  0.0      0     0 ?        S    01:00   0:00 [kthreadd]
root         3  0.1  0.0      0     0 ?        S    01:00   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    01:00   0:00 [kworker/0:0]
root         5  0.0  0.0      0     0 ?        S<   01:00   0:00 [kworker/0:0H]
root         6  0.0  0.0      0     0 ?        S    01:00   0:00 [kworker/u:0]
root         7  0.0  0.0      0     0 ?        S<   01:00   0:00 [kworker/u:0H]
root         8  0.0  0.0      0     0 ?        S    01:00   0:00 [watchdog/0]
root         9  0.0  0.0      0     0 ?        S<   01:00   0:00 [khelper]
[root@alarm ~]#

Disable systemd-journald storage

It seems systemd-journald is using most memory on my system:

[root@alarm ~]# ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5
10.5  0.4  69648    58 /usr/lib/systemd/systemd-journald
5.6  0.1   7040    96 /usr/sbin/syslog-ng -F
4.8  0.5   4768     1 /usr/lib/systemd/systemd
4.2  0.0   6272    94 /usr/sbin/sshd -D
3.3  0.1   3268   140 -bash
[root@alarm ~]#


Sat, 02 Feb 2013 00:00:00 +0100 <![CDATA[Control your light at home with a Raspberry Pi and Olimex's MOD-IO2]]> Control your light at home with a Raspberry Pi and Olimex’s MOD-IO2

Since I’ve won the RPI-UEXT + MOD-IO2 I had to test it and this is the result.

Controlling your light is just an example, you can control nearly everything from everywhere in the world.


Mon, 21 Jan 2013 00:00:00 +0100 <![CDATA[Control the MOD-IO2 via i2c on Raspbian]]> Control the MOD-IO2 via i2c on Raspbian

This is just a short summary, the full guide is located here.

Edit /etc/modprobe.d/raspi-blacklist.conf and comment out the line that says blacklist i2c-bcm2708, then reboot.

pi@raspberrypi ~ $ sudo vim /etc/modprobe.d/raspi-blacklist.conf
pi@raspberrypi ~ $ cat /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi and i2c by default (many users don't need them)

blacklist spi-bcm2708
#blacklist i2c-bcm2708
pi@raspberrypi ~ $ sudo reboot
Broadcast message from root@raspberrypi (pts/1) (Mon Jan 21 11:28:05 2013):
The system is going down for reboot NOW!
pi@raspberrypi ~ $

After the reboot:


Mon, 21 Jan 2013 00:00:00 +0100 <![CDATA[A late Christmas present]]> A late Christmas present

Every Friday Olimex is doing quiz where you can win development boards and the like, if you are following Olimex on Twitter you may already know that I’ve won the FRIDAY FREE BOARD QUIZ ISSUE #26.

And it has arrived today:

Now it’s time to dig out my Raspberry Pi and do something useful with it.

Thank you Olimex!

Mon, 21 Jan 2013 00:00:00 +0100 <![CDATA[Trying out the Adafruit WebIDE on my Raspberry Pi]]> Trying out the Adafruit WebIDE on my Raspberry Pi
Screenshot Adafruit WebIDE

Screenshot Adafruit Learning System Raspberry Pi WebIDE

The Adafruit WebIDE is a web-based editor (Integrated Development Environment) designed to run on the Raspberry Pi similar to the Cloud9 IDE. Because it’s entirely web-based there’s no need to install any software on your computer, just launch a browser and connect to your Pi.


Tue, 15 Jan 2013 00:00:00 +0100 <![CDATA[Using the OLinuXino Micro and a USB 3G modem to control something via web]]> Using the OLinuXino Micro and a USB 3G modem to control something via web
OLinuXino with a USB 3G modem

OlinuXino Micro with a USB 3G modem

First you need a working internet connection on the OLinuXino, either via WiFi or Ethernet to install some tools. In my previous blog post there is an example how to configure a kernel with WiFi and USB 3G modem support and how to set up an internet connection on the OLinuXino.

Update: The default Arch Linux ARM image now has proper WiFi and USB 3G modem support (A new SD card image for the iMX233-OLinuXino), building your own kernel is not longer necessary.


Sun, 16 Dec 2012 00:00:00 +0100 <![CDATA[Backup your OLinuXino/Raspberry Pi SD card]]> Backup your OLinuXino/Raspberry Pi SD card

If you have modified your system a lot and don’t want to lose everything and start from scratch when your SD card gets damaged or an update breaks your system it is a good idea to create a backup of your SD card.

On Linux we can simply use the dd command for that purpose.

Create a SD card image:

[chris@thinkpad ~]$ sudo dd if=/dev/mmcblk0 of=/home/chris/olinuxino_image.img

or with compression:

[chris@thinkpad ~]$ sudo sh -c 'dd if=/dev/mmcblk0 | gzip > /home/chris/olinuxino_image.img.gz'

Restore the SD card from the image:

[chris@thinkpad ~]$ sudo dd if=/home/chris/olinuxino_image.img of=/dev/mmcblk0

or with compression:

[chris@thinkpad ~]$ sudo sh -c 'gzip -dc /home/chris/olinuxino_image.img.gz | dd of=/dev/mmcblk0'

It’s really a good idea to use compression, I’ve tried both to backup an 4 GB SD card, the image without compression has a size of 3.9 GB and that with compression is only 886.6 MB big.

Sat, 15 Dec 2012 00:00:00 +0100 <![CDATA[Getting Started with the TI Stellaris LaunchPad on Linux]]> Getting Started with the TI Stellaris LaunchPad on Linux

STM32 microcontrollers are very nice and the STM32F0/ STM32VL/ STM32F3/ STM32F4/ STM32L- Discovery boards with the integrated debugger are well supported under Linux, in contrast to the LPCXpresso boards from NXP, so in principle there is no need to look further for other microcontrollers but I like trying new stuff and bought two cheep EK-LM4F120XL Stellaris LM4F120 LaunchPad Evaluation Boards / Tiva C Series TM4C123G LaunchPad Evaluation Kits for the promotional price of $4.99 each with free shipping from TI.


Tue, 11 Dec 2012 00:00:00 +0100 <![CDATA[Carambola günstiges WLAN Modul mit viel Potential]]> Carambola günstiges WLAN Modul mit viel Potential

In einem meiner letzten Projekte habe ich schon Erfahrung mit einem WLAN Modul von GainSpan gesammelt. Inzwischen bin ich auf ein viel leistungsfähigeres und günstigeres Modul gestoßen - das Carambola. Ich frage mich ernsthaft warum noch jemand so ein unflexibles proprietäres WLAN-Modul einsetzten sollte, bei dem man die Firmware nicht erweitern und anpassen kann.

Carambola WLAN Modul

Carambola is a tiny, low cost, open-source and Linux friendly, easy embeddable module which allows adding extensive wireless and wired networking capabilities to any device around us in the upcoming era of the Internet things.

Auf dem Modul läuft OpenWRT, eine Linux Distribution die sonst häufig auf WLAN Routern zum Einsatz kommt, somit kann man leicht eigene Programme für das Modul schreiben, vorhandene Software portieren und auf eine Vielzahl verfügbarer Programme unter Linux zurückgreifen.

Im Shop ist auch noch ein Carambola development board mit zahlreichen extra Schnittstellen wie USB, Ethernet und RS232 verfügbar.

Carambola WLAN Modul

Bundle Carambola + Devboard, Preis ohne Mengenrabatt: 39.00€

Demnächst sollte auch noch eine sehr viel kleinere Version des Carambola verfügbar sein:

Carambola WLAN Modul CaraNano

Carambola Nano WLAN Modul

Update: Das Carambola 2 ist jetzt verfügbar und es nutzt einen Qualcomm/Atheros AR9331 Prozessor, genau wie das Arduino Yún oder der TP-Link WR703N Router.

Carambola WLAN Modul

Carambola 2 einzeln (19 € bzw. 15 € mit Mengenrabatt) und mit Devboard (33 €)

Mal sehen vielleicht findet es ja in einem zukünftigen Projekt Verwendung.

Weiterführende Links:

Wed, 14 Nov 2012 00:00:00 +0100 <![CDATA[Building a kernel 3.x for the iMX233-OLinuXino]]> Building a kernel 3.x for the iMX233-OLinuXino
OlinuXino Micro with TP-LINK TL-WN821N (ath9k_htc)

OLinuXino-MICRO with TP-LINK TL-WN821N (ath9k_htc)

This tutorial is based on


I will update this guide from time to time. If you want to keep an older version of this guide as reference then print it into an PDF file. I’ve tweaked the printing style of my blog a bit, so it should look pretty well. An example: Building a kernel 3.x for the iMX233-OLinuXino-v3.7.10.pdf, Building a kernel 3.x for the iMX233-OLinuXino-v3.9.4.pdf.

The cross compiler

You will need an ARM bare metal cross-compiler, I’m using the one from Launchpad:

Extract the tarball somewhere and add the compiler to the $PATH, e.g. edit your ~/.bashrc file and add a line like this:

export PATH=$PATH:$HOME/local/gcc-arm-none-eabi-4_7-2013q3/bin
[chris@thinkpad linux-stable]$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601]
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

[chris@thinkpad linux-stable]$

You may also need to install some 32 bit libs if you are using a 64 bit OS, just execute arm-none-eabi-gcc --version then have a look at the error messages or use ldd to print the shared library dependencies and install the necessary packages.

[chris@thinkpad ~]$ ldd $(which arm-none-eabi-gcc) =>  (0xf7779000) => /lib/ (0xf76f6000) => /lib/ (0x4a582000)
        /lib/ (0x4a55f000)
[chris@thinkpad ~]$
  • Fedora: sudo yum install glibc.i686 libstdc++.i686 zlib.i686 ncurses-libs.i686
  • Ubuntu: ...

Or use your package manager to try the compiler that your distribution ships:

  • Fedora: sudo yum install arm-none-eabi-gcc-cs
  • Ubuntu: ...

Getting the code

[chris@thinkpad OLinuXino]$ git clone
Cloning into 'imx23-olinuxino'...
remote: Counting objects: 72, done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 72 (delta 24), reused 62 (delta 14)
Unpacking objects: 100% (72/72), done.
[chris@thinkpad OLinuXino]$ cd imx23-olinuxino
[chris@thinkpad imx23-olinuxino]$ git fetch origin 3.12-rc2
* branch            3.12-rc2   -> FETCH_HEAD
[chris@thinkpad imx23-olinuxino]$ git checkout 3.12-rc2
Switched to branch '3.12-rc2'
[chris@thinkpad imx23-olinuxino]$

Get the kernel source:

[chris@thinkpad imx23-olinuxino]$ cd kernel
[chris@thinkpad kernel]$ git clone git://
Cloning into 'linux-stable'...
remote: Counting objects: 3000082, done.
remote: Compressing objects: 100% (469603/469603), done.
remote: Total 3000082 (delta 2521093), reused 2981126 (delta 2502295)
Receiving objects: 100% (3000082/3000082), 620.49 MiB | 624 KiB/s, done.
Resolving deltas: 100% (2521093/2521093), done.
Checking out files: 100% (41502/41502), done.
[chris@thinkpad kernel]$ cd linux-stable/
[chris@thinkpad linux-stable]$ gitk --all
[chris@thinkpad linux-stable]$

You can use gitk to visualize the commit history.

Screenshot gitk kernel 3.7.1 commit history

Screenshot gitk kernel 3.7.1 commit history

[chris@thinkpad linux-stable]$ git checkout master
Already on 'master'
[chris@thinkpad linux-stable]$ git pull
Already up-to-date.
[chris@thinkpad linux-stable]$ git checkout v3.12
Note: checking out 'v3.12'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 5e01dc7... Linux 3.12
[chris@thinkpad linux-stable]$


Thu, 23 Aug 2012 00:00:00 +0200 <![CDATA[MicroCLI: Befehlsinterpreter auf einem STM32F0-Discovery + WLAN + Handy-App]]> MicroCLI: Befehlsinterpreter auf einem STM32F0-Discovery + WLAN + Handy-App
MicroCLI Versuchsaufbau auf Steckbrett

MicroCLI Versuchsaufbau auf Steckbrett


Ziel ist die Kommunikation zwischen einer Mikrocontroller-Platine und einer Handy-App über WLAN/Bluetooth zum Steuern von Ein- und Ausgängen.

Der Name MicroCLI setzt sich dabei aus Micro für Microcontroller (µC, uC, MCU) und CLI für Command Line Interface (Command Line Interpreter, Befehlsinterpreter) zusammen.

Ein paar Informationen zur WLAN Platine gibt es in diesem Blogpost.


Mon, 13 Aug 2012 00:00:00 +0200 <![CDATA[Debugging the STM32F0-Discovery board with Nemiver]]> Debugging the STM32F0-Discovery board with Nemiver
STM32F0-Discovery Board

STM32F0-Discovery Board

On GitHub there is a nice project template for the STM32F0-Discovery development board from STM:

I have added a debug target to the Makefile, now everything you have to do to debug your code on the hardware is to run:

[chris@thinkpad stm32f0-discovery-basic-template]$ make debug

Here are the results:

Gainspan WiFi Adapterplatine

Running $ make debug


Mon, 13 Aug 2012 00:00:00 +0200 <![CDATA[Experimente mit einem GainSpan WiFi Modul]]> Experimente mit einem GainSpan WiFi Modul

Ein paar Informationen zur eingesetzten Hardware gibt es in diesem Blogpost.


Sun, 12 Aug 2012 00:00:00 +0200 <![CDATA[Building Freescale's Community Yocto BSP for the iMX233-OLinuXino]]> Building Freescale’s Community Yocto BSP for the iMX233-OLinuXino

This tutorial is based on


BSP = Board Support Package

Yocto Project™:

The Yocto Project is a Linux Foundation workgroup whose goal is to produce tools and processes that will enable the creation of Linux distributions for embedded software that are independent of the underlying architecture of the embedded software itself. The project was announced by the Linux Foundation in 2010. In March 2011, the project aligned itself with OpenEmbedded, an existing framework with similar goals, with the result being The OpenEmbedded-Core Project.



OpenEmbedded is a software framework to create Linux distributions aimed for, but not restricted to, embedded devices. The build system is based on BitBake recipes, which behaves like Gentoo’s ebuilds. The OpenEmbedded-Core Project (OE-Core for short) resulted from the merge of the Yocto Project with OpenEmbedded.


Step by Step

Install the repo utility

[chris@thinkpad ~]$ curl --create-dirs -o ~/bin/repo > ~/bin/repo
[chris@thinkpad ~]$ chmod a+x ~/bin/repo

The ~/bin directory should have been added already to your $PATH, Ubuntu adds it in ~/.profile and Fedora in ~/.bash_profile, if this is not the case you can add the following line in your ~/.bashrc:



Wed, 08 Aug 2012 00:00:00 +0200 <![CDATA[Eine WLAN-Platine zum selber bauen]]> Eine WLAN-Platine zum selber bauen
Gainspan WiFi Adapterplatine

GainSpan WiFi Adapterplatine fürs Steckbrett

Zielstellung und Vorbemerkungen

Ziel: WLAN-Platine zur Kommunikation mit Handy (Android + iOS)

Warum kein Bluetooth: Bluetooth-Schnittstelle ist beim iPhone kastriert und unterstützt nicht das Serial Port Profil (SPP), dazu ein paar links:

Unter Android funktioniert die Kommunikation mit einem 5 EUR Bluetooth Modul dagegen problemlos, aber falls die Kommunikation auch mit einem iPhone funktionieren soll ist die Verwendung eines WLAN Moduls momentan die einfachste und günstigste Lösung.

GainSpan hat ein paar interessante WLAN-Module im Angebot, die im Vergleich zu den meisten anderen Modulen auf dem Markt auch den Accesspoint Modus unterstützen, dadurch lässt sich ein Android Smartphone oder iPhone direkt, ohne zusätzlichen Router, mit dem Modul verbinden. Andere Module unterstützen oft nur den Ad-Hoc Modus, in diesem Modus kann aber nicht die sichere WPA2-PSK Verschlüsselung genutzt werden und fast alle neueren Handys (Android, iPhones) können sich standardmäßig nicht mit Ad-Hoc Netzwerken verbinden.

Die WLAN-Module gibt es z.B. bei Farnell. Ich nutze hier das GAINSPAN - GS1011MIE-SMP Modul mit Antennenkontakt und eine PULSE ENGINEERING - W1039B030 - ANTENNE, Module mit Chipantenne sind auch verfügbar.


Foto vom GAINSPAN GS1011MIE-SMP WLAN Modul mit Antenne

Eagle Bibliothek für das WLAN Modul

Eine fertige Eagle-Bibliothek gibt es hier zum Download, ich wollte zwar erst die komplette Schrittfolge beschreiben, aber das war mir dann doch zu aufwendig.


Hier der Schaltplan als PDF zum Download: gainspan_wifi.pdf.

Schaltplanauszug der Adapterplatine

Schaltplanauszug der Adapterplatine, anklicken für kompletten Schaltplan


Die Platine ist einseitig, wenn man von ein paar Drähten auf der Rückseite absieht, die man einfach per Hand verlöten kann. Durch 2 Stiftleisten (JP3 wird nicht bestückt) lässt sich die Adapterplatine zum einfachen Experimentieren auf ein Steckbrett stecken.

Layout der Platine in Eagle

Layout der Platine in Eagle (Rev.2)

Layout (A4) zum drucken auf Papier, um zu sehen ob die Footprints passen: gainspan_wifi_paper_test.pdf

Layout der Platine Ausdruck auf Papier mit Bauteilen

Ausdruck auf Papier mit Bauteilen um zu sehen ob Footprints passen


Tue, 07 Aug 2012 00:00:00 +0200 <![CDATA[Too much Plug & Play: gpsd and upowerd are blocking my serial port]]> Too much Plug & Play: gpsd and upowerd are blocking my serial port

I’m using a 5V FTDI USB TTL serial cable:

[chris@thinkpad ~]$ lsusb |grep FT232
Bus 001 Device 013: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

We need proper permissions to be able to access the serial port as normal user without root privileges:

[chris@thinkpad ~]$ ls -l /dev/ttyUSB0
crw-rw----. 1 root dialout 188, 0 Aug  3 13:40 /dev/ttyUSB0

So my user account must be added to the dialout group, which can be accomplished with the usermod command:

[chris@thinkpad ~]$ sudo usermod -aG dialout chris
[chris@thinkpad ~]$ #logout and login
[chris@thinkpad ~]$ groups
chris lp wheel cdrom dialout magick

But still I can’t open the serial port, something is blocking it:

[chris@thinkpad ~]$ # configure minicom and disable Hardware Flow Control
[chris@thinkpad ~]$ sudo minicom -s oli
[chris@thinkpad ~]$ minicom oli
minicom: cannot open /dev/ttyUSB0: Device or resource busy

So we need to find out which process is using /dev/ttyUSB0:

[chris@thinkpad ~]$ lsof /dev/ttyUSB0
[chris@thinkpad ~]$ sudo lsof /dev/ttyUSB0
gpsd    1079 nobody    6u   CHR  188,0      0t0 47504 /dev/ttyUSB0
upowerd 3266   root   14u   CHR  188,0      0t0 47504 /dev/ttyUSB0

Problem found: gpsd and upowerd are using the serial port, so we need to stop them from doing so:

  1. Change USBAUTO from true to false in /etc/sysconfig/gpsd:
[chris@thinkpad ~]$ sudo vim /etc/sysconfig/gpsd
  1. Edit /lib/udev/rules.d/95-upower-wup.rules and comment out the SUBSYSTEM line:
[chris@thinkpad ~]$ sudo vim /lib/udev/rules.d/95-upower-wup.rules
# Watts Up? Pro Devices
#SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A80?????", ENV{UPOWER_VENDOR}="Watts Up, Inc.", ENV{UPOWER_PRODUCT}="Watts Up? Pro", ENV{UP_MONITOR_TYPE}="wup"

Now remove the usb serial converter and plug it back in:

[chris@thinkpad ~]$ sudo lsof /dev/ttyUSB0
[chris@thinkpad ~]$

And everything is fine:

Minicom connected to OLinuXino via usb serial converter

Minicom connected to OLinuXino via usb serial converter

Update: The next program is driving me crazy, now it is modem-man (modem-manager):

[chris@thinkpad ~]$ sudo lsof /dev/ttyUSB0
modem-man 1069 root   29u   CHR  188,0      0t0 484165 /dev/ttyUSB0
[chris@thinkpad ~]$ cat /var/log/messages |grep modem |tail -n5
Jan 22 18:27:31 thinkpad dbus-daemon[975]: modem-manager[1069]: <info>  (ttyUSB0) opening serial port...
Jan 22 18:27:37 thinkpad dbus-daemon[975]: modem-manager[1069]: <info>  (ttyUSB0) closing serial port...
Jan 22 18:27:37 thinkpad modem-manager[1069]: <info>  (ttyUSB0) closing serial port...
Jan 22 18:27:37 thinkpad modem-manager[1069]: <info>  (ttyUSB0) serial port closed
Jan 22 18:27:37 thinkpad dbus-daemon[975]: modem-manager[1069]: <info>  (ttyUSB0) serial port closed
[chris@thinkpad ~]$ rpm -ql ModemManager |grep blacklist
[chris@thinkpad ~]$

Now edit the file /lib/udev/rules.d/77-mm-usb-device-blacklist.rules and add a new blacklist rule for my device:

# Cygnal Integrated Products, Inc. CP210x Composite Device (USB-Serial)
ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ENV{ID_MM_DEVICE_IGNORE}="1"

# Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ENV{ID_MM_DEVICE_IGNORE}="1"
Fri, 03 Aug 2012 00:00:00 +0200 <![CDATA[Raspberry Pi: Erster Test]]> Raspberry Pi: Erster Test

Was wir brauchen:

  • Raspberry Pi
  • Defekte SD-Speicherkarte + Tesafilm :-)
  • HDMI-Kabel
  • Micro-USB Kabel und PC mit USB3 Schnittstelle oder ein 1A 5V Micro-USB Netzteil (Für den ersten Test reicht auch ein 500mA Micro-USB Handyladegerät)
  • PC-Monitor mit HDMI-Anschluss oder Fernseher mit Chinch-Buchse
  • USB Tastatur und Maus
Raspberry Pi und Zubehör

Zunächst müssen wir uns von ein SD-Karten Abbild herunterladen.

Probieren wir als erstes mal Raspbian “wheezy” aus, die Datei wurde heruntergeladen und kann jetzt mit dem Kommandozeilenprogramm dd auf die SD-Karte kopiert werden:

[chris@thinkpad Downloads]$ unzip
  inflating: 2012-07-15-wheezy-raspbian.img
[chris@thinkpad Downloads]$ dd if=2012-07-15-wheezy-raspbian.img of=/dev/mmcblk0
dd: opening `/dev/mmcblk0': Permission denied
[chris@thinkpad Downloads]$ sudo dd if=2012-07-15-wheezy-raspbian.img of=/dev/mmcblk0
213633+0 records in
213633+0 records out
109380096 bytes (109 MB) copied, 38.3172 s, 2.9 MB/s
1504769+0 records in
1504769+0 records out
770441728 bytes (770 MB) copied, 266.705 s, 2.9 MB/s
3788800+0 records in
3788800+0 records out
1939865600 bytes (1.9 GB) copied, 663.134 s, 2.9 MB/s
[chris@thinkpad Downloads]$

Durch den Befehl sudo pkill -USR1 -n -x dd kann man sich den Fortschritt des Kopiervorgangs anzeigen lassen.

Jetzt können wir die SD-Karte in das Raspberry Pi stecken, es mit einem HDMI Kabel an einen Monitor anstecken und per Micro-USB Kabel mit Strom versorgen, eine normale USB Schnittstelle reicht wahrscheinlich nicht aus, es wird mindestens ein Netzteil mit 1A empfohlen, da ich aber momentan keins zur Verfügung habe sollte auch eine USB3-Schnittstelle gehen.

Hier ein Foto vom Booten:

Raspberry Pi und OLinuXino-Micro

Das Raspberry Pi beim Booten

Raspberry Pi und OLinuXino-Micro

Konfigurationsmenü nach dem Booten

So Hardware funktioniert, weiter bin ich nicht gekommen, da ich momentan keine USB-Tastatur habe, die ich an das Raspberry Pi anstecken kann. Feierabend für Heute!

Fri, 27 Jul 2012 00:00:00 +0200 <![CDATA[Erste Schritte mit dem iMX233-OLinuXino-Micro]]> Erste Schritte mit dem iMX233-OLinuXino-Micro

Zuerst folgen wir mal der Anleitung von und richten die SD-Karte ein, zum Glück habe ich noch eine alte 1GB MicroSD Karte herumliegen, die sollte für den Anfang ausreichen.


Die Erstellung einer bootfähigen SD Karte wurde vereinfacht, bitte direkt der Anleitung von folgen.

[chris@thinkpad ~]$ sudo fdisk /dev/mmcblk0

Command (m for help): o
Building a new DOS disklabel with disk identifier 0xabf1e7d7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes
103 heads, 43 sectors/track, 447 cylinders, total 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xabf1e7d7

        Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1983999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1983999, default 1983999): +16M

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 53
Changed system type of partition 1 to 53 (OnTrack DM6 Aux3)

Command (m for help): n
Partition type:
  p   primary (1 primary, 0 extended, 3 free)
  e   extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (34816-1983999, default 34816):
Using default value 34816
Last sector, +sectors or +size{K,M,G} (34816-1983999, default 1983999):
Using default value 1983999

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[chris@thinkpad ~]$

So jetzt kann die SD-Karte kurz entfernt und wieder eingesteckt werden, danach können wir mit fdisk die Partitionen auflisten um zu sehen ob alles funktioniert hat:


Fri, 27 Jul 2012 00:00:00 +0200 <![CDATA[iMX233-OLinuXino-Micro With Solder Bridge]]> iMX233-OLinuXino-Micro With Solder Bridge

My iMX233-OLinuXino-Micro arrived today and after taking a photo I noticed a little solder bridge:


With 20x magnification:

OLinuXino solder bridge

And with maximum magnification:

OLinuXino solder bridge

The bridged pins are connected to CON1.4 and and CON1.5 which aren’t used at the moment, so this should be no real problem, later I can take my soldering iron and fix this.

Fri, 27 Jul 2012 00:00:00 +0200 <![CDATA[Raspberry Pi und iMX233-OLinuXino-Micro sind heute eingetroffen]]> Raspberry Pi und iMX233-OLinuXino-Micro sind heute eingetroffen

Die Meisten werden wahrscheinlich wissen, dass es beim Raspberry Pi anfangs ziemliche Lieferschwierigkeiten gab, am 16.07 konnte ich dann nach 3-4 Monaten Wartezeit endlich bei Farnell bestellen, aber mit einer Lieferung nach knapp 2 Wochen hätte ich noch nicht gerechnet.

In der Zwischenzeit habe ich dann auch noch ein OLinuXino-Micro bei Watterott bestellt, dass sich auf Grund seiner Einfachheit und des Open Source Hardware Charakters besonders gut für eigene abgewandelte Platinen eignen sollte.

OLINUXINO is completely open source - including hardware and software, this means you have access to all CAD files and sources and you can reuse them for your own personal or commercial project. There are NO restrictions to manufacture and sell these board for your own use or resale. OLINUXINO use widely available microcontroller iMX233 which cost USD 5.50 in 100 pcs quantity, this means that people can spin off their own boards and manufacture them cheap as the processor is in TQFP easy to assembly by hobbyist package. (

Heute sind dann beide Bestellungen eingetroffen:

OLinuXino-Micro von Watterott:

OLinuXino Paket

Raspberry Pi von Farnell:

Raspberry Pi Farnell Paket

Größenvergleich OLinuXino-Micro und Raspberry Pi:

Raspberry Pi und OLinuXino-Micro

Bei dem iMX233 auf dem OLinuXino gab es noch eine kleine Lötbrücke, die die ich später noch entfernen werde, aber momentan stört sie nicht.

Happy hacking!

Fri, 27 Jul 2012 00:00:00 +0200 <![CDATA[Moved to Tinkerer and OpenShift]]> Moved to Tinkerer and OpenShift

Using Hyde for blogging was really too mush manual work to do and when I switched to Hyde I didn’t know about Tinkerer. With Hyde you can do whatever you want and how you want, but you have to do it yourself, nobody else is using the same configuration or layout and you don’t have such a nice JavaScript based search function like in Sphinx.

I’ve learned a lot about Jinja2, the templating s system used in Hyde and Sphinx, I’ve written some extensions, started working with Flask, but now it is time for something new.

So I moved to Tinkerer, which is a static website generator based on Sphinx.

I like Tinkerer because it behaves like Sphinx, and Sphinx is really a great tool for generating documentation and I’m quiet familiar with its reStructuredText syntax.

I had some really annoying downtimes with my old free hosting provider, so it was also time to look for another hosting, I’ve seen some news posts about OpenShift and wanted to try it.

My first impressions about OpenShift:

  • It’s nice that I can use Git to manage my web apps.
  • I can access my files via sftp:// in my filemanager: s
  • I can also use rsync to upload some files.
  • It is not so nice that I have to create a snapshot (rhc app snapshot save -a piwik) to commit runtime changes from php apps to the Git repository (no git commit on the server and git pull on my local machine).
  • The 3 free Gears of FreeShift are not enough and MegaShift is a bit pricey:
  • ...

SourceForge’s Project Web is a good addition:

In the meantime I’ve also started developing an webapp which is written in Python, based on Flask and Jinja2 on the server side and uses jQuerry and Bootstrap on the client side, but it looks like I have not the time to finish it.


My first pull request with some modifications to Tinkerer got already merged upstream and I’ve got a really encouraging response:

Vlad Riscutia (vladris) said: Thanks so much Christian! I can’t tell you how much I appreciate this contribution - I especially like the way you implemented “Read more...”, at some point I was considering having that but I couldn’t figure out a good solution. Your bug fixes are also more than welcomed! I’ve been very busy at work this past month, that being the reason I didn’t pull this sooner but I definitely appreciate your hard work on this! I will definitely get some time to spend on Tinkerer this week and I will go through the bugs you opened. Thanks again!
Sat, 21 Apr 2012 00:00:00 +0200 <![CDATA[Using nemiver for remote debugging on ARM microcontrollers]]> Using nemiver for remote debugging on ARM microcontrollers

This is just a tip for those of you who also think Eclipse is too fat and slow and want to use another editor, but need a proper debugger. You may want to try Nemiver.

You will need an ARM bare metal cross-compiler, some time ago I’ve written a small HOWTO to compile one yourself and a German Tutorial to get started with STM32 development on Linux.

Go to your program that you want to debug, compile it and flash it to the chip:

[chris@thinkpad usart]$ make clean
[chris@thinkpad usart]$ make
[chris@thinkpad usart]$ make flash
  FLASH   usart.hex
[chris@thinkpad usart]$

In another terminal run openocd -f debug.cfg to start a gdb server.

[chris@thinkpad usart]$ openocd -f debug.cfg
Open On-Chip Debugger 0.6.0-dev-00425-g631b80f-dirty (2012-02-24-13:22)
Licensed under GNU GPL v2
For bug reports, read
Info : only one transport option; autoselect 'jtag'
1000 kHz
adapter_nsrst_delay: 100
jtag_ntrst_delay: 100
cortex_m3 reset_config sysresetreq
Info : clock speed 1000 kHz
Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
Info : JTAG tap: tap/device found: 0x16410041 (mfg: 0x020, part: 0x6410, ver: 0x1)
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

My debug.cfg looks like this:

#daemon configuration
telnet_port 4444
gdb_port 3333
source [find interface/olimex-jtag-tiny.cfg]
source [find target/stm32f1x.cfg]

Now in the first terminal run:

[chris@thinkpad usart]$ arm-none-eabi-gdb --batch --command=run.gdb usart.elf
0x00000000 in ?? ()
requesting target halt and executing a soft reset
target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000324 msp: 0x20005000
Hardware assisted breakpoint 1 at 0x8000284: file usart.c, line 96.
Temporary breakpoint 1, main () at usart.c:96
96      {
[chris@thinkpad usart]$

run.gdb looks like:

target remote localhost:3333
monitor soft_reset_halt
thbreak main

Now we can run Nemiver:

[chris@thinkpad usart]$ nemiver --remote=localhost:3333 --gdb-binary=/home/chris/tools/summon-arm-toolchain/bin/arm-none-eabi-gdb usart.elf

And the obligatory screenshot:

Screenshot Settings

I’ve put everything in a bash script, so everything I have to do to flash the chip and start a new debug session is to to run

make flash
xterm -e openocd -f debug.cfg &
sleep 2
arm-none-eabi-gdb --batch --command=run.gdb usart.elf
nemiver --remote=localhost:3333 --gdb-binary=/home/chris/tools/summon-arm-toolchain/bin/arm-none-eabi-gdb usart.elf
Screenshot Settings

Update 2012-08-14: Here is a newer version, which is integrated in the microcli-stm32f0-discovery Makefile:


# location of OpenOCD Board .cfg files

# start xterm with openocd in the background
xterm -e openocd -f $OPENOCD_BOARD_DIR/stm32f0discovery.cfg -f extra/stm32f0-openocd.cfg -f extra/debug.cfg &

# save the PID of the background process

# wait a bit to be sure the hardware is ready
sleep 2

# execute some initialisation commands via gdb
arm-none-eabi-gdb --batch --command=extra/run.gdb main.elf

# start the gdb gui
nemiver --remote=localhost:3333 --gdb-binary="$(which arm-none-eabi-gdb)" main.elf

# close xterm when the user has exited nemiver
Sat, 14 Apr 2012 00:00:00 +0200 <![CDATA[STM32 Entwicklung unter Linux]]> STM32 Entwicklung unter Linux

Mein Einstieg in die Programmierung der STM32 Mikrocontroller.

Das Board

Zum Einsatz kommt ein STM32-H103 Development Board von Olimex.


Erster Test - Blinkende LED

Olimex bietet ein bereits compiliertes Beispiel Programm, das kann mit OpenOCD auf das Board geflasht werden, später gehe ich noch genauer auf OpenOCD ein.

Zum flashen benutze ich einen ARM USB JTAG Adapter, ebenfalls von Olimex.


So wenn das Board über ein USB Kabel vom PC mit Strom versorgt wird und der JTAG Adapter angeschlossen ist kann es losgehen.

Wir wechseln in das Verzeichnis mit dem entpackten Beispielprogramm:

[chris@thinkpad ~]$ cd projects_STM32/STM32-H103_flash/
[chris@thinkpad STM32-H103_flash]$ ls
arm_comm.h          main.c     stm32f10x_gpio.o
armusbocd.cfg       main.list  stm32f10x_rcc.o
armusbocd_tiny.cfg  main.o     stm_h103_blink_rom.cmd
lib                 main.out
main.bin            makefile


Wed, 14 Dec 2011 00:00:00 +0100 <![CDATA[ThinkPad x220t power saving in Fedora 16/17/19]]> ThinkPad x220t power saving in Fedora 16/17/19

A script to enable laptop power saving features for Fedora.

We are going to take advantage of a pm-utils feature: any script placed in /etc/pm/power.d/ will automatically run when the AC power is connected or disconnected.

To install the script you only have to copy it to /etc/pm/power.d/:

[chris@thinkpad Downloads]$ sudo mv /etc/pm/power.d/

At the moment I get around 5 hours (update: 8 hours) battery live when reading a PDF and making notes with Xournal on my Lenovo ThinkPad X220T.

[chris@thinkpad ~]$ uname -r

The battery reports a discharge rate of 11.8 W and all tunables are marked as good in powertop.

To start / stop it run:

[chris@thinkpad ~]$ sudo sh true
[chris@thinkpad ~]$ sudo sh false

You may also try to run:

[chris@thinkpad ~]$ sudo pm-powersave false
[chris@thinkpad ~]$ sudo pm-powersave true

to see if t works.

To check that the script is running, and to see any errors run:

[chris@thinkpad ~]$ cat /var/log/pm-powersave.log

The script

# List of modules to unload, space seperated. Edit depending on your hardware and preferences.
# In modlist you can put a list of modules to automatically load and unload. The uvcvideo entry will disable most webcams.
# Remove this if you want to use your webcam on battery without having to sudo modprobe uvcvideo first.
# e1000e belongs to my wired network adapter
modlist="uvcvideo videodev media e1000e"

# Bus list for runtime pm. Probably shouldn't touch this.
buslist="pci i2c"

# spindown time for HD (man hdparm for valid values)
# I prefer 2 hours for acad and 2 min for batt

# Power management level
# 255 (off) on AC
# 128 (medium) on batt

case "$1" in
      logger "Start powersave"
      # Enable some power saving settings while on battery
      # Enable laptop mode
      echo 5 > /proc/sys/vm/laptop_mode
      # Less VM disk activity. Suggested by powertop
      echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
      # Intel Audio power saving
      # maybe you have to mute some channels, or stop multimedia apps that your audio controller can turn itself off
      echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
      echo 1 > /sys/module/snd_hda_intel/parameters/power_save
      # Set backlight brightness to 50%
      # find /sys -iname brightness
      # echo 5 > /sys/devices/virtual/backlight/acpi_video0/brightness
      echo 2 > /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness
      # Disable NMI wathcdog. Suggested by powertop
      echo 0 > /proc/sys/kernel/nmi_watchdog
      #echo disable > /proc/acpi/ibm/bluetooth
      #echo disable > /proc/acpi/ibm/wan
      echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
      echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
      ethtool -s em1 wol d

      # enable wlan0 power saving
      #iwconfig wlan0 power on

      # rfkill - tool for enabling and disabling wireless devices
      # run "rfkill list" to list the current state of all available rfkill-using devices
      # run "man rfkill" for more info
      # block index|type : Disable the device corresponding to the given index. type is one of "all", "wifi", "wlan", "bluetooth", "wwan", ...
      # rfkill block bluetooth
      #rfkill block all
      rfkill block wifi
      rfkill block wlan
      rfkill block bluetooth

      logger "Setting HD spindown for BATT mode with hdparm -S $BATT_HD /dev/sda."
      hdparm -S $BATT_HD /dev/sda > /dev/null 2>&1
      logger "Setting HD powersaving for BATT mode with hdparm -B $BATT_PM /dev/sda."
      hdparm -B $BATT_PM /dev/sda > /dev/null 2>&1

      cpupower frequency-set -g powersave
      # USB powersaving
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 1 > $i
        for i in /sys/bus/usb/devices/*/power/level; do echo auto > $i; done
      # SATA power saving
        for i in /sys/class/scsi_host/host*/link_power_management_policy; do
            echo min_power > $i
      # Disable hardware modules to save power
        for mod in $modlist; do
            grep $mod /proc/modules >/dev/null || continue
            modprobe -r $mod 2>/dev/null
      # Enable runtime power management. Suggested by powertop.
        for bus in $buslist; do
            for i in /sys/bus/$bus/devices/*/power/control; do
                echo auto > $i
      logger "Stop powersave"
      # Return settings to default on AC power
        echo 0 > /proc/sys/vm/laptop_mode
        echo 500 > /proc/sys/vm/dirty_writeback_centisecs
        echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
        echo 0 > /sys/module/snd_hda_intel/parameters/power_save
        # echo 10 > /sys/devices/virtual/backlight/acpi_video0/brightness
        echo 15 > /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/brightness
        echo 1 > /proc/sys/kernel/nmi_watchdog
        #echo enable > /proc/acpi/ibm/bluetooth
        #echo enable > /proc/acpi/ibm/wan

        # rfkill unblock bluetooth
        rfkill unblock all

        logger "Setting HD spindown for AC mode with hdparm -S $ACAD_HD /dev/sda."
        hdparm -S $ACAD_HD /dev/sda > /dev/null 2>&1
        logger "Setting HD powersaving for AC mode with hdparm -B $ACAD_PM /dev/sda."
        hdparm -B $ACAD_PM /dev/sda > /dev/null 2>&1

        # use sudo cpupower frequency-info for available cpufreq governors
        cpupower frequency-set -g performance
        #iwconfig wlan0 power off
        for i in /sys/bus/usb/devices/*/power/autosuspend; do
            echo 2 > $i
        for i in /sys/class/scsi_host/host*/link_power_management_policy
            do echo max_performance > $i
        for mod in $modlist; do
            if ! lsmod | grep $mod; then
                modprobe $mod 2>/dev/null
        for bus in $buslist; do
            for i in /sys/bus/$bus/devices/*/power/control; do
                echo on > $i

exit 0

Download the script:


Tue, 13 Dec 2011 00:00:00 +0100 <![CDATA[Battery Friendly Autostart]]> Battery Friendly Autostart

Old version of the script

# battery autostart script
# =======================


BATSTATE=`grep "^charging state" $BATTERY/state | awk '{ print $3 }'`
# Note valid BATSTATE values are: charged, charging, and discharging
if [ "$BATSTATE" = "discharging" ]
  logger 'Battery: discharging'
  logger 'AC Adapter: Plugged in'

  kopete &
  seapplet &
  swatch &
  kontact &
  kcsyncd &


# end of file

New version of the script

# battery autostart script
# ========================


BATSTATE=`cat $BATTERY/status`
# Note valid BATSTATE values are: Full, Unknown, Discharging
if [ "$BATSTATE" = "Discharging" ]
  logger 'Battery: discharging'
  logger 'AC Adapter: Plugged in'
  # Add programs here, that you want to start

  #sleep 5m
  kopete &
  seapplet &
  swatch &
  kontact &
  kcsyncd &


# end of file

Download the script:

Tue, 13 Dec 2011 00:00:00 +0100 <![CDATA[Secure Resume From Sleep]]> Secure Resume From Sleep
  • This script will shutdown your PC if nobody enters the correct password after resume from sleep withing 40 seconds
  • At the moment it will only work with KDE
  • Copy it to /etc/pm/sleep.d/ and make it executable


pm-utils scripts do not longer get executed when resuming a system from sleep, see here:

systemctl help systemd-suspend.service:

Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be “pre”, the second either “suspend”, “hibernate”, or “hybrid-sleep” depending on the chosen action. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now “post”. All executables in this directory are executed in parallel, and execution of the action is not continued before all executables finished.

On newer systems copy it to /usr/lib/systemd/system-sleep/.

# replace kscreenlocker with the screenlocker of your Desktop Environment, maybe gnome-screensaver
locker=kscreenlocker_greet #KDE 4.10

log() { logger -t securesume "$@"; echo "$@"; }

case "$1" in
    # do something before hibernate or suspend
    # do the following after resume from sleep
        # check if the screenlocker is running, else shutdown
        sleep 1s
        if [[ ! $(pidof $locker) ]]; then
            log "screenlocker not active, will now halt"
            /sbin/shutdown -h now
            log "screenlocker active, now you have to unlock it"
        # turn the PC off if the screen in not unlocked within 40 seconds
        sleep 60s

        # check if the screenlocker is running, else shutdown
        if [[ ! $(pidof $locker) ]]; then
        #if [ "$output" = "$noscreensaver" ]; then
            log "logged in, nothing to do"
            log "no login within 40 seconds, will now halt"
            /sbin/shutdown -h now
        log "argument missing or wrong argument, usage: ./ resume"

Download the script:

Tue, 13 Dec 2011 00:00:00 +0100 <![CDATA[My new blog]]> My new blog

I’ve used Wordpress for some years now for my website. I customized it a little bit, and made a custom theme for it. But nothing is perfect, and neither is Wordpress.

Some things I don’t like about it:

  • Can’t easily edit files with a regular text editor
  • Painful backup creation
  • I don’t like PHP
  • Constant security upgrades are required
  • I can’t use Git to store my website in a repository for revision control.

I was locking for something like Sphinx that is more suited for a general purpose website.

A blog is mostly static. Why should my posts be stored in a database? It’s hardly ever necessary. Comments are perhaps the exception here, but services like Disqus implement commenting with embedded JavaScript.

So I looked to static site generators. I chose Hyde for it’s nice template system and because it is written in Python.

Mon, 12 Dec 2011 00:00:00 +0100 <![CDATA[Working on csyncd and csync-kde]]> Working on csyncd and csync-kde


... a user level bidirectional file synchronization daemon written in c based on csync.

The source code can be found at:

You may also have a look at the user guide:


... a KDE GUI for csyncd written in C++ using Qt and KDE libraries.

The source code can be found at:

Sun, 21 Aug 2011 00:00:00 +0200 <![CDATA[Building an ARM bare metal cross-compiler]]> Building an ARM bare metal cross-compiler SAM7-EX256


You can get precompiled packages from CodeSourcery if you are using a 32bit x86 and not 64bit x86_64 operating system.


At the moment I’m using a prebuilt toolchain from, just download, unzip and add it to the PATH (export PATH=$PATH:/home/chris/tools/gcc-arm-none-eabi-4_6-2012q2/bin). There is also a source package and even a Windows installer.

Step for step:

1. If not yet installed:

Use the package manager of you Linux distribution to install some required packages, I’m using Fedora and yum here. First we need Git to download the build script:

[chris@thinkpad ~]$ sudo yum install git

2. Install build dependencies:

[chris@thinkpad ~]$ sudo yum install mpfr-devel flex gmp-devel libmpc-devel autoconf texinfo bison ncurses-libs ncurses-devel expat expat-devel make gcc gcc-c++

You may also try sudo yum groupinstall "Development Tools" or sudo yum-builddep gcc.

If you are also building openocd: sudo yum install libftdi-devel.

3. Get the build script:

You can get the build script from, it is also a good idea to have a look at its forks on GitHub, they may use newer versions of the compiler and other issues may be fixed already.

[chris@thinkpad ~]$ git clone git://

4. Edit the build script as you wish:

[chris@thinkpad ~]$ cd summon-arm-toolchain
[chris@thinkpad summon-arm-toolchain]$ vim summon-arm-toolchain
# Install location of your final toolchain
# du -hs ~/tools/summon-arm-toolchain # 309M

#When using Fedora's openocd sudo yum install openocd

To beware for download failures you should remove the --no-passive-ftp in wget -c --no-passive-ftp $2 && touch ${STAMPS}/$1.fetch:

[chris@thinkpad summon-arm-toolchain]$ sed -i 's/--no-passive-ftp//g' summon-arm-toolchain


Wed, 06 Apr 2011 00:00:00 +0200