LibreRouterOs

LibreRouterOs is a firmware based on LibreMesh and OpenWrt that provides official LibreRouter support.

Download

Binaries for the LibreRouter can be downloaded from https://gitlab.com/librerouter/librerouteros/-/releases

Build from source instructions

Why I would want to build the firmware from source?

  • If you have other hardware than the LibreRouter you can use this repository to build a LibreMesh firmware for it
  • If you want to test non release versions or contribute to the LibreRouterOs development somehow

Dependencies

You must have installed: gcc, binutils, bzip2, flex, python, perl, make, find, grep, diff, unzip, gawk, getopt, subversion, time, libz-dev (or zlib) and libc headers. You can use the OpenWrt build-system documentation where there is a list of copy pastable install instructions for multiple linux distributions.

The build instructions

  1. Clone the repository: run git clone https://gitlab.com/librerouter/librerouteros.git. Then go into the repository directory with cd librerouteros.
  2. Run ./scripts/feeds update -a to obtain all the latest package definitions defined in feeds.conf.default
  3. Run ./scripts/feeds install -a to install symlinks for all obtained packages into package/feeds/
  4. Run cp configs/default_config .config
  5. Only If your device is not a LibreRouter, run: patch -p1 < configs/revert-cmdline-config.patch
  6. Run make to build your firmware. De default options are already selected but you may want to change some of them, select new packages, etc. You can do that running make menuconfig. Then choose Exit and then Yes when asked if you want to save.

If all the steps went ok then the firmares will be available inside the bin directory.

It is very important that before building for a new device to run all the steps from step 4 (Run cp configs/default_config .config). This way the packages selection does not get mixed from other devices.

Development of LibreMesh packages

To do work in libremesh packages you should make a clone of the repo and then you can use this clone as part of the build using a local symbolic link. This way you can change the files and run make. When you are satisfied by your changes you should commit your changes to the lime-packages repo in a new branch and push this to github and do a pull request.

Fork the lime-packages repo in github and then clone it replacing yourgithubuser

git clone git@github.com:yourgithubuser/lime-packages.git

Then edit feeds.conf.default and change the line

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

with this line replacing the path to repo and branch name (replace all the line, check that src-git changed to src-link):

src-link libremesh /home/user/path/to/lime-packages

Run ./scripts/feeds update -a and then ./scripts/feeds install -a

Now perform your changes to the lime-packages repo, editing files, etc. If you are creating new packages you should run feeds install -a after you create the package in order to be able to select the package with make menuconfig.

When you want to create an image with your changes run make. If you need change the package selection run make menuconfig and then make.

Testing a LibreMesh branch

Edit feeds.conf.default, for example to test the add-fft-eval branch:

diff --git a/feeds.conf.default b/feeds.conf.default
index 5a681c88c4..ee2c5f1223 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -3,6 +3,6 @@ src-git luci https://git.openwrt.org/project/luci.git^f64b1523447547032d5280fb0b
 src-git routing https://git.openwrt.org/feed/routing.git^1b9d1c419f0ecefda51922a7845ab2183d6acd76
 src-git telephony https://git.openwrt.org/feed/telephony.git^b9d7b321d15a44c5abb9e5d43a4ec78abfd9031b

-src-git libremesh https://github.com/libremesh/lime-packages.git;master
+src-git libremesh https://github.com/libremesh/lime-packages.git;add-fft-eval
 src-git libremap https://github.com/libremap/libremap-agent-openwrt.git;master
 src-git fbw https://github.com/libremesh/FirstBootWizard.git;master
$ ./scripts/feeds update -a

update the feed as new packages may have beed added to a feed

$ ./scripts/feeds install  -a

Changing package and options selection

The config documentation is here https://openwrt.org/docs/guide-developer/build-system/use-buildsystem. Some tips:

  • The config is stored in .config
  • To change the config use make manuconfig
  • To know the difference between two configs, for example from the current config (.config) and the default configuration run $ ./scripts/diffconfig.sh | diff configs/default_config -
  • To save the new config to a new file (for backup purposes, to add it to a git repo, etc) run $ ./scripts/diffconfig.sh > configs/your_config
  • To change the default configuration, for example to perform a pull request to git@github.com:LibreRouterOrg/openwrt.git run $ ./scripts/diffconfig.sh > configs/default_config

Upgrading the buildroot

$ git pull

$ ./scripts/feeds update -a

$ ./scripts/feeds install  -a

Copy the new config, be aware that this overwrites you local config!!

$ cp configs/default_config .config
$ make defconfig
$ make -j4
...

Notes