Compile Manually

Version 12 (Ilario Gelmetti, 08/15/2015 08:44 pm) → Version 13/15 (Ilario Gelmetti, 10/26/2015 01:57 pm)

h1. Compile Manually

Libre-Mesh firmware can be built via OpenWRT build root or via lime-build tool, here both methods are described.

h2. Starting from a new compilation of OpenWrt

*Resources needed:*

Probably a Linux based operating system.

Some tools for the compilation process, on Debian:

<pre>
apt-get install git build-essential libncurses5-dev zlib1g-dev gawk subversion
</pre>

About 9 GB of disk space.

About 3 hours of compilation time.

*Download OpenWrt 14.07*. Using trunk version of OpenWRT is *not* supported currently.

<pre>
git clone git://git.openwrt.org/14.07/openwrt.git
</pre>

*Add our repositories* to the list of the default ones.

<pre>
cd openwrt
cp feeds.conf.default feeds.conf
echo "src-git libremap git://github.com/libremap/libremap-agent-openwrt.git" >> feeds.conf
echo "src-git lime https://github.com/libre-mesh/lime-packages.git" >> feeds.conf
</pre>

If you want to use a specific branch of lime-packages specify it adding ;nameofthebranch at the end of the last line. For example:

<pre>
src-git lime https://github.com/libre-mesh/lime-packages.git;ip_legacy_module https://github.com/libre-mesh/lime-packages.git;develop
</pre>

Download all these packages and put sources in the right place.

<pre>
scripts/feeds update -a
scripts/feeds install -a
</pre>

Then enter the OpenWrt *configuration* menu.

<pre>
make menuconfig
</pre>

Go in "Base system" and *deselect "dnsmasq"* (this is the IPv4 version which if selected won't support IPv6) then select "dnsmasq-dhcpv6". In conflicts with Libre-Mesh, the same section *deselect "firewall"* (because some devs say that this can cause problems which are hard to debug). IPv6 version will be automatically selected).

Exit from "Base system" and enter "Network". Then deselect "odhcpd" (don't be confused with "odhcp6c" which is needed, seems that "odhcpd" if installed together with dnsmasq-dhcpv6 will release duplicated leases...).

Exit from "Network" and
end *enter in "LiMe" section, "LiMe", select what you want*, want* (for example everything or everything except reghack and lime-full), exit.

If you need to compile images only for one type of devices you could specify the type in the menu "Target system" and "Target profile", otherwise keep the default and images for each profile will be produced. Exit and save.

Launch the *compilation*.

<pre>
make
</pre>

The produced firmware image files are in bin/ directory.

Flash on your devices, optionally [[Configuration|change the default configuration]], and enjoy!

h3. Updating a previous compilation of Libre-Mesh

Enter the base directory of the previous compiled image, for example

<pre>
cd ~/openwrt
</pre>

Update the OpenWrt source code.

<pre>
git pull
</pre>

Update the Libre-Mesh package source code.

<pre>
scripts/feeds update -a
scripts/feeds install -a
</pre>

Launch the compilation. The make -j [number] makes the compiler use multiple cores. If you have more than 2 cores, change to the appropriate number.

<pre>
make -j 3
</pre>

If you encounter some errors try compiling without the -j option or cleaning completely the installation environment

<pre>
make clean
make dirclean
rm -rf feeds/*
</pre>

and restart from the top of this section about updating.

h2. Using lime-build

*Resources needed:*

Probably a Linux based operating system.

Some tools for the compilation process, on Debian:

<pre>
apt-get install git build-essential libncurses5-dev zlib1g-dev gawk subversion
</pre>

About 9 GB of disk space.

About 3 hours of compilation time.

*Download* the *lime-build* source:

<pre>
git clone https://github.com/libre-mesh/lime-build.git
</pre>

Have a look at the list of devices supported by lime-build:

<pre>
make list_targets
</pre>

if you see your device you can continue with this guide, otherwise you have to use the instructions in the section "Starting from a new compilation of OpenWrt".

*Compile* specifying the *target device* in T= and roughly the number of CPU cores plus one in J=. That is, for compiling on a dual core computer the image for Ubiquiti NanoStation M5:

<pre>
make J=3 T=nsm5 build
</pre>

You'll find the compiled images in the directory images.

Other options for lime-build are documented here: https://github.com/libre-mesh/lime-build/blob/master/README.md