OBSOLETE AND ARCHIVED
This is not anymore the recommended compilation method for creating LibreMesh firmware images.
Please refer to the website https://libremesh.org for the currently supported methods. On the website, you will also find the list of communication channels where you can ask for help to the rest of the community :)
lime-sdk cooker
LibreMesh software development kit uses the OpenWRT SDK and ImageBuilder to generate (cook) LibreMesh packages and firmware. If you want to create your own LibreMesh flavor because you need some specific configuration or you just want to have control over your binaries, the cooker is your friend!
Basic usage example for cooking a libremesh using bmx7 routing protocol firmware for device Alix Board 2d2 using remote repositories (no compilation required). Recommended for most people:
./cooker -c x86/geode --profile=Generic --flavor=lime_bmx7 --community=libremesh/only-bmx7 --remote
Basic usage example for cooking a firmware for TpLink 4300 compiling localy the libremesh packages:
./cooker -c ar71xx/generic --flavor=lime_bmx7 --profile=tl-wdr4300-v1 --community=libremesh/only-bmx7
Using cooker online with Chef
cooker can be used also via Chef web interface. Its source code can be found here.
Preparing the local environment
Building in running system
Before using lime-sdk, make sure your Linux system has the required dependencies installed.
Install build dependencies, for example on a Debian/Ubuntu based Linux distribution install the following packages:
sudo apt-get install subversion zlib1g-dev gawk flex unzip bzip2 gettext build-essential libncurses5-dev libncursesw5-dev libssl-dev binutils cpp psmisc docbook-to-man wget git
For other systems, you might follow these instructions (look for Examples of Package Installations) https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
Building in docker container
Install Docker and run the following command:
cd lime-sdk
sudo docker build -t cooker .
sudo docker run -v "$(pwd)":/app cooker --<parameters>
Targets, profiles and flavors
LibreMesh can be used on many different devices (target and profile) and can be packed in many different ways (flavors), depending on your needs. To this end, it is important to choose the right options for building your firmware.
To generate a firmware, the -c option must be used (cook). But it requires to specify at least the target and subtarget of your router and optionally (recommended) the profile and flavor.
./cooker -c <target/subtarget> --profile=<profile name> --flavor=<flavor name>
For instance, this will work for a TpLink WDR4300:
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default
Target
Target references to the router architecture, usually depends on the manufactor and the set of chips used for building the hardware. Therefore, you must know the target and subtarget before using cooker. As we use OpenWRT, this information can be found here https://wiki.openwrt.org/toh/start. The most common targets are currently ar71xx/generic (Atheros) and ramips/mt7620 (Ramips). Once we know the target, we must find the specific profile.
To see the list of available targets execute:
./cooker --targets
Profile
The profile is the specific brand/model of the router. Each target has a list of hardware profiles than can be choosed. Cooker build all profiles from a target by default, but it is better if your find and choose the specific profile.
To see the list of available profiles for a specific target execute:
./cooker --profiles=<target/subtarget>
For instance:
./cooker --profiles=ar71xx/generic
Flavor
LibreMesh is a modular system, so it can be cooked on many different ways. There are some predefined that we call flavor, however anyone can create its own set of packets and options (for instance the default flavors include bmx6 and batman-adv as routing protocols, but you might create other kinds of setup).
One of the most important things regarding the flavor is the internal flash size of your router. This must be taken into account when choosing a flavor.
Currently there are three main flavors:
- lime_default: the recommended for routers with more than 4MB of flash. It includes all required and optional software.
- lime_mini: the recommended for routers of 4MB, made for end-users, includes a minimal web interface, but new software cannot be installed (opkg is not available).
- lime_zero: for advanced users, it does not include web interface, just the basic software to mesh the network but it does include opkg, so new software can be installed.
Building and cooking
These are two different steps. Building means to compile and prepare all the required packages for LibreMesh. To cook means taking the packages (depending on the flavor) and generating the firmware ready to install on your device.
The standard steps to generate a firmware would be: firstly build and secondly cook, like this:
./cooker -b ar71xx/generic
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default
However, cooker is smart enough to detect the missing steps and transparently execute them. If we choose to cook before building, it will automatically build before cooking. Therefore, for debugging purposes it is better to execute the steps separately.
On the other hand, if you do not want to build locally (since it requires some special software installed on your Linux machine), you can just cook using the online precompiled binaries.
Building locally or fetch remote?
Cooker can locally build the LibreMesh packages or fetch the remote precompiled ones. For most users there is no real need for building, since using the remote ones might be a better (and fast) option. To remotelly fetch the packages the special option --remote must be used when cooking, like this:
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default --remote
Using custom SDK and/or IB files
Custom local SDK and IB files can be used (instead of fetching official OpenWRT sources). Must be specified before building or cooking ("-b" or "-c").
./cooker -f
./cooker -i ar71xx/generic --ib-file=myOwnImageBuilder.tar.xz --sdk-file=myOwnSDK.tar.xz
./cooker -b ar71xx/generic --force-local
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default --force-local
Do not forget to use force-local option to use your own SDK target packages (kernel signature will be different from remote sources).
Communities
It is not required to create and/or use a community profile. But if you are constantly cooking LibreMesh for your network and you need a specific configuration, you might want to spend some time creating a community profile. This will make things easier and better coordinated for your community.
A community is mainly a set of files you want to include in the output firmware. For instance, if you want to pre-configure the WiFi SSID, mode or channels, you might want to include a specific /etc/config/lime-defaults file as shown in this article http://libremesh.org/docs/en_config.html.
Also /etc/shadow for setting an initial root password or /etc/uci-defaults/ one-time executed scripts might be useful for your setup.
The default way to create or use a community is to use this Git repository https://github.com/libremesh/network-profiles (ask for writing access in the users mailing list). The directory structure of the Git repository is:
/<community name>/<device profile name>/<files and directories>
Both community and device profile names can be any of your choice (must exist!) , since they are only used for identifying it. When executing a cook order, you can specify the community profile like this:
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default --community=CommunityName/ProfileName
A community profile might include a special file named PACKAGES on the root of the profile directory (CommunityName/ProfileName/PACKAGES) to specify a list of extra packages which must be added to the firmware image.
Using development branch
If you want to get the last OpenWRT source because it includes some new feature or it supports some new hardware, you can use the lime-sdk branch named develop. However as OpenWRT source is changing daily, we cannot assure the correct working of the firmware.
It is recommended to start with a new Git clone instead of reuse an existing one. Once the lime-sdk source is cloned, change the branch: git checkout develop
Add your own feed repository
If you want to compile and/or cook your own feed package repository, you can follow one of the following methods.
For a permanent build environment
If it is a permanent change on your cooker setup, better add your repository (or modify the existing ones) to the feeds file
cp feeds.conf.default feeds.conf.default.local
vim feeds.conf.default.local
Edit and save the new created file feeds.conf.default.local and force the reinstall of the feeds
Crete and add to the SDK config file the new packages you want to include (if any)
cp libremesh.sdk.config libremesh.sdk.config.local
echo "CONFIG_PACKAGE_myNewPackage=m" >> libremesh.sdk.config.local
Add your new flavor (or modify the existing ones)
cp flavors.conf flavors.conf.local
vim flavors.conf.local
Finally build and cook as usual but adding also your new packages
./cooker -b ar71xx/generic
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_new_flavor
For a casual cooking on a existing feed repository
Download the standard feeds (if not previously downloaded)
Modify the source code of the existing feed
cd feeds/libremesh
git checkout feature/somethingToTest
Build the code and cook as usual
./cooker -b ar71xx/generic
./cooker -c ar71xx/generic --profile=tl-wdr4300-v1 --flavor=lime_default --extra-pkg="someExtraPackage?"
Forking lime-sdk for your community
If you like to manage your own set of flavors, options and/or repositories, you might fork the lime-sdk code to your own Git repository. To preserve the compatibility with the official source (so merges can be easily done), none of the original files must be modified.
To this end, cooker will look first for the files named .local and will use them instead. Therefore make a copy of options and flavors.
cp options.conf options.conf.local
cp flavors.conf flavors.conf.local
Modify them as your own wish and add them to the Git repository.
git add *.local
git commit -m 'Add local options and flavors'
git push
Time to time, if you want to update the code with the official one you might add a new remote and perform a merge.
git remote add official https://github.com/libremesh/lime-sdk.git
git fetch official
git merge official/master
git push origin/master
Advanced help