Configuring Extra Features

10 min read

In this article by Piotr J Kula, the author of the book Raspberry Pi 2 Server Essentials, you will learn how to keep the Pi up-to-date and use the extra features of the GPU.

There are some extra features on the Broadcom chip that can be used out of box or activated using extra licenses that can be purchased. Many of these features are undocumented and found by developers or hobbyists working on various projects for the Pi.

(For more resources related to this topic, see here.)

Updating the Raspberry Pi

The Pi essentially has three software layers: the closed source GPU boot process, the boot loader—also known as the firmware, and the operating system. As of writing this book, we cannot update the GPU code. But maybe one day, Broadcom or hardware hackers will tell us how do to this.

This leaves us with the firmware and operating system packages. Broadcom releases regular updates for the firmware as precompiled binaries to the Raspberry Pi Foundation, which then releases it to the public. The Foundation and other community members work on Raspbian and release updates via the aptitude repository; this is where we get all our wonderful applications from.

It is essential to keep both the firmware and packages up-to-date so that you can benefit from bug fixes and new or improved functionality from the Broadcom chip.

The Raspberry Pi 2 uses ARMv7 as opposed to the Pi 1, which uses ARMv6. It recommended using the latest version of Raspbian release to benefit from the speed increase. Thanks to the ARMv7 upgrade as it now supports standard Debian Hard Float packages and other ARMv7 operating systems, such as Windows IoT Core.

Updating firmware

Updating the firmware used to be quite an involved process, but thanks to a user on GitHub who goes under by the alias of Hexxeh. He has made some code to automatically do this for us. You don’t need to run this as often as apt-update, but if you constantly upgrade the operating system, you may need to run this if advised, or when you are experiencing problems with new features or instability.

rpi-update is now included as standard in the Raspbian image, and we can simply run the following:

sudo rpi-update

After the process is complete, you will need to restart the Pi in order to load the new firmware.

Updating packages

Keeping Raspbian packages up-to-date is also very important, as many changes might work together with fixes published in the firmware. Firstly, we update the source list, which downloads a list of packages and their versions to the aptitude cache. Then, we run the upgrade command that will compare the packages, which are already installed. It will also compare their dependencies, and then it downloads and updates them accordingly:

sudo apt-get update
sudo apt-get upgrade

If there are major changes in the libraries, updating some packages might break your existing custom code or applications. If you need to change anything in your code before updating, you should always check the release notes.

Updating distribution

We may find that running the firmware update process and package updates does not always solve a particular problem.

If you use a release, such as debian-armhf, you can use the following commands without the need to set everything up again:

sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods


If you have a long-term or production project that will be running independently, it is not a good idea to login from time to time to update the packages. With Linux, it is acceptable to configure your system and let it run for long periods of time without any software maintenance. You should be aware of critical updates and evaluate if you need to install them. For example, consider the recent Heartbleed vulnerability in SSH. If you had a Pi directly connected to the public internet, this would require instant action.

Windows users are conditioned to update frequently, and it is very rare that something will go wrong. Though on Linux, running updates will update your software and operating system components, which could cause incompatibilities with other custom software. For example, you used an open source CMS web application to host some of your articles. It was specifically designed for PHP version x, but upgrading to version y also requires the entire CMS system to be upgraded. Sometimes, less popular open source sources may take several months before the code gets refactored to work with the latest PHP version, and consequently, unknowingly upgrading to the latest PHP may completely or partially break your CMS.

One way to try and work around this is to clone your SD card and perform the updates on one card. If any issues are encountered, you can easily go back and use the other SD card.

A distribution called CentOS tries to deal with this problem by releasing updates once a year. This is deliberate to make sure that everybody has enough time and have tested their software before you can do a full update with minimal or even no breaking changes. Unfortunately, CentOS has no ARM support, but you can follow this guideline by updating packages when you need them.

Hardware watchdog

A hardware watchdog is a digital clock that needs to be regularly restarted before it reaches a certain time.

Just as in the TV series LOST, there is a dead man’s switch hidden on the island that needs to be pressed at regular intervals; otherwise, an unknown event will begin. In terms of the Broadcom GPU, if the switch is not pressed, it means that the system has stopped responding, and the reaction event is used to restart the Raspberry Pi and reload the operating system with the expectation that it will, at least temporarily, resolve the issue.

Raspbian has a kernel module included, which is disabled by default that deals with the watchdog hardware. A configurable daemon runs on the software layer that sends regular events (such as pressing a button) referred to as a heartbeat to the watchdog via the kernel module.

Enabling the watchdog and daemon

To get everything up and running, we need to do a few things as follows:

  1. Add the following in the console:
    sudo vi /etc/modules
  2. Add the line of the text bcm2708_wdog to the file, then save and exit by pressing ESC and typing :wq.
  3. Next, we need to install the daemon that will send the heartbeat signals every 10 seconds. We use chkconfig and add it to the startup process. Then, we enable it as follows:
    sudo apt-get install watchdog chkconfig
    sudochkconfig --add watchdog
    chkconfig watchdog on
  4. We can now configure the daemon to do simple checks. Edit the following file:
    sudo vi /etc/watchdog.conf
  5. Uncomment the max-load-1 = 24 and watchdog-device lines by removing the hash (#) character. The max load means that it will take 24 Pi’s to complete the task in 1 minute. In normal usage, this will never happen and would only really occur when the Pi is hung.
  6. You can now start the watchdog with that configuration. Each time you change something, you need to restart the watchdog:
    sudo /etc/init.d/watchdog start

There are some other examples in the configuration file that you may find of interest.

Testing the watchdog

In Linux, you can easily place a function into a separate thread, which runs in a new process by using the & character on the command line. By exploiting this feature together with some anonymous functions, we can issue a very crude but effective system halt. This is a quick way to test if the watchdog daemon is working correctly, and it should not be used to halt the Pi. It is known as a fork bomb and many operating systems are susceptible to this.

The random-looking series of characters are actually anonymous functions that create other new anonymous function. This is an endless and uncontrollable loop. Most likely, it adopts the name as a bomb because once it starts, it cannot be stopped. Even if you try to kill the original thread, it has created several new threads that need to be killed. It is just impossible to stop, and eventually, it bombs the system into a critical state, which is also known as a stack overflow. Type these characters into the command line and press Enter:

: (){ :|:& };:

After you press Enter, the Pi will restart after about 30 seconds, but it might take up to a minute.

Enabling extra decoders

The Broadcom chip actually has extra hardware for encoding and decoding a few other well-known formats. The Raspberry Pi foundation did not include these licenses because they wanted to keep the costs down to a minimum, but they have included the H.264 license. This allows you to watch HD media on your TV, use the webcam module, or transcode media files.

If you would like to use these extra encoders/decoders, they did provide a way for users to buy separate licenses.

At the time of writing this book, the only project to use these hardware codecs was the OMXPlayer project maintained by XBMC. The latest Raspbian package has the OMX package included.

Buying licenses

You can go to to buy licenses that can be used once per device. Follow the instruction on the website to get your license key.


This is alos known as H.222/H.262. It is the standard of video and audio encoding, which is widely used by digital television, cable, and satellite TV. It is also the format used to store video and audio data on DVDs.

This means that watching DVDs from a USB DVD-ROM drive should be possible without any CPU overhead whatsoever. Unfortunately, there is no package that uses this hardware directly, but hopefully, in the near future, it would be as simple as buying this license, which will allow us to watch DVDs or video stream in this format with ease.


VC-1 is formally known as SMPTE421M and was developed by Microsoft. Today, it is the official video format used on the Xbox and Silverlight frameworks. The format is supported by the HD-DVD and Blu-ray players.

The only use for this codec will be to watch the Silverlight packaged media, and its popularity has grown over the years but still not very popular. This codec may need to be purchased if you would like to stream video using the Windows 10 IoT API.

Hardware monitoring

The Raspberry foundation provides a tool called vcgencmd, which gives you detailed data about various hardware used in the Pi. This tool is updated from time to time and can be used to log temperate of the GPU, voltage levels, processor frequencies, and so on:

  • To see a list of supported commands, we type in this console:
    vcgencmd commands
  • As newer versions are released, there will be more command available in here. To check the current GPU temperature, we use the following command:
  • We can use the following command to check how RAM is split for the CPU and GPU:
    vcgencmdget_mem arm/gpu
  • To check the firmware version, we can use the following command:
    vcgencmd version

The output of all these commands is simple text that can be parsed and displayed on a website or stored in a database.


This article’s intention was to teach you about how hardware relies on good software, but most importantly, it’s intention was to show you how to use leverage hardware using ready-made software packages.

For reference, you can go to the following link:

Resources for Article:

Further resources on this subject:


Please enter your comment!
Please enter your name here