{"id":8,"date":"2008-07-21T00:34:09","date_gmt":"2008-07-20T23:34:09","guid":{"rendered":"http:\/\/paguilar.org\/?p=8"},"modified":"2008-07-21T00:34:09","modified_gmt":"2008-07-20T23:34:09","slug":"compiling-enigma2-for-the-sh4-arch","status":"publish","type":"post","link":"https:\/\/paguilar.org\/?p=8","title":{"rendered":"Compiling enigma2 for the sh4 arch"},"content":{"rendered":"<p>[<strong>Update<\/strong>: A new <a href=\"https:\/\/paguilar.org\/?p=14\" title=\"Running enigma2 in the sh4 arch\">post<\/a> that follows-up this one clarifies why compiling enigma2 for this arch may not be sufficient for running it properly]<\/p>\n<p>During the last days I&#8217;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.<\/p>\n<p>Enigma2 is a DVR application that runs on top of Linux and several of the standard Linux subsystems such as the Frame-buffer,\u00a0 Linux DVB and V4L. It&#8217;s similar to applications such as MythTV, but it was designed and developed for running on embedded systems that have\u00a0 limited resources compared to a Desktop PC.<\/p>\n<p>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 <a href=\"http:\/\/wiki.openembedded.net\/index.php\/Main_Page\" title=\"OpenEmbedded\" target=\"_blank\">OpenEmbedded <\/a>that takes <em>a lot of time<\/em> 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&#8217;t compile, they gave me several errors.<\/p>\n<p>After waiting several hours for download everything, several GB less on my hard disk and compiling errors, I decided to do it manually: the <em>configure<\/em>, <em>make<\/em>, <em>make install<\/em> way.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><strong>License<\/strong><\/p>\n<p>The first issue that I found was that enigma2 has a <em>weird<\/em> proprietary license that forbids you to modify, compile or do anything with the source code that you can download from <a href=\"http:\/\/www.saunalahti.fi\/znark\/dreambox\/dm7025\/enigma2_development_toolchain\/#2.3\" title=\"enigma2 download\" target=\"_blank\">here<\/a>.<\/p>\n<p>The only thing you can do is to take the version you download and derive a version\u00a0 that will be licensed under the GPLv2.<\/p>\n<p>That said, everything I describe in this procedure was done with a\u00a0 derived version of the official enigma2 source tree.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><strong>Download the sources<\/strong><\/p>\n<p>The official enigma2 source code is obtained through the CVS tree. You can download a snapshot<\/p>\n<pre lang=\"bash\">\ncvs -z3 -d:pserver:anonymous@dreamboxupdate.com:\/cvs co -P enigma2<\/pre>\n<p>or a certain release version:<\/p>\n<pre lang=\"bash\">\ncvs -z3 -d:pserver:anonymous@dreamboxupdate.com:\/cvs co -r enigma2_rel24  enigma2<\/pre>\n<p>You will end up with a directory called enigma2.<\/p>\n<p>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.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><strong>Requirements <\/strong><\/p>\n<p>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 <a href=\"https:\/\/paguilar.org\/?p=6\" title=\"Compiling GTK+ over DirectFB\" target=\"_blank\">here<\/a>.<\/p>\n<ul>\n<li>fribidi-0.10.9<\/li>\n<li>id3lib-3.8.3<\/li>\n<li>libsigc++-1.2.7<\/li>\n<li>libdvbsi++-0.3.3<\/li>\n<li>libxslt-1.1.16<\/li>\n<li>libxmlccwrap-0.0.12<\/li>\n<\/ul>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p><strong>Environment configuration<\/strong><\/p>\n<p>Suppose that the libraries will be installed in <em>\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target<\/em> and that the cross-toolchain (compiler, linker\u2026) is in your path.<\/p>\n<p>Set the following environment variables that will make our life easier:<\/p>\n<pre lang=\"bash\">\n$ export BUILD=i386-linux\n$ export HOST=sh4-linux\n$ export PREFIX=\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n<strong> Building enigma2 and its requirements<br \/>\n<\/strong><\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>fribidi<\/em><\/p>\n<p>Configure, compile and install:<\/p>\n<pre lang=\"bash\">\n$ .\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>id3tag<\/em><\/p>\n<p>Configure, compile and install:<\/p>\n<pre lang=\"bash\">\n.\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local \n--enable-debug=no\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>libsigc++<\/em><\/p>\n<p>Configure, compile and install:<\/p>\n<pre lang=\"bash\">\n$ .\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>libdvbsi++<\/em><\/p>\n<p>Configure, compile and install:<\/p>\n<pre lang=\"bash\">\n$ .\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>libxslt<\/em><\/p>\n<p>Edit the <em>configure<\/em> file:<\/p>\n<p>Before the if() around line 21190:<\/p>\n<pre lang=\"bash\">\nif ${XML_CONFIG} --libs print &gt; \/dev\/null 2&gt;&amp;1<\/pre>\n<p>set the following variables:<\/p>\n<pre lang=\"bash\">\nXML_CONFIG=\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/bin\/xml2-config\nLIBXML_CONFIG_PREFIX=\"\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\"\nLIBXML_src=\"\/opt\/enigma\/3rd_party\/libxml2-2.6.30\"<\/pre>\n<p>Configure, compile and install:<\/p>\n<pre lang=\"bash\">\n$ .\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local \n  --without-debug \n  --without-debugger \n  --without-crypto\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>libxmlccwrap<\/em><\/p>\n<p>Configure:<\/p>\n<pre lang=\"bash\">\n$ .\/configure --build=$BUILD --host=$HOST --prefix=$PREFIX\/usr\/local<\/pre>\n<p>Edit the file <em>xmlccwrap\/Makefile<\/em><\/p>\n<p>Set the var <em>INCLUDES<\/em> to the following value:<\/p>\n<pre lang=\"bash\">\nINCLUDES = -I$(top_srcdir) \n  -I\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/include\/libxml2 \n  -I\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/local\/include<\/pre>\n<p>Set the var <em>LIBS<\/em> to the following value:<\/p>\n<pre lang=\"bash\">\nLIBS = \/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/lib\/libxml2.so \n\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/local\/lib\/libxslt.so<\/pre>\n<p>Edit the file <em>testlib\/Makefile<\/em><\/p>\n<p>Set the var <em>INCLUDES<\/em> to the following value:<\/p>\n<pre lang=\"bash\">\nINCLUDES = -I$(top_srcdir) -I\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/include\/libxml2<\/pre>\n<p>Set the var <em>LIBS<\/em> to the following value:<\/p>\n<pre lang=\"bash\">\nLIBS = \/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/lib\/libxml2.so \n\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/local\/lib\/libxslt.so<\/pre>\n<p>Compile and install:<\/p>\n<pre lang=\"bash\">\n$ make\n$ make install<\/pre>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p><em>enigma 2<\/em><\/p>\n<p>Edit the configure file:<\/p>\n<p>Around line 5339, before the comment<\/p>\n<pre lang=\"bash\">\n# should allow for checking of python version here...<\/pre>\n<p>set the following values:<\/p>\n<pre lang=\"bash\">\nPYTHON_FLAGS=\"-I\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/include\"<\/pre>\n<p>and substitute the var name <em>PYTHON_CPPFLAGS<\/em> by <em>PYTHON_FLAGS<\/em> inside the for() block.<\/p>\n<p>Around line 5372, before the comment<\/p>\n<pre lang=\"bash\">\n# Check for Python library path<\/pre>\n<p>set the following values:<\/p>\n<pre lang=\"bash\">\nPYTHON_FLAGS=\"-L\/opt\/STM\/STLinux-2.2\/devkit\/sh4\/target\/usr\/lib\/python2.4\"<\/pre>\n<p>and substitute the var name <em>PYTHON_LDFLAGS<\/em> by <em>PYTHON_FLAGS<\/em> inside the for() block.<\/p>\n<p>Around line 7710, after the if() block<\/p>\n<pre lang=\"bash\">\nif test \"$HAVE_XMLCCWRAP\" = \"yes\"; then<\/pre>\n<p>set the following variable:<\/p>\n<pre lang=\"bash\">\nHAVE_XMLCCWRAP=\"yes\"<\/pre>\n<p>Configure:<\/p>\n<pre lang=\"bash\">\n$ PYTHON=\/usr\/bin\/python \n  FREETYPE_CFLAGS=-I$PREFIX\/usr\/include\/freetype2 \n  FREETYPE_LIBS=\"-L$PREFIX\/usr\/lib -lfreetype\" \n  MAD_CFLAGS=-I$PREFIX\/usr\/include \n  MAD_LIBS=\"-L$PREFIX\/usr\/lib -lmad\" \n  PNG_CFLAGS=-I$PREFIX\/usr\/include \n  PNG_LIBS=\"-L$PREFIX\/usr\/lib -lpng12\" \n  XML2_CFLAGS=-I$PREFIX\/usr\/include\/libxml2 \n  XML2_LIBS=\"-L$PREFIX\/usr\/lib -lxml2\" \n  FRIBIDI_CFLAGS=-I$PREFIX\/usr\/local\/include \n  FRIBIDI_LIBS=\"-L$PREFIX\/usr\/local\/lib -lfribidi\" \n  ID3TAG_CFLAGS=-I$PREFIX\/usr\/local\/include \n  ID3TAG_LIBS=\"-L$PREFIX\/usr\/local\/lib -lid3\" \n  SIGC_CFLAGS=\"-I$PREFIX\/usr\/local\/include\/sigc++-1.2 \n  -I$PREFIX\/usr\/local\/lib\/sigc++-1.2\/include\" \n  SIGC_LIBS=\"-L$PREFIX\/usr\/local\/lib -lsigc-1.2\" \n  DVBSI_CFLAGS=-I$PREFIX\/usr\/local\/include \n  DVBSI_LIBS=\"-L$PREFIX\/usr\/local\/lib -ldvbsi++\" \n  XMLCCWRAP_LIBS=\"-L$PREFIX\/usr\/local\/lib -lxmlccwrap\" \n  .\/configure \n  --build=$BUILD \n  --host=$HOST \n  --prefix=$PREFIX\/usr\/local \n  --exec_prefix=$PREFIX\/usr\/local\u00a0 \n  --bindir=$PREFIX\/usr\/local\/bin\u00a0 \n  --sbindir=$PREFIX\/usr\/local\/sbin \n  --libexecdir=$PREFIX\/usr\/local\/libexec\u00a0 \n  --datadir=$PREFIX\/usr\/local\/share\u00a0 \n  --sysconfdir=$PREFIX\/local\/etc \n  --sharedstatedir=$PREFIX\/usr\/local\/com\u00a0 \n  --localstatedir=$PREFIX\/var\u00a0 \n  --libdir=$PREFIX\/usr\/local\/lib \n  --includedir=$PREFIX\/usr\/local\/include\u00a0 \n  --oldincludedir=$PREFIX\/usr\/local\/include \n  --infodir=$PREFIX\/usr\/local\/share\/info\u00a0 \n  --mandir=$PREFIX\/usr\/local\/share\/man \n  --with-target=native \n  --with-libsdl=no<\/pre>\n<p>If you don&#8217;t have the same LCD, you will have to edit the file <em>lib\/gdi\/lcd.cpp<\/em><br \/>\nYou can comment must of the code using the NO_LCD define and adding it at the<br \/>\nend of the var <em>DEFS<\/em> in <em>lib\/gdi\/Makefile<\/em><\/p>\n<p>Edit the <em>main\/Makefile<\/em>:<\/p>\n<p>Add at the end of the var <em>enigma2_LDADD<\/em> the following values:<\/p>\n<pre lang=\"bash\">\n-lxslt -lutil -lpython2.4<\/pre>\n<p>Compile and install:<\/p>\n<pre lang=\"bash\">\n$ make\n$ make install<\/pre>\n<p>Now you can connect to your target and happily execute it:<\/p>\n<pre lang=\"bash\">\n$ enigma2<\/pre>\n<p>That&#8217;s it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[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&#8217;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\u2026 <span class=\"read-more\"><a href=\"https:\/\/paguilar.org\/?p=8\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,9],"tags":[52,55],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-compiling","category-enigma2","tag-compiling","tag-enigma2"],"_links":{"self":[{"href":"https:\/\/paguilar.org\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/paguilar.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/paguilar.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/paguilar.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/paguilar.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/paguilar.org\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/paguilar.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/paguilar.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/paguilar.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}