{"id":646,"date":"2018-06-28T23:19:34","date_gmt":"2018-06-28T21:19:34","guid":{"rendered":"https:\/\/www.anginf.de\/?p=646"},"modified":"2018-06-28T23:19:34","modified_gmt":"2018-06-28T21:19:34","slug":"create-additional-tool-arp-scan-for-libreelec","status":"publish","type":"post","link":"https:\/\/www.anginf.de\/?p=646","title":{"rendered":"Create additional tool (arp-scan) for LibreELEC"},"content":{"rendered":"<p>I wanted my Rasperry Pi 2, which was running LibreELEC, to additionally scan for specific network devices. I didn&#8217;t want to change the LibreELEC, as I was very satisfied with it. So here&#8217;s how I managed to cross-compile on my linux box the tool `arp-scan`.<\/p>\n<p>1.) Get the LibreELEC.tv-Source and compile an image.<\/p>\n<p>Make sure that this works before continuing with anything else. I managed to compile the 9.0-devel version.<\/p>\n<p>Instructions are given on the <a href=\"https:\/\/wiki.libreelec.tv\/compile\" rel=\"noopener\" target=\"_blank\">LibreELEC-Wiki<\/a><\/p>\n<p>2.) Create the arp-scan directory and the package.mk<\/p>\n<pre lang=\"bash\">\r\nmkdir -p packages\/tools\/arp-scan\r\ncat >packages\/tools\/arp-scan\/package.mk <<EOF\r\n################################################################################\r\n#      This file is part of LibreELEC - https:\/\/libreelec.tv\r\n#      Copyright (C) 2018-present Team LibreELEC\r\n#\r\n#  LibreELEC is free software: you can redistribute it and\/or modify\r\n#  it under the terms of the GNU General Public License as published by\r\n#  the Free Software Foundation, either version 2 of the License, or\r\n#  (at your option) any later version.\r\n#\r\n#  LibreELEC is distributed in the hope that it will be useful,\r\n#  but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n#  GNU General Public License for more details.\r\n#\r\n#  You should have received a copy of the GNU General Public License\r\n#  along with LibreELEC.  If not, see <http:\/\/www.gnu.org\/licenses\/>.\r\n################################################################################\r\n\r\nPKG_NAME=\"arp-scan\"\r\nPKG_VERSION=\"1.9\"\r\nPKG_ARCH=\"arm\"\r\nPKG_LICENSE=\"GPL\"\r\nPKG_SITE=\"http:\/\/www.nta-monitor.com\/wiki\/index.php\/Arp-scan_Installation_Guide\"\r\nPKG_URL=\"https:\/\/github.com\/royhills\/arp-scan\/releases\/download\/$PKG_VERSION\/arp-scan-$PKG_VERSION.tar.gz\"\r\nPKG_DEPENDS_TARGET=\"toolchain zlib libpcap\"\r\nPKG_SECTION=\"tools\"\r\nPKG_SHORTDESC=\"arp-scan\"\r\nPKG_LONGDESC=\"The arp-scan utility\"\r\nPKG_TOOLCHAIN=\"auto\"\r\n\r\npost_patch() {\r\n  rm $PKG_BUILD\/configure\r\n  cd $PKG_BUILD\r\n  autoconf\r\n}\r\nEOF\r\n<\/pre>\n<p>3.) Add needed patches<\/p>\n<p>To get a patch-File from a github-commit, you can just add `.patch` to the url and you&#8217;ll get a correct patchable diff.<\/p>\n<pre lang=\"bash\">\r\nmkdir -p packages\/tools\/arp-scan\/patches\r\n<\/pre>\n<p>I needed the change for the cross compilation, but the author hadn&#8217;t released a new version yet, so I had to download and include the patch:<\/p>\n<pre lang=\"bash\">\r\nwget https:\/\/github.com\/royhills\/arp-scan\/commit\/f74edaf821f49652b7649ff6113fc6685d2c952a.patch -O packages\/tools\/arp-scan\/patches\/Assume-long-long-int-format-is-lld-if-cross-compiling.patch\r\n<\/pre>\n<p>Sadly this won&#8217;t help with the release file, as the configure script already exists. So we have to delete the configure-File to force the package-System to run &#8222;autoconf&#8220;. That&#8217;s the reason for the `post_patch()`-Section in the package.mk.<\/p>\n<p>4.) Add ourself to the dependency tree<\/p>\n<pre lang=\"bash\">\r\nsed -i 's\/PKG_DEPENDS_TARGET=\"toolchain connman netbase ethtool openssh\"\/PKG_DEPENDS_TARGET=\"toolchain connman netbase ethtool openssh arp-scan\"\/' .\/packages\/virtual\/network\/package.mk\r\n<\/pre>\n<p>5.) Copy resulting file to host<br \/>\nIn this case, we have to copy the libpcap.a and the arp-scan binary, like this:<\/p>\n<pre lang=\"bash\">\r\nscp build.LibreELEC-RPi2.arm-9.0-devel\/libpcap-1.7.4\/.armv7ve-libreelec-linux-gnueabi\/libpcap.a targethost:\r\nscp build.LibreELEC-RPi2.arm-9.0-devel\/arp-scan-1.9\/.armv7ve-libreelec-linux-gnueabi\/arp-scan targethost:\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I wanted my Rasperry Pi 2, which was running LibreELEC, to additionally scan for specific network devices. I didn&#8217;t want to change the LibreELEC, as I was very satisfied with it. So here&#8217;s how I managed to cross-compile on my linux box the tool `arp-scan`. 1.) Get the LibreELEC.tv-Source and compile an image. Make sure &hellip; <a href=\"https:\/\/www.anginf.de\/?p=646\" class=\"more-link\"><span class=\"screen-reader-text\">Create additional tool (arp-scan) for LibreELEC<\/span> weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-646","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=646"}],"version-history":[{"count":6,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":653,"href":"https:\/\/www.anginf.de\/index.php?rest_route=\/wp\/v2\/posts\/646\/revisions\/653"}],"wp:attachment":[{"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.anginf.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}