{"id":1299,"date":"2013-10-16T22:16:37","date_gmt":"2013-10-16T20:16:37","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=1299"},"modified":"2022-01-20T21:22:08","modified_gmt":"2022-01-20T20:22:08","slug":"raspberry-pi-cross-compiling-the-knxeib-eibd","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/raspberry-pi-cross-compiling-the-knxeib-eibd\/","title":{"rendered":"Raspberry PI: Cross compiling the KNX\/EIB eibd"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_1299 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_1299')){$('.twoclick_social_bookmarks_post_1299').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Raspberry%20PI%3A%20Cross%20compiling%20the%20KNX%2FEIB%20eibd\",\"the_excerpt\":\"Hello%2C%0D%0A%0D%0Aif%20you%20want%20to%20use%20the%20Raspberry%20PI%20as%20a%20EIB%2FKNX%20Gateway%20or%20Tunnel%20you%20must%20compile%20the%20eibd%20sources%20from%20the%20scratch%2C%20because%20no%20precomplied%20binaries%20are%20currently%20available.%0D%0A%0D%0AThere%20are%20two%20ways%20to%20build%20the%20eibd.%20Compiling%20directly%20on%20the%20Raspberry%20PI%20or%20you%20compile%20it%20on%20your%20i386%20PC.%20The%20last%20option%20means%20you%20have%20to%20%22cross%22%20compile%20the%20sources%2C%20because%20the%20RapsberryPi%20has%20a%20di%20...\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/raspberry-pi-cross-compiling-the-knxeib-eibd\\\/\",\"post_id\":1299,\"post_title_referrer_track\":\"Raspberry+PI%3A+Cross+compiling+the+KNX%2FEIB+eibd\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hello,<\/p>\n<p>if you want to use the Raspberry PI as a EIB\/KNX Gateway or Tunnel you must compile the eibd sources from the scratch, because no precomplied binaries are currently available.<\/p>\n<p>There are two ways to build the eibd. Compiling directly on the Raspberry PI or you compile it on your i386 PC. The last option means you have to &#8220;cross&#8221; compile the sources, because the RapsberryPi has a different processor architecture than your Intel\/AMD PC. Here are the steps to build the eibd on an i386 using a crosscompiler for the ARM architucture.<\/p>\n<p>I verfied the steps at a minimal debian system in a VirtualBox. So it is reproducible:-)<\/p>\n<p>Install all necessary packages. Login as root<\/p>\n<p><code>apt-get -y install git rsync cmake make gcc g++ binutils automake flex bison patch<\/code><br \/>\nNow you can Login as a &#8220;normal&#8221; user. Define a working folder<br \/>\n<code>export BUILD_PATH=~\/eibdbuild<\/code><br \/>\n<code>mkdir -p $BUILD_PATH<\/code><br \/>\n<code>cd $BUILD_PATH<\/code><br \/>\nWe need a cross compiler respectively the toolchain for the <code>arm1176jzf<\/code> arm processor.<br \/>\n<!--more--><br \/>\nFor the RaspberryPI a project exists at <a title=\"Raspberry PI Tools at github\" href=\"https:\/\/github.com\/raspberrypi\/tools\">Github<\/a>.\u00a0 Define a folder for the tools and compiler, create and change to it<br \/>\n<code>export RASPBERRY_CROSS_COMPILER=$BUILD_PATH\/raspPiTools<\/code><br \/>\n<code>mkdir -p $RASPBERRY_CROSS_COMPILER<br \/>\ncd $RASPBERRY_CROSS_COMPILER<br \/>\n<\/code>Get the latest version<br \/>\n<code>git clone git:\/\/github.com\/raspberrypi\/tools.git<\/code><br \/>\nAdd the location of compiler binary to the search PATH<br \/>\n<code>PATH=$PATH:$RASPBERRY_CROSS_COMPILER\/tools\/arm-bcm2708\/gcc-linaro-arm-linux-gnueabihf-raspbian\/bin<\/code><br \/>\nCheck the compiler, this should return something like this<br \/>\n<code><strong>arm-linux-gnueabihf-gcc -v<\/strong><br \/>\nUsing built-in specs.<br \/>\nCOLLECT_GCC=arm-linux-gnueabihf-gcc<br \/>\nCOLLECT_LTO_WRAPPER=\/home\/michael\/eibdbuild\/raspPiTools\/tools\/arm-bcm2708\/gcc-linaro-arm-linux-gnueabihf-raspbian\/bin\/..\/libexec\/gcc\/arm-linux-gnueabihf\/4.7.2\/lto-wrapper<br \/>\nTarget: arm-linux-gnueabihf<br \/>\nConfigured with: \/cbuild\/slaves\/oort61\/crosstool-ng\/builds\/arm-linux-gnueabihf-raspbian-linux\/.build\/src\/gcc-linaro-4.7-2012.08\/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=\/cbuild\/slaves\/oort61\/crosstool-ng\/builds\/arm-linux-gnueabihf-raspbian-linux\/install ............<\/code><\/p>\n<p>define the architecture<\/p>\n<p><code>export TARGET_ARCH=arm-linux-gnueabihf<\/code><br \/>\ndefine a folder where the complied binaries should copied to.<br \/>\n<code>export BUILD_ROOT=$BUILD_PATH\/build<\/code><br \/>\nGet and compile pthsem<br \/>\n<code>cd $BUILD_PATH<br \/>\nmkdir pthsem<br \/>\ncd pthsem<br \/>\nwget http:\/\/www.auto.tuwien.ac.at\/~mkoegler\/pth\/pthsem_2.0.8.tar.gz<br \/>\ntar -xvzf pthsem_2.0.8.tar.gz<br \/>\ncd pthsem-2.0.8<\/code><br \/>\n<code>.\/configure --enable-static=yes --build=i386-linux-gnu --target=$TARGET_ARCH --host=$TARGET_ARCH --prefix=$BUILD_ROOT CC=\"$TARGET_ARCH-gcc\" CFLAGS=\"-static -static-libgcc -static-libstdc++ -marm -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s\" --with-mctx-mth=sjlj --with-mctx-dsp=ssjlj --with-mctx-stk=sas LDFLAGS=\"-static -static-libgcc -static-libstdc++\" <\/code><br \/>\n<code>make &amp;&amp; make install<\/code><\/p>\n<p><!--Ads1--><\/p>\n<p>Check if the new pthsem library is in the correct folder<\/p>\n<p><code>ls -l $BUILD_ROOT\/lib<br \/>\ntotal 132<br \/>\n-rw-r--r-- 1 michael michael 126842 Oct 17 22:32 libpthsem.a<br \/>\n-rwxr-xr-x 1 michael michael\u00a0\u00a0\u00a0 894 Oct 17 22:32 libpthsem.la<br \/>\ndrwxr-xr-x 2 michael michael\u00a0\u00a0 4096 Oct 17 22:32 pkgconfig<\/code><br \/>\nAdd the path of the library to LD_LIBRARY_PATH<br \/>\n<code>export LD_LIBRARY_PATH=$BUILD_ROOT\/lib:$LD_LIBRARY_PATH<\/code><br \/>\nGet and compile the bcusdk<br \/>\n<code>cd $BUILD_PATH<br \/>\nmkdir bcusdk<br \/>\ncd bcusdk<br \/>\nwget http:\/\/netcologne.dl.sourceforge.net\/project\/bcusdk\/bcusdk\/bcusdk_0.0.5.tar.gz<br \/>\ntar -xvzf bcusdk_0.0.5.tar.gz<br \/>\ncd bcusdk-0.0.5<\/code><\/p>\n<p>Before you start configure. Select the features which the eibd daemon should support:<\/p>\n<p>Select the features eibd should support:<br \/>\n&#8211;enable-ft12\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable FT1.2 backend<br \/>\n&#8211;enable-pei16\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable BCU1 kernel driver backend<br \/>\n&#8211;enable-tpuart\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable TPUART kernel driver backend (deprecated)<br \/>\n&#8211;enable-pei16s\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable BCU1 user driver backend (very experimental)<br \/>\n&#8211;enable-tpuarts\u00a0\u00a0\u00a0\u00a0\u00a0 enable TPUART user driver backend<br \/>\n&#8211;enable-eibnetip\u00a0\u00a0\u00a0\u00a0 enable EIBnet\/IP routing backend<br \/>\n&#8211;enable-eibnetiptunnel\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable EIBnet\/IP tunneling backend<br \/>\n&#8211;enable-usb\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable USB backend<br \/>\n&#8211;enable-eibnetipserver\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable EIBnet\/IP server frontend<br \/>\n&#8211;enable-groupcache\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 enable Group Cache (default: yes)<br \/>\n&#8211;enable-java\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 build java client library<\/p>\n<p>Add or remove it from the configure command line.<\/p>\n<p><code>.\/configure --enable-onlyeibd --enable-tpuarts --enable-tpuart --enable-ft12 --enable-eibnetip --enable-eibnetiptunnel --enable-eibnetipserver --enable-groupcache --enable-static=yes\u00a0 --build=i386-linux-gnu --target=$TARGET_ARCH --host=$TARGET_ARCH --prefix=$BUILD_ROOT --with-pth=$BUILD_ROOT\u00a0 --without-pth-test CC=\"$TARGET_ARCH-gcc\" CFLAGS=\"-static -static-libgcc -static-libstdc++ -marm\u00a0 -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s\" LDFLAGS=\"-static -static-libgcc -static-libstdc++ -s\" CPPFLAGS=\"-static -static-libgcc -static-libstdc++ -Os -fmerge-constants\" <\/code><\/p>\n<p><code>make &amp;&amp; make install<\/code><br \/>\nIf the compilation succeeds you find the eibd and the tools at<br \/>\n<code>ls -l $BUILD_ROOT\/bin<br \/>\ntotal 1512<br \/>\n-rwxr-xr-x 1 michael michael 156775 Oct 17 22:44 bcuaddrtab<br \/>\n-rwxr-xr-x 1 michael michael 154727 Oct 17 22:44 bcuread<br \/>\n-rwxr-xr-x 1 michael michael 8171 Oct 17 22:44 busmonitor1<br \/>\n-rwxr-xr-x 1 michael michael 8167 Oct 17 22:44 busmonitor2<br \/>\n-rwxr-xr-x 1 michael michael 399715 Oct 17 22:44 eibd<br \/>\n-rwxr-xr-x 1 michael michael 161259 Oct 17 22:44 eibnetdescribe<br \/>\n-rwxr-xr-x 1 michael michael 161439 Oct 17 22:44 eibnetsearch<\/code><\/p>\n<p>Copy the all subfolders of\u00a0 the <code>$BUILD_ROOT<\/code> folder to your Raspberry PI. Either to <code>\/usr<\/code> or <code>\/usr\/local<\/code> folder. I prefer the last one to sparate it from the system files.<\/p>\n<p>Whats left are startup scripts for eibd. See next post.<\/p>\n<p>Michael <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello, if you want to use the Raspberry PI as a EIB\/KNX Gateway or Tunnel you must compile the eibd sources from the scratch, because no precomplied binaries are currently available. There are two ways to build the eibd. Compiling directly on the Raspberry PI or you compile it on your i386 PC. The last &hellip; <a href=\"https:\/\/michlstechblog.info\/blog\/raspberry-pi-cross-compiling-the-knxeib-eibd\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Raspberry PI: Cross compiling the KNX\/EIB eibd<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[329,3,330],"tags":[337,336,342,331,341,224,863],"class_list":["post-1299","post","type-post","status-publish","format-standard","hentry","category-eibknx","category-linux","category-raspberry-pi","tag-compile","tag-cross-compiling","tag-eib","tag-eibd","tag-knx","tag-linux-2","tag-raspberry-pi"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=1299"}],"version-history":[{"count":34,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1299\/revisions"}],"predecessor-version":[{"id":8351,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1299\/revisions\/8351"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=1299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=1299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=1299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}