{"id":561,"date":"2015-04-21T03:20:53","date_gmt":"2015-04-21T01:20:53","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=561"},"modified":"2015-04-22T15:35:19","modified_gmt":"2015-04-22T13:35:19","slug":"adding-custom-packages-to-an-openwrt-image","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=561","title":{"rendered":"Adding custom packages to an OpenWRT image"},"content":{"rendered":"<p>As I use the stable Barrier Braker 14.07 release of OpenWRT, I sometimes run into the problem that the packages included in these releases are either outdated versions or that a package was not yet available in the 14.07 release but is now included in the trunk of\u00a0<a href=\"https:\/\/github.com\/openwrt\/packages\" target=\"_blank\">github package repository<\/a>. In both cases, we either need to replace the outdated version of the package sources with a newer one or add a completely new package to the respective feed of our Barrier Breaker sources.<\/p>\n<p>The following tutorial shows how this can be accomplished. We will take ddns-scripts as an example of an outdated package to be replaced by a newer version in our image and davfs2 as an example of a package which has to be added as a completely new package to our image sources (davfs2 was not available in the 14.07 feed of OpenWRT but it can be retrieved from the github master trunk).<!--more--><\/p>\n<h1>Updating the sources<\/h1>\n<p>When retrieving or refreshing the local source code from which the router image is built, a regular step is to issue a <code>.\/scripts\/feeds\/update -a<\/code> followed by a <code>.\/scripts\/feeds\/install -a<\/code> command in order to update the package sources. The <code>install<\/code> command basically puts a couple of symlinks from the <code>package<\/code> directory into the <code>feeds<\/code> subdirectories.<\/p>\n<p>So after issuing <code>.\/scripts\/feeds\/update -a<\/code> we are first going to modify the package sources before creating the symlinks by issuing the <code>install -a<\/code> command:<\/p>\n<p>Download the whole github package repo and extract it to your harddisk.<\/p>\n<ul>\n<li>Delete the outdated packages in the sources from the <code>openwrt\/feeds\/<\/code> subdirectories (e.g. in your oWRT sources delete the folder\u00a0<code>openwrt\/feeds\/packages\/net\/ddns-scripts<\/code> and replace it by the ddns-scripts folder from from the unzipped trunk snapshot)<\/li>\n<li>Copy any\u00a0new packages to your local oWRT package sources (e.g. copy\u00a0the folder davfs2 from the zip you downloaded from github at the matching subdirectory of <code>openwrt\/feeds<\/code> local package sources).<\/li>\n<\/ul>\n<h1>Update package index<\/h1>\n<p>Before installing the sources, it is advisable to update the package index &#8211; otherwise menuconfig may not show those packages which have been added completely new. The index can be (re-) generated by issuing <code>.\/scripts\/feeds update -i<\/code><\/p>\n<h1>Installing the modified sources<\/h1>\n<p>Only now are you ready to install the modified sources by issuing the\u00a0<code>.\/scripts\/feeds\/install -a<\/code> command. After that, you can launch <code>make menuconfig<\/code> to check if the newly added or modified versions are selected in your menuconfig.<\/p>\n<p>In order to check if the version was updated correctly,\u00a0you invoke the help function and see whether the explanatory text matches the one in the Makefile of the updated sources. For <code>ddns-scripts<\/code>\u00a0the hepl text of the old version 2.1.0-3 reads as follows:<\/p>\n<figure id=\"attachment_563\" aria-describedby=\"caption-attachment-563\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-563 size-full\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-menuconf-old.png\" alt=\"ddns-scripts menuconfig before update\" width=\"600\" height=\"384\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-menuconf-old.png 600w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-menuconf-old-300x192.png 300w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-menuconf-old-469x300.png 469w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-563\" class=\"wp-caption-text\">ddns-scripts menuconfig before update<\/figcaption><\/figure>\n<p>After replacing the whole openwrt\/feeds\/packages\/net\/ddns-scripts folder by the latest 2.4.1 version, the help text for ddns-scripts in menuconfig looks as follows:<\/p>\n<figure id=\"attachment_564\" aria-describedby=\"caption-attachment-564\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-564\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-scripts-menuconf-new.png\" alt=\"ddns-scripts help text in menuconfig after installing latest version\" width=\"600\" height=\"384\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-scripts-menuconf-new.png 600w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-scripts-menuconf-new-300x192.png 300w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2015\/04\/ddns-scripts-menuconf-new-469x300.png 469w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><figcaption id=\"caption-attachment-564\" class=\"wp-caption-text\">ddns-scripts help text in menuconfig after installing latest version<\/figcaption><\/figure>\n<p>Unfortunately, menuconfig\u00a0will no longer show the original descriptions taken from the Makefile. <strong>I have so far been unable to find a way to get the package information from the updated Makefile into the menuconfig help text.<\/strong> This won&#8217;t be a problem however, as the oWRT image will compile with the updated version.<\/p>\n<h1>In case somthing does not work<\/h1>\n<p>Sometimes, the updated package sources are not 100% compliant with your build environment and the image build will fail. Afaik, there is no general recipe to debug such fails. A good idea is to rerun the make with maximum verbosity and redirect the output to a logfile which can later be analyzed for clues what went wrong.<\/p>\n<pre class=\"toolbar-overlay:false toolbar-hide:false toolbar-delay:false marking:false ranges:false nums:false wrap-toggle:false lang:default decode:true\">ilek@i7:~\/codelab\/openwrt$ make -j 5 V=s &amp;&gt; mybuildlog.txt<\/pre>\n<p>As an example. the oWRT image will not compile with the davfs2 sources from github. After poking around in the buildlog file, I found out that the line\u00a0<code>PKG_FIXUP:=gettext-version autoreconf<\/code> in the <code>Makefile<\/code> has to be commented out by just inserting a <code>#<\/code> at the beginning of the line.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I use the stable Barrier Braker 14.07 release of OpenWRT, I sometimes run into the problem that the packages included in these releases are either outdated versions or that<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=561\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Adding custom packages to an OpenWRT image<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64,16],"tags":[81,82,84,17,83],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-linux","category-openwrt","tag-custom-package","tag-davfs2","tag-ddns-scripts","tag-openwrt","tag-webdav"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=561"}],"version-history":[{"count":7,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":566,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/561\/revisions\/566"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}