11 min read

Embedded boards became more and more popular for the usage as multimedia centre. Although Banana Pro is not yet perfectly suited for XBMC (Xbox Media Centre), it is highly recommended for watching TV, especially HDTV. While, several years ago, watching HDTV required huge CPU power or special graphics cards running VDPAU (Video Decode and Presentation API for Unix), today Banana Pro can do the job while consuming only a few watts of power.

In this article by Ruediger Follmann and Tony Zhang, authors of the Banana Pi Blueprints, we will build a multimedia centre, which can receive DVB (Digital Video Broadcast) television signals. In addition, it can be remote controlled and it provides hard disk recording and allows watching, for example, DVDs or audio CDs. Moreover, timers can be programmed in order to record movies.

We will install VDR (Video Disk Recorder) and customize it using TV station logos and different plugins. This article provides all the required preparations starting with kernel and required graphics libraries. Although XBMC does not yet work perfectly on Banana Pro, an outlook is provided on how XBMC can be installed and used.

This article contains in detail:

  • Kernel preparation
  • VDR – Video Disk Recorder

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

Kernel preparation

The LeMedia kernel is used as a base for multimedia centre with the following additions/changes:

  • I added audio device for I2S and enabled associated setting in kernel driver.
  • In addition, I set memory in for TV decoding to maximum 190 MB.
  • Additionally, I deactivated some kernel debug messages. This prevents log daemon from flooding /var/log/syslog in case of VDR crash.
  • Moreover, I activated key repetition in IR driver. When a remote control button is pressed and not released, the remote button is recognized several times.
  • Although there are patches available for the MALI driver version r3p2 and up, XBMC is only showing accelerated videos using MALI r3p0. Therefore, we will not update the MALI driver version.
  • Before compiling the kernel, I activated all DVB USB devices.
  • Finally, we will correct a bug in the display driver, which is responsible for somewhat dark pictures.

Adding the I2S audio device

  1. Using I2S audio, the reader can connect an audio DAC to the Banana Pro GPIO header. I checked LeMedia kernel out in the /usr/local/src/linux-sunxi-lemaker directory using the following command:
    /usr/local/src/linux-sunxi-lemaker directory using the following command:
    sudo git clone –b emaker-3.4-dev-lemedia 
  2. I2S audio device is located in the subdirectory sound/soc/sunxi/i2s. In the first step, I copied the existing non-working I2S driver into a backup directory:
    cd /usr/local/src/linux-sunxi-lemaker/sound/soc/sunxi/i2s
    sudo mkdir backup
    sudo mv * backup
  3. Afterward, I checked out dan-and’s kernel and copied the associated files into LeMaker kernel branch:
    cd /usr/local/src
    git clone https://github.com/dan-and/linux-sunxi.git linux-
    sudo cp –R danand/sound/soc/sunxi/i2s linux-sunxi-
  4. Please make sure that the i2s audio is activated in the kernel menu. This can be done using the command sudo make menuconfig in the kernel directory (Figure 1).

    Banana Pi Blueprints

    Activating Banana Pro I2S audio in LINUX kernel

    In order to detect all available audio devices, the following command can be used:

    aplay –l
  5. For LeMedia kernel patched as described earlier, the output should look similar to the following screenshot:

    Banana Pi Blueprints

Setting the memory to maximum

The graphics driver memory is limited to 80 MB by default. In order to use libvdpau in combination with VDR (Video Disk Recorder) and softhddevice plugin (video output), we need to enlarge this memory to 190 MB. Therefore, please edit the file drivers/media/video/sunxi/sunxi_cedar.c in LeMedia kernel directory and change the file around line 934, as follows:

        /* If having CMA enabled, just rely on CMA for memory allocation */
        resource_size_t pa;
        ve_size = 190 * SZ_1M;

This will set the maximum allowed graphics driver memory of 190 MB instead of the default 80 MB.

Deactivating display driver kernel logging

If, in a later stage, VDR is killed or crashes, the kernel will flood the system log file with messages. In order to avoid this, a few lines in the display driver must be commented out. Please comment out the print messages in the s32 img_sw_para_to_reg(u8 type, u8 mode, u8 value) function in the disp_layer.c file, which can be found in the drivers/video/sunxi/disp directory (line 95 to 99):

/*      else {
            DE_WRN("not supported yuv channel format:%d in "
                    "img_sw_para_to_regn", value);
            return 0;

The same applies to lines 125 to 129:

/*      else {
         DE_WRN("not supported yuv channel pixel sequence:%d "
                    "in img_sw_para_to_regn", value);
            return 0;

It also applies to lines 168 to 172:

/*      else {
          DE_WRN("not supported image0 pixel sequence:%d in "
                    "img_sw_para_to_regn", value);
            return 0;

Finally, please change line 175:

// DE_WRN("not supported type:%d in img_sw_para_to_regn", type);

Activating the IR driver key repetition

By default, the infrared driver recognizes a remote button key pressed only once, no matter how long it is kept pressed. When changing (for example, the volume of a television programme), it would be nice if we could simply hold the remote button pressed until the intended volume has been reached rather than pushing one and the same button several times. For the activation of this feature, we add one additional line to the IR driver, which is called drivers/input/keyboard/sunxi-ir.c:

static u32 ir_gpio_hdle;


#define SYS_CLK_CFG_EN

If the Banana Pro IR receiver is also listening to a remote control of another device, sunxi IR driver can be set to a fixed address of the Banana Pro remote control. In this case, please add the additional device to the sunxi IR driver:

#define IR_ADDR_CODE 0xff00 /* Add the remote control 
address here */

Activating the sunxi lirc driver

The earlier mentioned sunxi_ir driver can only be used for NEC protocols. This limits the range of usable remote controls. There is another lirc ( Linux Infrared Remote Control) driver available, which does not filter any specific protocol. Again, the driver can be copied from dan-and’s kernel branch into the staging directory of LeMaker kernel as follows:

cd /usr/local/src
git clone https://github.com/dan-and/linux-sunxi.git 
cp /usr/local/src/linux-sunxi/drivers/staging/media/lirc/
* /usr/local/src/linux-sunxi-lemaker/drivers/staging/media/lirc

As you can see in the following screenshot, the sunxi LIRC driver must be enabled as staging driver after invoking sudo make menuconfig:

Banana Pi Blueprints

Correcting display driver brightness

The original display driver contains the following nonsense line of code in file drivers/video/sunxi/disp/de_fe.c around line 1385:

bright = (bright*64)/100;
bright = (saturation*64/100);
bright = (contrast*64/100);
bright = (hue*64)/100;

Please change these lines to:

bright = DIV_ROUND_CLOSEST((clamp(bright, 0, 100) * 63), 100);
saturation = DIV_ROUND_CLOSEST((clamp(saturation, 0, 100) * 63), 100);
contrast = DIV_ROUND_CLOSEST((clamp(contrast, 0, 100) * 63), 100);
hue = DIV_ROUND_CLOSEST((clamp(hue, 0, 100) * 63), 100);

Adding the DVB-SKY S960 USB box

One very good DVB-S2 USB box is currently offered by DVB-SY, China (http://www.dvbsky.net). The company was founded in 2010 and focuses on multimedia products such as PC tuner and embedded digital video systems. Although DVB-SKY is already providing many kernel drivers from kernel version 2 up to kernel version 3, none of their drivers for S960 from their web page worked with Banana Pro. While S960 has LINUX support since kernel 3.19, Banana Pro images are still using kernel version 3.4.x. However, there is a patch available providing S960 functionality on Banana Pro. Download this patch into LINUX kernel directory and apply it as follows:

cd /usr/loca/src/linux-sunxi-lemaker
wget https://github.com/vonfritz/meta-sunxi/raw/
cat 0001-support-for-dvbsky-usb-receiver.patch | patch –sp1

Please be sure to enable CONFIG_DVB_M88DS3103 as a module in kernel configuration.

After all the changes have been applied, please compile the new kernel and install it.

Installing an accelerated mali driver

In this section, we will install mali driver from sources. In addition, we will install X11 frame buffer turbo driver.

  1. In a first step, we will install the ump module from the sources:
    Cd /usr/local/src
    apt-get install git build-essential autoconf libtool
    git clone https://github.com/linux-sunxi/libump.git
    cd libump
    autoreconf -i
    ./configure --prefix=/usr
    make install
  2. Before we can install mali driver, we need to install libdri2 first:
    apt-get install libx11-dev libxext-dev libdrm-dev x11proto-dri2-dev libxfixes-dev
    git clone https://github.com/robclark/libdri2
    cd libdri2
    ./configure --prefix=/usr
    make install
  3. In the next step, we install the mali driver:
    cd /usr/local/src
    apt-get install git build-essential autoconf automake
    git clone --recursive https://github.com/linux-sunxi/sunxi-mali.git
    cd sunxi-mali
    make config
    make install
  4. Install the X11 framebuffer turbo driver now:
    cd /usr/local/src
    apt-get install git build-essential xorg-dev xutils-dev 
    x11proto-dri2-dev libltdl-dev libtool automake 
    git clone https://github.com/ssvb/xf86-video-fbturbo.git
    autoreconf -vi
    ./configure --prefix=/usr
    make install
    cp xorg.conf /etc/X11/xorg.conf


Klaus Schmidinger’s VDR (Video Disk Recorder) is one of the major LINUX applications. Using a DVB stick or card, VDR provides a fully featured hard disk recorder for terrestrial (DVB-T), cable (DVB-C) or satellite (DVB-S) television. In this article, we will compile VDR from the sources including all the prerequisites.

Setting the display settings

This article assumes a running X-desktop environment using xf86-video-fbturbo driver. In a first step, we set the television output to the full HD (1920 x 1080) progressive mode. Later on, we will add a de-interlacer to libvdpau. Please be sure that your /boot/uEnv.txt file contains the following entries:

root=/dev/mmcblk0p1 rootwait
#root=/dev/sda2 rootwait
extraargs=rootfstype=ext4 sunxi_ve_mem_reserve=190 
sunxi_g2d_mem_reserve=16 sunxi_fb_mem_reserve=32 hdmi.audio=EDID:1 
disp.screen0_output_mode=1920x1080p50 panic=10 consoleblank=0

The first line defines tty1 terminal (boot terminal) as a console. All the boot messages will be shown in this terminal. The root file system is booted from the first partition of memory block devices (Micro-SD card mmcblkp1). The additional parameter rootwait will wait until the boot device is available. The third line is commented out. It can be commented in instead of the second line if the root file system is located on a hard disk drive. In the earlier example, the second partition (/dev/sda2) on the hard disk is used for the root file system. The extraargs line provides the following parameters:

  • The rootfstype parameter describes the root file system type. In the previous case, the .ext4 file system is used.
  • Older LINUX kernels allow the reservation of memory for graphics driver, on-screen-display, and frame buffer. We reserve the maximum possible amount of memory for our Multimedia Centre. The graphics driver memory is ignored if the kernel CMA (Contiguous Memory Allocator) mode is switched off. In the earlier section, we set this memory to 190 MB (maximum available value).
  • The hdmi.audio=EDID:1 parameter defaults the audio output to HDMI audio. A value of 0 (instead 1 ) can be used in order to force the audio to analog audio output.
  • The disp-section overwrites the setting of the FEX-file. We set the display output to full HD (1920 x 80), progressive (50 frames per second). If later on de-interlacer of television should be used rather than de-interlacer of libvdpau, the parameter p50 can be replaced by i50 for 50 Hz output or i60 for 60 Hz output.
  • The panic=10 parameter defines 10 seconds default time, which the kernel will wait after a “kernel panic” to reboot itself. The default value of “0” would wait forever.
  • The consoleblank=0 parameter disables the screensaver for the console. A value different than 0 will activate the console screensaver after the given time in seconds. The default value is 600 (10 minutes).

The script line will use the file bananapi.bin for the configuration of Banana Pro parameters. Please name this file in accordance to your configuration located in the /boot directory. Finally, as boot kernel, the file uImage is used. After changing the uEnv.txt file, a reboot is required in order to make the changes effective.


In this article, we discussed about adding an I2S device, configuring the memory, how to activate display driver logging, and activating IR driver key. We also discussed how to set the brightness of the display driver and install the accelerated mali driver. At the end of this article, we covered how to to set the display settings using VDR.

Resources for Article:

Further resources on this subject:

Subscribe to the weekly Packt Hub newsletter

* indicates required


Please enter your comment!
Please enter your name here