How to compile software for VU Plus (Vu+)

Spread the love

VU Plus Solo2You would like to deviate from the beaten track and compile software for your VU Plus (VU+) yourself? Read this article!

This article is also more or less applicable for building software for any other device running OpenVuPlus but is written with the VU+ Solo2 in mind.

As computer for compiling the software, a Linux-desktop has been used.

The VU Plus is a receiver for (encoded) digital television and radio broadcasts. There are different tuners available for receiving satellite (Digital Video Broadcasting DVB-S), terrestrial (DVB-T) and cable (DVB-C) broadcasts. In the Netherlands DVB-T is known as ‘Digitenne’. Most of the VU Plus boxes contains a hard disk to record TV-shows.

The base of the Linux-distribution at a VU Plus box is a special version of OpenEmbedded, namely OpenVuPlus. As the name suggests, this is an OpenSource-project.

Please also read the article how to compile software for the Dreambox (in Dutch).

Preparations

Let’s start to configure the computer so that we are able to compile our HelloWorld-application. First install the needed packages for (c-)compiling software. Besides of the well known software also think of ‘git’ and ‘python’. More information about needed software to be able to compile is available via the link: OpenEmbedded at the end of this article.

Clone OpenVuPlus-repository

Now clone the GIT-repository for OpenVuPlus (version 2.1) to your home directory:

cd ~
git clone git://code.vuplus.com/git/openvuplus.git

Configure the VU Plus-toolchain and software development kit (SDK)

This step contains of building a complete image including the VU Plus-toolchain, kernel and packages. During this step, also new files will be downloaded from the Internet. This step will last a long time!

  1. Step into the OpenVuPlus-directory:
    cd ~/openvuplus
  2. Start compiling:
    make image MACHINE=vusolo2

    Possible values for MACHINE are: vusolo, bm750, vuuno, vuultimo and vusolo2.

Optional: Updating VU Plus with new image

After the previous step you will find a ZIP-file at this location:
build/vusolo2/tmp/deploy/images/vuplus-image-vusolo2*_usb.zip

  1. Unzip this file to a USB stick.
  2. Insert the USB stick into the USB port of your VU Plus device while powered off
  3. Power the VU Plus device on
  4. It takes just a few seconds to update.
  5. When you see the message “Finished..reboot” on the display, remove the USB stick and restart the box.
  6. How to configure the box? Read the article Configuring Enigma2

HelloWorld-package

Create a directory-structure for your HelloWorld-package:

mkdir meta-openvuplus/recipes-extended/myhelloworld
mkdir meta-openvuplus/recipes-extended/myhelloworld/files

Develop the HelloWorld-application

Now we will create a simple HelloWorld-application that writes the text “Hello world!” to standard output (stdout). Put the code below in the file:
meta-openvuplus/recipes-extended/myhelloworld/files/helloworld.c

#include <stdio.h>

int main(int argc, char** argv){
        printf("Hello world!\n\n");
        return 0;
}

Besides of this we create a README-file containing information about this application:
meta-openvuplus/recipes-extended/myhelloworld/files/README.txt

Readme-file for the HelloWorld application.

We also have to create a LICENSE-file containing copyright information for this application, leave it empty for now.

touch meta-openvuplus/recipes-extended/myhelloworld/LICENSE

In the next step we do need the MD5-hash of this LICENSE-file, find it using the command ‘md5sum’.

md5sum meta-openvuplus/recipes-extended/myhelloworld/LICENSE

For an empty file, the MD5-hash is: d41d8cd98f00b204e9800998ecf8427e.

Bitbake-recipe

Bitbake is a tool similar to the well known ‘make’-tool. Bitbake is extremely useful for creating embedded Linux packages. You can compile the source using a cross compiler.

In this step you will learn how to create a simple Bitbake-recipe for creating the HelloWorld-package. Put the snippet below into the file:
meta-openvuplus/recipes-extended/myhelloworld/myhelloworld_0.1.bb

DESCRIPTION = "HelloWorld application"
PR = "r0"

LICENSE = "TEST LICENSE"
LIC_FILES_CHKSUM = "file:///home/vincent/openvuplus/meta-openvuplus/recipes-extended/myhelloworld/LICENSE;md5=d41d8cd98f00b204e9800998ecf8427e"

SRC_URI = "file://helloworld.c \
           file://README.txt"

do_compile() {
        ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/helloworld.c -o helloworld
}

do_install() {
        install -m 0755 -d ${D}${bindir} ${D}${docdir}/myhelloworld
        install -m 0755 ${S}/helloworld ${D}${bindir}
        install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/myhelloworld
}

Here you can read from top to bottom the description of the package, the version (r0), the license details, the command line which is used to compile ‘helloworld’ using the cross compiler and the instructions to execute when we install the package. Make sure you use the correct MD5-hash and license file as value for the variable LIC_FILES_CHKSUM. You have to supply the absolute file path to the license file.

Compile and package

  1. Visit the directory: build/vusolo2:
    cd build/vusolo2
  2. Source the Bitbake environment file:
    source bitbake.env

    Using this command, several environment variables are set such as the path to Bitbake, path to openembedded source files and the path to the cross compiler.

  3. Start compiling and packaging:
    bitbake myhelloworld

After some seconds you will find the HelloWorld-package at this location:
tmp/deploy/ipk/mips32el/myhelloworld_0.1-r0_mips32el.ipk

Note: You can check whether this ‘helloworld’-binary is indeed compiled for your VU Plus box and not for your computer which was used for compiling. Check the output of the command:

file tmp/work/mips32el-oe-linux/myhelloworld/myhelloworld-0.1-r0/package/usr/bin/helloworld

Output file type of helloworld:

ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, stripped

When we ask the file type of an executable which is running and the computer which compiled the package, for example ‘mkdir’ we will see another output:

file `which mkdir`

The output of this command is at my system:

ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x6103d2569357188771dc8687767acb290e3118dd, stripped

The CPU of the VU Box has indeed a MIPS-architecture and the CPU at my build-machine has the x86-architecture.

Install and test the HelloWorld-package at your VU Plus box

Let’s install the package at the VU Plus:

  1. First use secure copy (scp) to upload the package to the VU Plus box:
    scp tmp/deploy/ipk/mips32el/myhelloworld_0.1-r0_mips32el.ipk root@ip-address-of-vuplus-box:/tmp/
  2. Now login to your VU Plus box and become root
  3. Execute this command to install the package:
    opkg install /tmp/myhelloworld_0.1-r0_mips32el.ipk
  4. Finally execute the application:
    helloworld
  5. Check the output of the application!
    …Hello world!… Wow isn’t that amazing?!

Further reading

Leave a comment