[Update: A new post that follows-up this one clarifies why compiling enigma2 for this arch may not be sufficient for running it properly]
During the last days I’ve been asked to run enigma2 on the STb7109 cut 3.0 board, also called cocoref MB442, that is part of the sh4 arch family.
Enigma2 is a DVR application that runs on top of Linux and several of the standard Linux subsystems such as the Frame-buffer, Linux DVB and V4L. It’s similar to applications such as MythTV, but it was designed and developed for running on embedded systems that have limited resources compared to a Desktop PC.
I discovered that there are two different ways for doing this. The first one is through the use of a Makefile that downloads and compiles everything for you. This seems, of course, the easiest and fastest way for doing it, the only thing is that since it uses OpenEmbedded that takes a lot of time the first time for building the whole project since it downloads several GB of packages; then it compiles everything starting by generating the cross-toolchain; then it compiles all the requirements for enigma2; then it compiles enigma2 and generates a rootfs image ready for download to the target. This is a great procedure that eases your life after the first time, the big issue I had was that the enigma2 source didn’t compile, they gave me several errors.
After waiting several hours for download everything, several GB less on my hard disk and compiling errors, I decided to do it manually: the configure, make, make install way.
——————————————————————————————————-
License
The first issue that I found was that enigma2 has a weird proprietary license that forbids you to modify, compile or do anything with the source code that you can download from here.
The only thing you can do is to take the version you download and derive a version that will be licensed under the GPLv2.
That said, everything I describe in this procedure was done with a derived version of the official enigma2 source tree.
——————————————————————————————————-
Download the sources
The official enigma2 source code is obtained through the CVS tree. You can download a snapshot
cvs -z3 -d:pserver:anonymous@dreamboxupdate.com:/cvs co -P enigma2
or a certain release version:
cvs -z3 -d:pserver:anonymous@dreamboxupdate.com:/cvs co -r enigma2_rel24 enigma2
You will end up with a directory called enigma2.
According to the license, you need to derive a version of this directory in order to do whatever you want. I derived a version and start the following procedure.
——————————————————————————————————-
Requirements
Enigma2 needs several packages in order to compile, I describe the installation of the packages I needed. Notice that enigma2 needs some other packages that I already had in my rootfs like libpng. I described the installation of some of those packages here.
- fribidi-0.10.9
- id3lib-3.8.3
- libsigc++-1.2.7
- libdvbsi++-0.3.3
- libxslt-1.1.16
- libxmlccwrap-0.0.12
——————————————————————————————————-
Environment configuration
Suppose that the libraries will be installed in /opt/STM/STLinux-2.2/devkit/sh4/target and that the cross-toolchain (compiler, linker…) is in your path.
Set the following environment variables that will make our life easier:
$ export BUILD=i386-linux
$ export HOST=sh4-linux
$ export PREFIX=/opt/STM/STLinux-2.2/devkit/sh4/target
——————————————————————————————————-
Building enigma2 and its requirements
——————
fribidi
Configure, compile and install:
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
$ make
$ make install
——————
id3tag
Configure, compile and install:
./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
--enable-debug=no
$ make
$ make install
——————
libsigc++
Configure, compile and install:
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
$ make
$ make install
——————
libdvbsi++
Configure, compile and install:
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
$ make
$ make install
——————
libxslt
Edit the configure file:
Before the if() around line 21190:
if ${XML_CONFIG} --libs print > /dev/null 2>&1
set the following variables:
XML_CONFIG=/opt/STM/STLinux-2.2/devkit/sh4/target/usr/bin/xml2-config
LIBXML_CONFIG_PREFIX="/opt/STM/STLinux-2.2/devkit/sh4/target/usr"
LIBXML_src="/opt/enigma/3rd_party/libxml2-2.6.30"
Configure, compile and install:
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
--without-debug
--without-debugger
--without-crypto
$ make
$ make install
——————
libxmlccwrap
Configure:
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX/usr/local
Edit the file xmlccwrap/Makefile
Set the var INCLUDES to the following value:
INCLUDES = -I$(top_srcdir)
-I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/include/libxml2
-I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/include
Set the var LIBS to the following value:
LIBS = /opt/STM/STLinux-2.2/devkit/sh4/target/usr/lib/libxml2.so
/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib/libxslt.so
Edit the file testlib/Makefile
Set the var INCLUDES to the following value:
INCLUDES = -I$(top_srcdir) -I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/include/libxml2
Set the var LIBS to the following value:
LIBS = /opt/STM/STLinux-2.2/devkit/sh4/target/usr/lib/libxml2.so
/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local/lib/libxslt.so
Compile and install:
$ make
$ make install
——————
enigma 2
Edit the configure file:
Around line 5339, before the comment
# should allow for checking of python version here...
set the following values:
PYTHON_FLAGS="-I/opt/STM/STLinux-2.2/devkit/sh4/target/usr/include"
and substitute the var name PYTHON_CPPFLAGS by PYTHON_FLAGS inside the for() block.
Around line 5372, before the comment
# Check for Python library path
set the following values:
PYTHON_FLAGS="-L/opt/STM/STLinux-2.2/devkit/sh4/target/usr/lib/python2.4"
and substitute the var name PYTHON_LDFLAGS by PYTHON_FLAGS inside the for() block.
Around line 7710, after the if() block
if test "$HAVE_XMLCCWRAP" = "yes"; then
set the following variable:
HAVE_XMLCCWRAP="yes"
Configure:
$ PYTHON=/usr/bin/python
FREETYPE_CFLAGS=-I$PREFIX/usr/include/freetype2
FREETYPE_LIBS="-L$PREFIX/usr/lib -lfreetype"
MAD_CFLAGS=-I$PREFIX/usr/include
MAD_LIBS="-L$PREFIX/usr/lib -lmad"
PNG_CFLAGS=-I$PREFIX/usr/include
PNG_LIBS="-L$PREFIX/usr/lib -lpng12"
XML2_CFLAGS=-I$PREFIX/usr/include/libxml2
XML2_LIBS="-L$PREFIX/usr/lib -lxml2"
FRIBIDI_CFLAGS=-I$PREFIX/usr/local/include
FRIBIDI_LIBS="-L$PREFIX/usr/local/lib -lfribidi"
ID3TAG_CFLAGS=-I$PREFIX/usr/local/include
ID3TAG_LIBS="-L$PREFIX/usr/local/lib -lid3"
SIGC_CFLAGS="-I$PREFIX/usr/local/include/sigc++-1.2
-I$PREFIX/usr/local/lib/sigc++-1.2/include"
SIGC_LIBS="-L$PREFIX/usr/local/lib -lsigc-1.2"
DVBSI_CFLAGS=-I$PREFIX/usr/local/include
DVBSI_LIBS="-L$PREFIX/usr/local/lib -ldvbsi++"
XMLCCWRAP_LIBS="-L$PREFIX/usr/local/lib -lxmlccwrap"
./configure
--build=$BUILD
--host=$HOST
--prefix=$PREFIX/usr/local
--exec_prefix=$PREFIX/usr/local
--bindir=$PREFIX/usr/local/bin
--sbindir=$PREFIX/usr/local/sbin
--libexecdir=$PREFIX/usr/local/libexec
--datadir=$PREFIX/usr/local/share
--sysconfdir=$PREFIX/local/etc
--sharedstatedir=$PREFIX/usr/local/com
--localstatedir=$PREFIX/var
--libdir=$PREFIX/usr/local/lib
--includedir=$PREFIX/usr/local/include
--oldincludedir=$PREFIX/usr/local/include
--infodir=$PREFIX/usr/local/share/info
--mandir=$PREFIX/usr/local/share/man
--with-target=native
--with-libsdl=no
If you don’t have the same LCD, you will have to edit the file lib/gdi/lcd.cpp
You can comment must of the code using the NO_LCD define and adding it at the
end of the var DEFS in lib/gdi/Makefile
Edit the main/Makefile:
Add at the end of the var enigma2_LDADD the following values:
-lxslt -lutil -lpython2.4
Compile and install:
$ make
$ make install
Now you can connect to your target and happily execute it:
$ enigma2
That’s it.