> For the complete documentation index, see [llms.txt](https://docs.morsemicro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.morsemicro.com/application-notes/appnote-18-bringing-up-prplmesh-on-linux.md).

# APPNOTE-18 Bringing Up prplMesh on Linux

Download as PDF

## 1 Overview

This application note details the procedures for integrating prplMesh on Linux. The original prplMesh open-source implementation lacks built-in support for the HaLow (802.11ah) standard.  Consequently, Morse Micro has customized the open-source prplMesh to extend its support for HaLow wireless interfaces. Given that prplMesh operates as an application within the wireless platform, achieving 11ah compatibility on the platform necessitates the utilization of Morse Micro version of hostapd and wpa\_supplicant.

## 2 Prerequisites

### 2.1 Hardware requirements

This guide assumes that you already have a suitable platform with the MM6108 HaLow chip integrated via SDIO or SPI and running successfully in Linux.   If you do not have this please reach out to support to discuss the options, or consider using an evaluation kit as a starting point.   All OpenWrt-based EVKs from Morse Micro support prplMesh (known by its standard name ‘EasyMesh’) out of the box.

### 2.2 Software Requirements

The following section outlines the software components that are required for integrating prplMesh with HaLow support into Linux.

#### 2.2.1 hostapd\_s1g and wpa\_supplicant\_s1g

Ensure that both these packages are compiled and installed on the intended Linux device.   These are customized versions that support HaLow interfaces, and should already be present as part of the basic HaLow integration on the platform.

#### 2.2.2 UCI, ubus, and libubox:

Not all Linux systems include UCI, ubus and libubox by default, as these are generally specific to OpenWrt-based systems.  However they are integral components of the Morse Micro adaptation of prplMesh, and will need to be included.  prplMesh relies on UCI as its configuration interface and requires ubus for DHCP events. &#x20;

While the absence of ubus events may not cause significant functional issues, it is essential for successfully building the SDK.

***

#### 2.2.3 Host Machine Compilation and Installation Requirements:

The following host packages should be installed before compiling UCI and ubus:

sudo apt install lua5.1

sudo apt install liblua5.1-0-dev

sudo apt install libjson-c-dev

Once the host dependencies above are installed, follow the steps below to retrieve and compile the source code for each of the packages for the host machine and install on the host:

* libubox:

$ git clone git://git.openwrt.org/project/libubox.git

$ cd libubox

$ cmake .

$ sudo make install

* ubus:

$ git clone git://git.openwrt.org/project/ubus.git

$ cd ubus

$ cmake .

$ sudo make install

* UCI:

$ git clone git://git.openwrt.org/project/uci.git

$ cd uci

$ cmake .

$ sudo make install

***

#### 2.2.4 Target Machine Compilation and Installation Requirements:

For the target machine, the following packages downloaded on the host must be again re-compiled for the target and installed on the target with the specified commands:

* libubox:

$ cmake -DCMAKE\_C\_COMPILER= .

$ make

$ install ‘libubox.so’in ‘/usr/local/lib/libubox.so’ on the target

* ubus:

$ cmake -DCMAKE\_C\_COMPILER= .

$ make

$ install ‘libubus.so’in ‘/usr/local/lib/libubus.so’ on the target

* UCI:

$ cmake -DCMAKE\_C\_COMPILER= .

$ make

$ install ‘libuci.so’in ‘/usr/local/lib/libuci.so’ on the target

Note: Ensure to pass the appropriate cross compiler option for the target using the CMAKE\_C\_COMPILER flag. for e.g: cmake -D[C](https://www.google.com/url?q=https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html%23variable:CMAKE_%253CLANG%253E_COMPILER\&sa=D\&source=editors\&ust=1783410947084383\&usg=AOvVaw1aaKzzBmi5QNAoaar3vd1c)MAKE\_C\_COMPILER=arm-elf-gcc .

***

#### 2.2.5 Other Packages

Refer to the prplMesh README.md file for additional package requirements.  At time of writing this includes:

* binutils
* cmake
* gcc
* git
* libjson-c-dev
* libncurses-dev
* libnl-3-dev
* libnl-genl-3-dev
* libnl-route-3-dev
* libssl-dev
* ninja-build
* pkg-config
* python
* python-yaml
* python3
* python3-yaml
* bison
* curl
* flex
* libevent-dev
* libyajl-dev
* lua5.1
* liblua5.1-0-dev
* build-essential
* clang-format
* gcovr
* bridge-utils
* ebtables
* iproute2
* net-tools
* psmisc
* uuid-runtime

## 3 Building the code

### 3.1 Download and extract the prplMesh source

&#x20;Obtain the prplMesh source tar file from the Morse Micro DocSend release folder and extract it, using the following command:

tar xvzf prplmesh-rel\_1\_10\_2\_2023\_Nov\_22.tgz

### 3.2 Update CMakeLists.txt

Add the following extra CFLAGS \[highlighted in blue] to the CMakeLists.txt file present in the top directory:

&#x20;\# Default Compiler flags

set(CMAKE\_C\_FLAGS "${CMAKE\_C\_FLAGS} -Wall -Wextra -Werror -pthread -Wno-comment -Wno-unused-parameter -Wno-missing-field-initializers -Wno-error=deprecated-declarations -Wno-error=maybe-uninitialized")

&#x20;set(CMAKE\_C\_FLAGS\_RELEASE "${CMAKE\_C\_FLAGS\_RELEASE} -s -O2 -Wformat -Wformat-security -Wl,-S -fPIC -fPIE")

&#x20;\# Compiler specific flags

***

### 3.3 Build the code

From the top level directory invoke cmake as follows,

cmake -DCMAKE\_C\_COMPILER= -DCMAKE\_BUILD\_TYPE=Debug -DCMAKE\_INSTALL\_PREFIX=build/install -DTARGET\_PLATFORM="MorseMicro" -DBEEROCKS\_BRIDGE\_IFACE="br-prpl" -DBWL\_TYPE="NL80211" -DBUILD\_SHARED\_LIBS=OFF -H. -B./build

Note: Use appropriate bridge name for -DBEEROCKS\_BRIDGE\_IFACE.

Once cmake is successful, run make to finish the compilation

make -C ./build install

### 3.4 Copy the files into the target

Transfer the contents of '\<top\_dir>/build/install/\*' to the target device, maintaining the identical directory structure.

## 4 Running prplMesh

### 4.1 Start prplMesh Controller and Agent

* Navigate to the scripts directory:

  cd /scripts
* Start prplMesh Controller (default mode is Mesh Controller):

  sudo ./prplmesh\_utils.sh start  \
  (or)\
  sudo ./prplmesh\_utils.sh --mode CA start

### 4.2 Run only as Mesh Agent

* From the /scripts directory run the following command:

  sudo ./prplmesh\_utils.sh --mode A start

## 5 Revision History

| Release Number | Release Date | Release Notes                                    |
| -------------- | ------------ | ------------------------------------------------ |
| 01             | 02/02/2024   | <ul><li>Initial release</li></ul>                |
| 02             | 28/11/2024   | <ul><li>Revised formatting for release</li></ul> |
