Changes between Initial Version and Version 1 of OpenWrt/building

10/22/2017 05:28:45 AM (5 years ago)



  • OpenWrt/building

    v1 v1  
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     5  <li>
     6    <a href="#BuildingOpenWrtforGateworksProducts">Building OpenWrt for Gateworks Products</a>
     7    <ol>
     8      <li>
     9        <a href="#OpenWrtBSPBranches">OpenWrt BSP Branches</a>
     10      </li>
     11      <li>
     12        <a href="#RevisionLog">Revision Log</a>
     13      </li>
     14      <li>
     15        <a href="#OpenWrtBSPPre-BuiltBinaries">OpenWrt BSP Pre-Built Binaries</a>
     16      </li>
     17      <li>
     18        <a href="#BuildingPre-requisites">Building Pre-requisites</a>
     19      </li>
     20      <li>
     21        <a href="#DownloadedSourceFiles">Downloaded Source Files</a>
     22      </li>
     23      <li>
     24        <a href="#StepbyStepInstructions">Step by Step Instructions</a>
     25        <ol>
     26          <li>
     27            <a href="#Step1:GettingSourceCode">Step 1: Getting Source Code</a>
     28          </li>
     29          <li>
     30            <a href="#Step2:Building">Step 2: Building</a>
     31            <ol>
     32              <li>
     33                <a href="#Artifacts">Artifacts</a>
     34              </li>
     35            </ol>
     36          </li>
     37          <li>
     38            <a href="#Step3:Installing">Step 3: Installing</a>
     39          </li>
     40        </ol>
     41      </li>
     42      <li>
     43        <a href="#BuildingJTAGBinaryFile">Building JTAG Binary File</a>
     44      </li>
     45      <li>
     46        <a href="#Customizing">Customizing</a>
     47      </li>
     48      <li>
     49        <a href="#UpdatingtoLatestGateworksSource">Updating to Latest Gateworks Source</a>
     50      </li>
     51      <li>
     52        <a href="#TroubleshootingBuildFailures">Troubleshooting Build Failures</a>
     53      </li>
     54    </ol>
     55  </li>
     59<h1 id="BuildingOpenWrtforGateworksProducts">Building <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> for Gateworks Products</h1>
     61Gateworks uses the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> Linux Distribution for its Board Support Package (BSP). From time to time, Gateworks may have patches against upstream <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> to support some features which have not made it upstream or perhaps are not suitable for upstream <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a>. Additionally Gateworks provides a <tt>Makefile</tt> wrapper around <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> to aid in pinning versions of Opensource tree's to versions that Gateworks has tested with.
     64For more information about the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> SDK and other features, visit <a class="wiki" href="/wiki/OpenWrt">Gateworks OpenWrt Wiki Page</a>
     67<span class="wikianchor" id="branches"></span> <span class="wikianchor" id="releases"></span>
     69<h2 id="OpenWrtBSPBranches"><a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> BSP Branches</h2>
     71The Gateworks <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> repository consist of a snapshot of upstream <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> at specific points, with a few additional patches added on top that either had not made it upstream by that time, or add a gateworks directory consisting of Gateworks tested config files and JTAG flash image creation scripts. The repository can be found on the Gateworks <a class="ext-link" href=""><span class="icon">​</span>GitHub openwrt</a> page.
     74Our branch naming policy is as follows:
     76<ul><li>Each new bump of 'master' will cause a new branch to be created: <em>bump date</em>_<em>openwrt revision</em>. This is the bleeding edge <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> software from Gateworks and thus includes Gateworks patches on top.
     77</li><li>When we decide to cut a stable release, the branch name will be: <em>last two char of year</em>.<em>numerical month</em>.<em>version</em>
     78</li><li>master - <strong>This branch is not to be used</strong>. It only serves as a reference point for the latest dated branch and has no Gateworks patches on top of it.
     80Our <a class="ext-link" href=""><span class="icon">​</span>Git</a> branches currently include:
     82<ul><li><strong>16.02</strong> - Is the latest <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> software from Gateworks
     83<ul><li>Nightly: <a class="ext-link" href=""><span class="icon">​</span></a>
     84<ul><li>Please view the <tt>.manifest</tt> file per target to inspect installed packages + their respective versions
     85</li></ul></li><li>Based on <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> <a class="missing changeset" title="No changeset 48868 in the repository">r48868</a> (2016-02-17)
     87<ul><li>Moved to git for SCM of choice
     88</li><li>Gateworks System Controller drivers
     89</li><li>Feeds bumped to 2016-02-17
     90</li><li>Updated to latest wireless drivers (backports-20151218)
     91</li><li>IEEE802.11 adhoc throughput increased for HT rates (iw 4.3)
     92</li><li>Bump to linux 4.4.0 Kernel
     96</li><li>Moved from uclibc to musl-1.1.12
     98<ul><li>Bump to linux 4.4.0 Kernel from 3.14.16
     99</li><li>~50% increased FEC driver performance
     100</li><li>l2cache enabled
     101</li><li>Hardware crypto support
     102</li><li>squashfs+ubifs overlay for recovery
     103</li><li>dsa/swconfig support for GW16083
     104</li><li>HDMI out, no VPU/GPU
     105</li><li>LVDS out, no VPU/GPU
     106</li><li>Low-Latency RS485 support
     108<ul><li>Bump to linux 4.4.0 Kernel from 3.10.49
     109</li><li>Added GW2393 Support
     110</li><li>Added GW2383 Support
     111</li></ul></li><li>Avila / Cambria:
     112<ul><li>Support dropped
     113</li></ul></li><li>Known Issues:
     114<ul><li> 'mv' command on overlay partition on Ventana is not functional. Use 'cp -dR &amp;&amp; rm -rf'
     115</li></ul></li><li>log: <a class="ext-link" href=""><span class="icon">​</span></a>
     117</p><div> <h3 class="foldable">14.08 - required for Avila/Cambria</h3><div><p>
     119<ul><li><strong>14-08</strong> - Uses <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> pinned from Aug 2014 (r42297)
     120<ul><li>Nightly: <a class="ext-link" href=""><span class="icon">​</span></a>
     121<ul><li>Please view the <tt>.manifest</tt> file per target to inspect installed packages + their respective versions
     122</li></ul></li><li>Based on <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> <a class="missing changeset" title="No changeset 42297 in the repository">r42297</a> (2014-08-25)
     124<ul><li>Refreshed Gateworks patches
     125</li><li>Refreshed Gateworks config files
     126</li><li>Updated all feeds to latest versions as of 2014-08-27
     127</li><li>Updated to latest wireless drivers
     128</li><li>80211ac support (ath10k/iwlabgn)
     129</li><li>DFS Support in ath
     130</li><li>Added HID Support to Ventana and Laguna
     131</li><li>Added Bluetooth support (both btusb and ath3k) to Ventana and Laguna
     132</li><li>Added ibt and ath3k Bluetooth firmwares to Ventana and Laguna
     134<ul><li>Add support for GW54xx/GW53xx/GW52xx/GW51xx/GW552x
     135</li><li>Add gsc-daemon support for above boards
     136</li><li>Add support for GW16081/GW16082/GW16082
     137</li><li>Kernel: 3.14.16
     138</li><li>Added sysupgrade support
     140<ul><li>Kernel: 3.10.49
     141</li></ul></li><li>Avila / Cambria:
     142<ul><li>Kernel: to 3.10.49
     147If you are looking for our old <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> BSP's such as the 13.06 or 12.08 from our old SVN repository please see <a class="wiki" href="/wiki/OpenWrt/building?version=96">on older revision of this page</a>
     149<h2 id="RevisionLog">Revision Log</h2>
     151You can see a revision history using the Github web interface:
     153<ul><li><a class="ext-link" href=""><span class="icon">​</span>16.02</a>
     154</li><li><a class="ext-link" href=""><span class="icon">​</span>14.08</a>
     155</li></ul><h2 id="OpenWrtBSPPre-BuiltBinaries"><a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> BSP Pre-Built Binaries</h2>
     157To get an already built image to flash onto the SBC, please visit the following:
     159<ul><li><a class="wiki" href="/wiki/ventana/openwrt">Ventana OpenWrt Pre-Built Images</a>
     160</li><li><a class="wiki" href="/wiki/laguna/openwrt">Laguna OpenWrt Pre-Built Images</a>
     161</li></ul><h2 id="BuildingPre-requisites">Building Pre-requisites</h2>
     163Gateworks has tested with LTS Ubuntu Releases. The suggested Ubuntu releases are 14.04 or 16.04. At the time of this writing, Gateworks does not recommend using Ubuntu 16.10.
     166On an Ubuntu (11.10, 14.04, 16.04)  system for example the following should install all necessary pre-requisites:
     168<div class="code"><pre>sudo apt-get install subversion build-essential  ;<span class="c"># std dev tools
     169</span>sudo apt-get install zlib1g-dev libncurses5-dev gawk flex git-core gettext quilt libssl-dev ;<span class="c"># other libs/tools needed by OpenWrt Buildroot
     170</span></pre></div><ul><li><strong>NOTE</strong> If you are experiencing difficulties, Here is a list of the pre-requisites from the general <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> Site. <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> buildroot prerequisites listed <a class="ext-link" href=""><span class="icon">​</span>here</a>
     172</p><div> <h3 class="foldable">Ubuntu 14.04 Notes</h3><div><p>
     173<strong>Note: Ubuntu 14.04</strong> There is a known bug with Ubuntu 14.04 when building Python 2.7. that may occur. Because the system Python is used during this build, you may encounter the following error:
     175<div class="code"><pre>ImportError: No module named _sysconfigdata_nd
     176configure: error: python2.7 interpreter not found
     177make<span class="o">[</span>3<span class="o">]</span>: *** <span class="o">[</span>~/openwrt-next/build_dir/target-arm_cortex-a9+neon_musl-1.1.11_eabi/Python-2.7.11/.configured_yy
     178yyyyyyy<span class="o">]</span> Error 1
     180In order to fix it, please execute the following:
     182<div class="code"><pre>sudo ln -s /usr/lib/python2.7/plat-*/ /usr/lib/python2.7/
     187Please ensure your development box has <strong>all of the listed packages installed before proceeding</strong> and note that your development box will need <strong>access to the internet</strong> in order to download the files for the development tree.
     190<strong>WARNING!  Building with GCC 4.7.x is not fully supported. Please use 4.8.2+ or 4.6.x and below. We have also found 6.2+ to have some issues</strong>
     193<strong> Note</strong> The following pre-requisites must be met in order to build <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> firmware for the Gateworks product families:
     195<h2 id="DownloadedSourceFiles">Downloaded Source Files</h2>
     197<a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> uses a Linux build system called <tt>buildroot</tt>. Like all Linux build systems it consists of recipes that go through the process of fetching, patching, compiling, packaging various applications. The 'fetching' process involves downloading source tarballs from the Internet (which is why an Internet connection is required). <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> will fetch all sources into the 'dl' directory in the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> tree (ie 14.08/dl from the Gateworks directory). To avoid downloading sources each time you do a clean build it is recommended that you create a static location on your development host to store downloaded packages and symlink this to the <tt>dl</tt> directory. The Gateworks Makefile which fetches <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> and patches it, will create this link for you if the <tt>/usr/src/dl</tt> directory exists on your development host, so if you create that and make it writable by your development user all downloads will go there automatically and be able to be used for subsequent builds. This not only helps reduce build time but it can also help if a package's source isn't available because of a site or mirror being down.
     199<h2 id="StepbyStepInstructions">Step by Step Instructions</h2>
     201To support <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> for the Gateworks products, we maintain a patchset that is generic to all our standard product families.
     203<h3 id="Step1:GettingSourceCode">Step 1: Getting Source Code</h3>
     205There are multiple code branches (<a class="wiki" href="/wiki/OpenWrt/building#branches">see above</a> for recommended branch per product), please checkout the one you prefer with the following commands<strong>:
     207<ul><li>16-02 branch
     208<div class="code"><pre>git clone gateworks-openwrt -b 16.02
     209<span class="nb">cd </span>gateworks-openwrt
     210</pre></div></li><li>14-08 branch
     211<div class="code"><pre>git clone gateworks-openwrt -b 14.08
     212<span class="nb">cd </span>gateworks-openwrt
     213</pre></div></li></ul><h3 id="Step2:Building">Step 2: Building</h3>
     215Our <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> Git repository has a 'gateworks' directory added consisting of a Makefile providing targets that aim to simplify the entire process of:
     217<ul><li>using a (per target) Gateworks provided .config file
     218</li><li>producing JTAG binary images compatible with the Gateworks JTAG dongle
     220Once the branch has been checked out from the <a class="ext-link" href=""><span class="icon">​</span>Gateworks GitHub</a> account, you are ready to build. The Gateworks <tt>Makefile</tt> provides the following targets:
     222<ul><li>all      : Built <tt>imx6</tt> and <tt>cns3xxx</tt> targets.
     223</li><li>imx6     : build BSP for the imx6 target (Ventana product family)
     224</li><li>cns3xxx  : build BSP for the cns3xxx target (Laguna product family)
     225</li><li>images   : build binary flash images (suitable for JTAG flashing) for supported product families (Ventana / Laguna).
     226</li><li>dirclean : remove all downloaded and built directories
     227</li></ul><ul><li>In order to build the <tt>imx6</tt> target for the Ventana product family, the following steps would occur:
     228<div class="code"><pre><span class="c"># Build the imx6 target, using the configuration from gateworks/configs/imx6/.config.
     229# This will take a while
     230</span>make -C gateworks/ imx6
     231</pre></div></li></ul><ul><li>In order to build the <tt>cns3xxx</tt> target for the Laguna product family, the following steps would occur:
     232<div class="code"><pre><span class="c"># Build the cns3xxx target, using the configuration from gateworks/configs/cns3xxx/.config.
     233# This will take a while
     234</span>make -C gateworks/ cns3xxx
     235</pre></div></li></ul><h4 id="Artifacts">Artifacts</h4>
     237The build process will take some time depending on your Internet connection and host system.  On an Intel Quad Core @ 3.10GHz the build takes a couple of hours to build all product families and takes appx 15GB of disk space.
     240The resulting kernel/rootfs files will be in the <tt>bin/&lt;target&gt;</tt> directory.
     241For Example, a 256MB flash Ventana image is located at:
     243<pre class="wiki">bin/imx6/gateworks-imx6-ventana-squashfs-nand_normal.ubi
     245For information about loading the resulting firmware onto a board see the per-board instructions:
     247<ul><li><a class="wiki" href="/wiki/ventana/openwrt">Ventana OpenWrt Specific</a>
     248</li><li><a class="wiki" href="/wiki/laguna/openwrt">Laguna OpenWrt Specific</a>
     249</li><li><a class="wiki" href="/wiki/rincon/openwrt">Rincon OpenWrt Specific</a>
     250</li><li><a class="wiki" href="/wiki/avila/openwrt">Avila OpenWrt Specific</a>
     251</li><li><a class="wiki" href="/wiki/cambria/openwrt">Cambria OpenWrt Specific</a>
     252</li></ul><h3 id="Step3:Installing">Step 3: Installing</h3>
     254To install the <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> image onto the Gateworks SBC, please follow the instructions:
     256<ul><li><a class="wiki" href="/wiki/ventana/openwrt#Step2.InstallingFirmware">Ventana Instructions</a>
     257<ul><li>Typical methods include flashing a .ubi file over TFTP or creating a JTAG binary and flashing using the USB JTAG dongle
     258</li></ul></li><li><a class="wiki" href="/wiki/laguna/openwrt#InstallingFirmware">Laguna Instructions</a>
     259<ul><li>Note - For Laguna boards, please do not flash a squashfs file to the board. A proper JTAG binary must be created with instructions below.
     260</li><li>Typical methods include creating a JTAG binary file using the below instructions and flashing to the board via the USB JTAG programmer
     264<h2 id="BuildingJTAGBinaryFile">Building JTAG Binary File</h2>
     266Creating JTAG Binaries to flash with the <a class="wiki" href="/wiki/jtag_instructions">GW16042</a> is easily done with the targets in the makefile within the gateworks directory:
     268<div class="code"><pre><span class="c"># Make a 'jtagable' images for Ventana
     269</span>make -C gateworks/ images/ventana
     271<span class="c"># Make a 'jtagable' image for Laguna
     272</span>make -C gateworks/ images/laguna
     274<span class="c"># Make both Ventana and Laguna 'jtagable' images
     275</span>make -C gateworks/ images
     277The resulting flash firmware image will be <tt>gateworks/images/</tt>.
     280To flash the file to the board, please see this link:
     281<a class="wiki" href="/wiki/jtag_instructions#Instructions">JTAG Programming Instructions</a>
     283<h2 id="Customizing">Customizing</h2>
     285Once a target has been built using the above instructions, a user may customize their image.
     288<a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> can be customized by running the <tt>make menuconfig</tt> command. In this new window, you can select/deselect packages you want installed. If kernel customization is required, a <tt>make kernel_menuconfig</tt> will open the make menu for the kernel.
     291Once complete, a simple <tt>make -j8 V=s</tt> will re-run the make command to re-create the rootfs.
     294Please read more at this page <a class="wiki" href="/wiki/OpenWrt/Configuration">here</a>.
     296<h2 id="UpdatingtoLatestGateworksSource">Updating to Latest Gateworks Source</h2>
     298The steps to update your current project to the latest Gateworks patches varies depending on the branch you're trying to update. Please see the below two sections that help to detail this out. However, please note that using Git is the most developer friendly.
     300<ul><li>To update to the latest patches on the same branch:
     301<div class="code"><pre><span class="c"># Make sure you have latest ref's
     302</span>git remote update
     304<span class="c"># This will update the current working branch to the latest upstream,
     305# then attempt to rebase any local patches on top.
     306</span>git pull --rebase
     307</pre></div></li><li>To change to a new branch, using 16.02 as an example branch:
     308<div class="code"><pre><span class="c"># Make sure you have latest ref's
     309</span>git remote update
     311<span class="c"># Checkout upstream branch 16.02 and create local branch named 16.02
     312</span>git checkout remotes/origin/16.02 -b 16.02
     314After this is complete, please continue to build as normal. For more detail on working with git, please refer to <a class="ext-link" href=""><span class="icon">​</span>this site</a>. For information on <tt>git pull</tt>, please refer to <a class="ext-link" href=""><span class="icon">​</span>this page</a>. For information about <tt>git rebase</tt>, please refer to <a class="ext-link" href=""><span class="icon">​</span>this page</a>.
     316<h2 id="TroubleshootingBuildFailures">Troubleshooting Build Failures</h2>
     318One of the most commonly occurring errors that we have run into are source URL's disappearing which causes the source files to not be there during build-time. To help alleviate this, Gateworks has put up source tarballs at <a class="ext-link" href=""><span class="icon">​</span>our development site</a>. Our build environment takes advantage of this by uploading files for feeds that we require and automatically selecting them if all other options fail. In general, it will 1: look for the tarball locally; 2: try the original source URL; and 3: try our <a class="ext-link" href=""><span class="icon">​</span>dev site</a>. Below are other issues that may crop up:
     320<ol><li><strong>Finding an Error</strong> - Often the error will be 'reported' at the end of the build. However, the error will have actually occurred earlier on. Scroll up in the logs and look for an error. Typically it is from a package or dependency that was not able to be downloaded.
     321</li><li><strong>Missing Dependencies</strong> - The build will pull files from mirrors around the web including a Gateworks mirror at <a class="ext-link" href=""><span class="icon">​</span></a>. If for some reason you can't download dependencies then you likely have a network issue. Note that files can be placed manually in the <tt>dl</tt> directory to avoid downloading.
     322</li><li><strong>Errors</strong> - By default, the build is ran on many threads with the parameter -j8.  To achieve better debugging information after a failure, re-run the build with the following -j1 flag from the trunk directory:
     323<div class="code"><pre>make -j1 <span class="nv">V</span><span class="o">=</span>s