Homepage Wiki Forum Buy
embedded Linux Gnublin

Teaching Embedded Linux with Gnublin

Teaching Embedded Linux with Gnublin

Original article: http://elk.informatik.fh-augsburg.de/pub/ew13/article.pdf
Author: Hubert Högl Hubert.Hoegl@hs-augsburg.de, Hochschule Augsburg Fakult für Informatik, January 13, 2013



In this article I would like to present our “Gnublin” project. It is a joint effort between Hochschule Augsburg (me) and Embedded Projects GmbH (Augsburg). The goal was to design and establish an Embedded Linux environment mainly but not only for education which shall be very cheap (less than 50 Euro), easy to use and completely open source. We could fully meet our goals by designing a small 7×7 cm two-layer board which is operational after a few seconds when connected to the USB port of a PC or notebook. The heart of the board is a NXP LPC3131 (ARM926) controller running at 180 MHz with 8 or 32 Megabyte of main memory. The power consumption of the whole board is less than 0.5 watt. A selected number of I/O lines like GPIO, ADC, SPI, I2C and PWM connected to standard 0.1 inch pin headers enables a wide variety of experiments with the board. All of the software needed to run Linux (bootloader, kernel, root filesystem) is stored on a MicroSD card. The software components on the memory card all follow state-of-the-art open source software engineering principles, e.g. the Gnublin Linux kernel adheres to the main line 3.x kernel (or 2.6.33) and the root filesystem is built using powerful tools and distributions like the Embedded Linux Development Kit (ELDK) or Debian for ARM. The homepage of the Gnublin project – http://www.gnublin.org – has a specific focus on the Embedded Linux newcomer. Starting in March 2012 we use Gnublin with great success to teach Embedded Linux at Hochschule Augsburg.


Embedded Linux means to run the Linux operating system on an embedded computer. In most cases the embedded computing machine will not have a x86 microcontroller but instead a controller with e.g. an ARM [5] or another modern RISC core.

Given you have the knowledge and experience it is easy to create in a short time cheap and powerful new electronic devices driven by the Linux operating system. Since years the industry has a growing demand for engineers having a sound understanding of how to build devices based on Linux. On the other hand if you not have enough knowledge in all related areas experience has shown that you will dramatically fail to be a creative Embedded Linux engineer. Figure 1 shows some of the buzzwords encountered in the Embedded Linux world.


Embedded Linux is a rather large field of knowledge, we can group it into the following thematic areas:

Using Linux on the Commandline
This is a must, because the main user interaction with Embedded Linux is on a Linux text console. Even on the development PC, it is far superior to work on the commandline compared to a graphical desktop.

Linux System Administration
Both on the Gnublin board and the host PC the user needs some knowledge about Linux system administration. The focus is mainly on disk management, networking, paket management but also other area.

Linux Application Programming
Developing User Applications and Servers in C, C++ or an interpreted language.

System Programming
Accessing device drivers from user space, simple interprocess communication (IPC). Should first be kept at a minimum.

Linux Kernel Internals
Can be avoided in the beginning (device drivers, kernel programming).

Software Engineering
Open-Source software engineering (OSSE) is quite different from ordinary SE, e.g. GNU coding guidelines and distributed version control. Includes also some knowledge about legal aspects (mainly licenses).

Hardware engineering
Circuit understanding of digital and (a bit) analog technology, interfacing, bug tracking in hardware, PCB design and production, board manufacturing.

The important question when starting a course in Embedded Linux is what previous knowledge a student needs in the above areas. It is quite clear that in one course there is not the time to start from zero in all areas. Virtually no student has a basic knowledge in all of these fields. My approach is, to open the course for all interested students, even when they have only very few previous knowledge. One observation I have made over the past years is that the “appetite” to work in this field can rapidly grow within a few weeks, so that there is a large knowledge improvement within one semester which is certainly true for a small fraction of students.

In order to have a motivating early feeling of success, we lowered the initial barrier to make Embedded Linux accessible even for very unexperienced students.


Figure 2 shows at the left side the lowest barrier which newcomers face: A simple USB console connections is sufficient to boot Gnublin to the login prompt. The beginner is immediately able to explore the system at the shell level (provided that he knows the basic shell commands) and to write simple interpreted programs e.g with Bash, Lua, Perl, PHP, Python or Ruby. Even children are able to work at this level. The next higher level comprises more advanced administration and C/C++ programming of user applications and servers. The highest barrier comprises kernel configuration and device driver reading/programming.


The Gnublin Hardware Environment

To work with Gnublin one needs a Gnublin board and a development PC/Notebook (the Host PC). A single USB cable is sufficient to power the board and access the Gnublin console. Typically some project specific hardware extensions will be connected to Gnublin with the simple peripherial interfaces GPIO, SPI, GPIO, PWM and ADC (fig. 3) according to the principle add peripherals only when needed.


The Gnublin Board

The Gnublin board block diagram is remarkably simple: figure4

The main design decisions follow the old but still valid KISS [4] principle.

Due to the very simple design we could manage to produce the 7×7 cm sized PCB in low-cost two layer technology. Figure 5 shows a photo of the board. More detailed information about the board can be found at the Gnublin Wiki [8].


The Gnublin mascot is the quadratic little man, adverting to the 7×7 cm board dimensions (fig. 6).


A very attractive feature of the board is its low consumption of about 0.5 Watt (5V, 80–100mA). This enables us to build mobile battery- or environmentalpowered devices with Gnublin.
Compared to brand new Embedded Linux boards with Gigahertz clock frequencies and Gigabytes main
memory Gnublin is definitely positioned at an entry level at which Embedded Linux starts to be comfortably usable, at least without graphics. Students are sometimes a bit surprised to hear that a 32-Bit Controller with 100 – 200 MHz clock frequency and 8 – 32 Megabytes of main memory are enough hardware resources to make a modern operating system work. So Gnublin is also a nice vehicle to sharpen the senses for the essential orders of magnitude. It is also an interesting observation that Gnublins computing performance is at the edge where smaller applications written in C can natively be compiled, but you must have a minimum memory of 32 MByte, otherwise the GNU compiler won’t start. Larger applications must still be
The board is produced by Embedded Projects GmbH [6] in Augsburg. The founder Benedikt Sauter, a former student at Hochschule Augsburg, is also (like me) a believer in and supporter of free and open-source soft- and hardware. Therefore all Gnublin hardware plans and software programs can freely be accessed under an open license. The pricing of the board is fully comprehensible by our students. The raw material costs are about 20 to 25 Euro, the difference to the end user price of 49,95 Euro is for manufacturing the board. Thus the price is slightly below the “magical border” of 50 Euro, an amount which the average student is willing to pay to own the board (this is an observation I made during the last years).

Host PC

For program development we need a standard PC or Notebook connected to Gnublin via a single USB cable. This USB connecton carries the power supply and the serial port to the Gnublin Linux console. The development PC is also called the Host PC. When using the PC solely as a terminal emulator for Gnublin, it does not matter whether it works under Windows or Linux. If the PC will also be used as a development environment for cross-compiled applications, the kernel and root filesystem, Linux is a must. When choosing Linux (which I recommend) you still have a lot of choice. There are many Linux distributions available (Debian, Redhat, Suse, Ubuntu, Arch and so on) and you can choose between two installation methods:

During about the last ten years we noticed that students have a steadily increasing fixation towards Windows, so it is sometimes difficult to convince students to install Linux directly to disk side-by-side with Windows. Free-of-cost virtualization tools like VirtualBox or VmWare Player make it easily possible to choose option (b). Two disadvantages of virtualization should
also be mentioned:

The large variety of Linux distributions running on the students host PCs often leads to problems during the compilation process of a kernel or root filesystem kit. Sometimes additional packages need to be installed or wrong library versions are detected. Therefore it is much better to restrict all course attendants to the same distribution. A stable and slightly outdated release (like Debian) is superior to a distribution with brand-new package versions (like ArchLinux).

Extensions for Gnublin

Gnublins add when you need it principle for hardware extensions has led to a number of small and lowbudget extension building blocks which are connected to the 14-pin header. Up to now we have a CAN bus interface, a RS-485 interface, a relay output card and a 2×16 character display card. Students have also built small extensions on stripboards for LEDs, push buttons, light and temperature dependend resistors in the computer engineering lab. This is also a good place to have some practice in soldering. Some of the extension building blocks are available at [6]. But I would also like to see building blocks developed at other places. The USB OTG interface of the LPC3131 is another common place to add extensions. There is a huge amount of very low-cost adaptors for each and every purpose, the most important to build gadgets with Gnublin are:

The Gnublin Wiki [8] documents all tested USB adaptors.

Gnublin Software Environment

The software environment consist of a bootloader, a kernel, a root filesystem and helper utilities. The initial information how to run Linux on a LPC3131 came from the manufacturers website [10].
In 2011 we started to adapt the bootloader Apex to work with Gnublin. The changes were minimal so that our 8 MByte DRAM circuit (now 32 MByte) worked. Next I took the Embedded Linux Development Kit (ELDK release 5.0, [11]) and adapted it to work within 8 MByte DRAM (some services had to be omitted because of low memory). The Linux kernel 2.6.33 from [10] was usable without any changes. A drawback of this kernel is, that there is no connection to the mainline kernel development. During summer 2012 one of my students developed a build script for a Debian/ARM based root filesystem for Gnublin, a.k.a. “Gnublin Distribution” [12].
The major reason to do this was his desire to be able to install Debian packages from a network repository. Maybe in the future the Gnublin Distribution could replace the ELDK. Also in 2012 we noticed a project which ported the 3.x Kernel to the LPC3131, this time with a connection to the upstream kernel sources. This kernel does also work with Gnublin.

Helper Utilities

Gnublin stores all the necessary software on a MicroSD card. The process to prepare such a card with all components so that it is bootable requires knowledge about some commandline programs a Linux novice certainly does not have. To lower the above mentioned barrier for newcomers we started to write scripts and GUI programs to automate the card preparation process. Meanwhile the graphical Gnublin Installer by Michael Schwarz [3] is the most used tool for this task. It also manages the download process of bootloader, kernel and root filesystem from a server. The Debian build script is another helper utility for Gnublin. It is available at [13].

One year with Gnublin

Having used Gnublin for one year at Hochschule Augsburg for a course and some projects, the acceptance is quite good. Currently the board is used as “mass board” for various projects in my computer engineering lab. It slowly spreads also to other places at Hochschule Augsburg e.g. for design and automation tasks. The lecture part of the course is under development. An interesting observation is, that there are a number of excellent text books for advanced readers, e.g. [15] and [16]. The level of these books is in general too high for the average student. I think there is a demand for more introductory textbooks for bachelor students getting exposed for the first time to this subject. In the practical exercises each student can work at a complexity level which is appropriate for him. We are able to construct a wide range of low-cost gadgets, e.g. wearable devices, devices powered by environmental energy, NFC/RFID devices and so on. A typical gadget building exercise comprises connecting an acceleration sensor to Gnublin and accessing it from a smartphone via web programming techniques. All programming exercises should at least consist of the software components shown in figure 7:


Besides the local education at Hochschule Augsburg is an external larger circle of people interested in Gnublin. Many of these external users (the community) posts to the project forums [9], as it is common practice in open source projects. I also would like to see students from my embedded linux course (temporarily) take part in the Gnublin community. In this way they would also get more insight how a community projects works. A few students actually maintained the Gnublin Wiki for a few months. Gnublin can also be seen as a learning environment which exhibits most of the problems which arise in real-world Embedded Linux support companies. The most important lessons to learn are

The Future

Test Framework

A test framework is needed both at the Gnublin development side and and at the Gnublin user side. With about 20 boards in my lab it is a boring task to manually check the correct operation of every the board. Development of the Gnublin kernel, root filesystem and sample programs also needs much testing after changes are made.

Virtual Lab

This is a way to remotely access a Gnublin board and work with it as it would be physically present. We have a prototype implementation at


Physical Computing

This is an idea to wrap the whole board functionality in a layer of Python [17] code. This would drastically ease to write programs which interact with the physical world. During summer 2012 a project group implemented a Python layer for the interfaces GPIO, I2C, SPI, PWM and ADC. The other interfaces in fig. 8 are to be implemented in future bachelor or master thesis.


Real-time Linux

We have to make improvements in the direction of real-time Linux. Currently the necessary lowlevel support in the kernel for either of the two possible real-time solutions – (a) RT Preempt Patch, and (b) RTAI/Xenomai – is missing.


We use Gnublin successfully since spring 2012 for teaching Embedded Linux at Hochschule Augsburg. The students accepted the board very well, the underlying concept of a low access barrier was mainly repsonsible for that. The resulting projects have shown, that Gnublin is not only a vehicle for teaching, but also for solving “real” problems.
Gnublin can be used to implement a large number of experiments, which in the widest sense have something to do with sensing and control applications. Via ADC, SPI and I2C interfaces a huge number of sensors can be added, e.g. for temperature, moisture, pressure, light intensity, acceleration and so on. Things that can be controlled are LEDs, alphanumeric displays, motors, servos and much more. The principle behind is “add peripherals as needed”, so every experiment just adds the extension modules which are really needed. The free and transparent development and production of the Gnublin board all participants have advantages. There is no single point where information is hided because of tactical marketing reasons. The financial calculation of the board is also transparent (25 Euro material + 25 Euro production). By producing and further developing the board at Embedded Projects GmbH our students can even visit the small but modern production environment where Gnublin is built (see the video [14] on Youtube). Furthermore it is easy to cooperate by practical courses, bachelor thesis or simply as a volunteer. I hope that Gnublin strengthens the interest in Embedded Linux within and external to Hochschule Augsburg. In the surroundings of Augsburg are many
companies which already use Linux in devices and many more, which plan to use Linux in future applications. The boom of gadgets with Android, which is also based on Linux, is also an essential part of this development. Some of the young engineers of these companies have got their Embedded Linux knowledge at Hochschule Augsburg, maybe there will be even more in the future.

Dear reader,

if you are also interested in teaching Embedded Linux with (or without) Gnublin, I would like to hear from you. Any comments about our project are very welcome!
With kind regards,

Hubert Högl
E-mail: Hubert.Hoegl@hs-augsburg.de

Further Information

[1] Hochschule Augsburg http://www.hs-augsburg.de
[2] Home of the Gnublin Project http://www.gnublin.org
[3] Gnublin Installer http://wiki.gnublin.org/index.php/Gnublin_Installer
[4] KISS principle http://en.wikipedia.org/wiki/KISS_principle
[5] ARM http://www.arm.com
[6] Embedded Projects GmbH http://www.embedded-projects.net
[7] Embedded Projects Journal http://journal.embedded-projects.net
[8] Gnublin Wiki http://wiki.gnublin.org
[9] Gnublin Forum http://forum.gnublin.org
[10] LPC Linux Homepage http://www.lpclinux.com
[11] Embedded Linux Development Kit (ELDK) http://www.denx.de
[12] Debian for ARM http://www.debian.org/ports/arm
[13] Debian Bauskript https://github.com/ingmar-k/Gnublin_Debian
[14] Youtube video ”Gnublin in Production” http://www.youtube.com/watch?v=UZ-UC_fdUaE
[15] Christopher Hallinan, Embedded Linux Primer: A Practical Real-World Approach, Prentice Hall 2010
[16] Karim Yaghmour, Building Embedded Linux Systems, O’Reilly 2008
[17] Homepage der Sprache Python http://www.python.org