<commit_before>---
title: Development
ref: development
lang: en
---
Development
===========

== The Source Code

The code is stored inside a git tree which contains all branches and releases.

All repositories can be browsed online through
https://github.com/libremesh/[GitHub].

Most of the development happens in the _lime-packages_ git repository which can be browsed on https://github.com/libremesh/lime-packages[GitHub] or downloaded using git:

----
git clone https://github.com/libremesh/lime-packages.git
cd lime-packages
----

== Compiling LibreMesh from source code

This procedure has been tested on GNU/Linux, on other systems it could require some modifications or it can be run in a Linux virtual machine. Generally, the first compilation takes a few hours and requires at least 10 GB of disk space.

First of all you need to install a few packages to your system.
Building OpenWrt requires a bunch of installed software.

If you are unsure about your system having all the dependencies installed, you can just go on with the OpenWrt compilation (see below) and, if it fails, check out the error messages.

On an Ubuntu system, the following command will install the minimum compilation dependencies:

--------------------------------------------------------------------------------
sudo apt update
sudo apt install --no-install-recommends git ca-certificates subversion wget make gcc g++ libncurses5-dev gawk unzip file patch python3-distutils python3-minimal python2-minimal libpython2-stdlib
--------------------------------------------------------------------------------

For other Linux distributions the packets list could be slightly different, check out the link:https://openwrt.org/docs/guide-developer/build-system/install-buildsystem[OpenWrt build system installation page].

Then you need to get the OpenWrt source code.
Make sure to _git clone_ the source code as normal user (i.e. do not use root): the compilation will refuse to run if the administrator user _root_ is being used.

.Download OpenWrt source code
LibreMesh can be built on top of various OpenWrt versions. We officially support the compilation with OpenWrt Old Stable (18.06.9) or OpenWrt Stable (19.07.5) versions.

For compiling LibreMesh on top of the Old Stable version of OpenWrt:

--------------------------------------------------------------------------------
git clone -b v18.06.9 --single-branch https://git.openwrt.org/openwrt/openwrt.git
--------------------------------------------------------------------------------

Alternatively, for compiling LibreMesh on top of the Stable version of OpenWrt:

--------------------------------------------------------------------------------
git clone -b v19.07.5 --single-branch https://git.openwrt.org/openwrt/openwrt.git
--------------------------------------------------------------------------------

.Enter OpenWrt build root
--------------------------------------------------------------------------------
cd openwrt
--------------------------------------------------------------------------------

[NOTE]
=========================
If you need to include a file in all the compiled images, for example a custom configuration file, create here a `files` directory containing the directory structure and files you want to add. For example: `mkdir -p files/etc/config/; touch files/etc/config/lime-community` and then edit the newly created `lime-community` file including your custom content. See more instruction on this on link:https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#custom_files[OpenWrt wiki].
=========================

.Take default OpenWrt repositories feeds
--------------------------------------------------------------------------------
cp feeds.conf.default feeds.conf
--------------------------------------------------------------------------------

.And add LibreMesh repositories to the OpenWrt feeds
--------------------------------------------------------------------------------
cat << EOF >> feeds.conf

src-git libremesh https://github.com/libremesh/lime-packages.git;master
src-git profiles https://github.com/libremesh/network-profiles.git
EOF
--------------------------------------------------------------------------------

If you want to build the stable version of libremesh replace `master` with `v2020.1` at the end of the
line of the libremesh feed to specify the tag `v2020.1`.


.Update the packages from the feeds
--------------------------------------------------------------------------------
scripts/feeds update -a
scripts/feeds install -a
--------------------------------------------------------------------------------


.Run the configuration menu
--------------------------------------------------------------------------------
make menuconfig
--------------------------------------------------------------------------------

Check out the +target+ (e.g. +ATH79+), +subtarget+ (e.g. +generic+) and +profile+ (e.g. +tl-wdr3600-v1+) of your router on https://openwrt.org/toh/start[OpenWrt table of hardware].

Select the _Target System_, _Subtarget_ and _Target Profile_ accordingly.


Optionally, **deselect** erroneous feeds locations:

- Image configuration → Separate feed repositories → Enable feed libremesh
- Image configuration → Separate feed repositories → Enable feed profiles

**Deselect** problematic packages:

- Base system -> dnsmasq
- Base system -> firewall
- Network -> odhcpd-ipv6only

Optionally, **deselect** unused packages:
- Network -> ppp

**Select** (press space until when an asterisk `*` appears, like `<*>`) LibreMesh packages:

* LibreMesh → Offline Documentation → lime-docs-minimal (LibreMesh minimal documentation)
* LibreMesh → LibreMesh-app (LibreMeshApp)
* LibreMesh → lime-hwd-openwrt-wan (Respect openwrt wan interface as default)
* LibreMesh → LibreMesh-proto-anygw (LibreMesh anygw proto support)
* LibreMesh → LibreMesh-proto-babeld (LibreMesh babeld proto support)
* LibreMesh → LibreMesh-proto-batadv (LibreMesh batman-adv proto support)
* LibreMesh → shared-state
** shared-state-babeld_hosts (babeld-hosts module for shared-state)
** shared-state-bat_hosts (bat-hosts module for shared-state)
** shared-state-nodes_and_links (nodes_and_links module for shared-state)

Some more packages are recommended but not mandatory for a working LibreMesh network. Consider avoiding to select the following packages _only_ if the created image is too large and does not fit in the router memory.

- LibreMesh -> check-date-http (Keep local date under NTP too far away skew)
- LibreMesh -> Offline Documentation -> lime-docs (LibreMesh full documentation)
- LibreMesh -> lime-hwd-ground-routing (Manage 802.1q VLANs for ground routing)
- LibreMesh -> lime-debug (libremesh debug utils)

Additionally and optionally, httpS for the web interface can be enabled selecting (beware that the web interace will be shown as *not trusted*):

- Libraries -> libustream-wolfssl
- Utilities -> Encryption -> px5g-standalone

Finally, also the 802.11s mesh connections can be password protected, this will require a specific configuration and this package to be selected:

- Network -> wpad-mesh-wolfssl

and this to be **de**-selected:

- Network -> wpad-basic

[IMPORTANT]
=========================
Due to a link:https://bugs.openwrt.org/index.php?do=details&task_id=3441[known bug], can happen that wpad-mesh-wolfssl gets automatically deselected. Each time you use menuconfig, please check if wpad-mesh-wolfssl is still selected.
=========================

[NOTE]
=========================
In order to have additional packages, the easiest way is to select them in menuconfig. More packages can be installed afterwards via +opkg+, but some of these require a specific kernel configuration to be in place. This can be achieved following link:development-kernel_vermagic.html[these additional instructions dealing with kernel vermagic]. Beware that this will increase noticeably the time and storage space required for the compilation.
=========================

Save and exit.

.Finally, compile the images
--------------------------------------------------------------------------------
make -j$(nproc)
--------------------------------------------------------------------------------

If everything goes well you should find the produced binaries inside the +bin/+ directory.

== Submitting Patches

We accept pull requests via GitHub. But patches can also be submitted via the lime-dev link:communication.html[mailing list].

== The Web Presence

The pages you're reading are generated from text files using the
http://www.methods.co.nz/asciidoc/[AsciiDoc] suite plus https://jekyllrb.com/[Jekyll].

Any changes made to https://github.com/libremesh/lime-web[lime-web repository] will be reflected on our `libremesh.org` website.

In order to generate these pages locally:
----
git clone https://github.com/libremesh/lime-web.git
cd lime-web && bundle install
bundle exec jekyll serve
----
For more details, check the https://github.com/libremesh/lime-web/blob/master/README[README] on Github.

If you would like to contribute to the documentation then please send patches to our mailing list or open a pull request on GitHub. An easy way to edit and file a pull request is clicking the "Edit this page" button at the top right of each page.

Please use the http://www.methods.co.nz/asciidoc/userguide.html[AsciiDoc syntax] for contributions on the web page.
<commit_msg>development page: update OpenWrt version to 19.07.6 and highlight the importance of specifying the branch<commit_after>---
title: Development
ref: development
lang: en
---
Development
===========

== The Source Code

The code is stored inside a git tree which contains all branches and releases.

All repositories can be browsed online through
https://github.com/libremesh/[GitHub].

Most of the development happens in the _lime-packages_ git repository which can be browsed on https://github.com/libremesh/lime-packages[GitHub] or downloaded using git:

----
git clone https://github.com/libremesh/lime-packages.git
cd lime-packages
----

== Compiling LibreMesh from source code

This procedure has been tested on GNU/Linux, on other systems it could require some modifications or it can be run in a Linux virtual machine. Generally, the first compilation takes a few hours and requires at least 10 GB of disk space.

First of all you need to install a few packages to your system.
Building OpenWrt requires a bunch of installed software.

If you are unsure about your system having all the dependencies installed, you can just go on with the OpenWrt compilation (see below) and, if it fails, check out the error messages.

On an Ubuntu system, the following command will install the minimum compilation dependencies:

--------------------------------------------------------------------------------
sudo apt update
sudo apt install --no-install-recommends git ca-certificates subversion wget make gcc g++ libncurses5-dev gawk unzip file patch python3-distutils python3-minimal python2-minimal libpython2-stdlib
--------------------------------------------------------------------------------

For other Linux distributions the packets list could be slightly different, check out the link:https://openwrt.org/docs/guide-developer/build-system/install-buildsystem[OpenWrt build system installation page].

Then you need to get the OpenWrt source code.
Make sure to _git clone_ the source code as normal user (i.e. do not use root): the compilation will refuse to run if the administrator user _root_ is being used.

.Download OpenWrt source code
LibreMesh can be built on top of various OpenWrt versions. We officially support the compilation with OpenWrt Old Stable (18.06.9) or OpenWrt Stable (19.07.6) versions.

For compiling LibreMesh on top of the Old Stable version of OpenWrt:

--------------------------------------------------------------------------------
git clone -b v18.06.9 --single-branch https://git.openwrt.org/openwrt/openwrt.git
--------------------------------------------------------------------------------

Alternatively, for compiling LibreMesh on top of the Stable version of OpenWrt:

--------------------------------------------------------------------------------
git clone -b v19.07.6 --single-branch https://git.openwrt.org/openwrt/openwrt.git
--------------------------------------------------------------------------------

.Enter OpenWrt build root
--------------------------------------------------------------------------------
cd openwrt
--------------------------------------------------------------------------------

[NOTE]
=========================
If you need to include a file in all the compiled images, for example a custom configuration file, create here a `files` directory containing the directory structure and files you want to add. For example: `mkdir -p files/etc/config/; touch files/etc/config/lime-community` and then edit the newly created `lime-community` file including your custom content. See more instruction on this on link:https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#custom_files[OpenWrt wiki].
=========================

.Take default OpenWrt repositories feeds
--------------------------------------------------------------------------------
cp feeds.conf.default feeds.conf
--------------------------------------------------------------------------------

.And add LibreMesh repositories to the OpenWrt feeds
--------------------------------------------------------------------------------
cat << EOF >> feeds.conf

src-git libremesh https://github.com/libremesh/lime-packages.git;master
src-git profiles https://github.com/libremesh/network-profiles.git
EOF
--------------------------------------------------------------------------------

**If you want to build the stable version of LibreMesh:** replace `master` with `v2020.1` at the end of the
line of the libremesh feed to specify the tag `v2020.1`.


.Update the packages from the feeds
--------------------------------------------------------------------------------
scripts/feeds update -a
scripts/feeds install -a
--------------------------------------------------------------------------------


.Run the configuration menu
--------------------------------------------------------------------------------
make menuconfig
--------------------------------------------------------------------------------

Check out the +target+ (e.g. +ATH79+), +subtarget+ (e.g. +generic+) and +profile+ (e.g. +tl-wdr3600-v1+) of your router on https://openwrt.org/toh/start[OpenWrt table of hardware].

Select the _Target System_, _Subtarget_ and _Target Profile_ accordingly.


Optionally, **deselect** erroneous feeds locations:

- Image configuration → Separate feed repositories → Enable feed libremesh
- Image configuration → Separate feed repositories → Enable feed profiles

**Deselect** problematic packages:

- Base system -> dnsmasq
- Base system -> firewall
- Network -> odhcpd-ipv6only

Optionally, **deselect** unused packages:
- Network -> ppp

**Select** (press space until when an asterisk `*` appears, like `<*>`) LibreMesh packages:

* LibreMesh → Offline Documentation → lime-docs-minimal (LibreMesh minimal documentation)
* LibreMesh → LibreMesh-app (LibreMeshApp)
* LibreMesh → lime-hwd-openwrt-wan (Respect openwrt wan interface as default)
* LibreMesh → LibreMesh-proto-anygw (LibreMesh anygw proto support)
* LibreMesh → LibreMesh-proto-babeld (LibreMesh babeld proto support)
* LibreMesh → LibreMesh-proto-batadv (LibreMesh batman-adv proto support)
* LibreMesh → shared-state
** shared-state-babeld_hosts (babeld-hosts module for shared-state)
** shared-state-bat_hosts (bat-hosts module for shared-state)
** shared-state-nodes_and_links (nodes_and_links module for shared-state)

Some more packages are recommended but not mandatory for a working LibreMesh network. Consider avoiding to select the following packages _only_ if the created image is too large and does not fit in the router memory.

- LibreMesh -> check-date-http (Keep local date under NTP too far away skew)
- LibreMesh -> Offline Documentation -> lime-docs (LibreMesh full documentation)
- LibreMesh -> lime-hwd-ground-routing (Manage 802.1q VLANs for ground routing)
- LibreMesh -> lime-debug (libremesh debug utils)

Additionally and optionally, httpS for the web interface can be enabled selecting (beware that the web interace will be shown as *not trusted*):

- Libraries -> libustream-wolfssl
- Utilities -> Encryption -> px5g-standalone

Finally, also the 802.11s mesh connections can be password protected, this will require a specific configuration and this package to be selected:

- Network -> wpad-mesh-wolfssl

and this to be **de**-selected:

- Network -> wpad-basic

[IMPORTANT]
=========================
Due to a link:https://bugs.openwrt.org/index.php?do=details&task_id=3441[known bug], can happen that wpad-mesh-wolfssl gets automatically deselected. Each time you use menuconfig, please check if wpad-mesh-wolfssl is still selected.
=========================

[NOTE]
=========================
In order to have additional packages, the easiest way is to select them in menuconfig. More packages can be installed afterwards via +opkg+, but some of these require a specific kernel configuration to be in place. This can be achieved following link:development-kernel_vermagic.html[these additional instructions dealing with kernel vermagic]. Beware that this will increase noticeably the time and storage space required for the compilation.
=========================

Save and exit.

.Finally, compile the images
--------------------------------------------------------------------------------
make -j$(nproc)
--------------------------------------------------------------------------------

If everything goes well you should find the produced binaries inside the +bin/+ directory.

== Submitting Patches

We accept pull requests via GitHub. But patches can also be submitted via the lime-dev link:communication.html[mailing list].

== The Web Presence

The pages you're reading are generated from text files using the
http://www.methods.co.nz/asciidoc/[AsciiDoc] suite plus https://jekyllrb.com/[Jekyll].

Any changes made to https://github.com/libremesh/lime-web[lime-web repository] will be reflected on our `libremesh.org` website.

In order to generate these pages locally:
----
git clone https://github.com/libremesh/lime-web.git
cd lime-web && bundle install
bundle exec jekyll serve
----
For more details, check the https://github.com/libremesh/lime-web/blob/master/README[README] on Github.

If you would like to contribute to the documentation then please send patches to our mailing list or open a pull request on GitHub. An easy way to edit and file a pull request is clicking the "Edit this page" button at the top right of each page.

Please use the http://www.methods.co.nz/asciidoc/userguide.html[AsciiDoc syntax] for contributions on the web page.

{'fraction_non_alphanumeric': 0.23247212976171608, 'fraction_numerical': 0.006498652718338881, 'mean_word_length': 2.2821224206693254, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 37, 'https://': 30, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '296936', 'n_tokens_mistral': 4745, 'n_tokens_neox': 4455, 'n_words': 1962}