OpenWRT Custom Build
Introduction
OpenWRT is a ubiquitous Operating System found in edge devices across the globe. It is a popular choice for system integrators (OEMs) in routers due to its flexibility, stability, and extensive feature set - attributes such as:
- Open-Source & Vendor Independence
- Highly Customizable & Modular
- Advanced Networking Features
- Strong Security & Stability
- Developer-Friendly & Automation Ready
- Proven Track Record in Commercial & Industrial Use
- Portability
- Versioning - for stability reasons, OpenWRT does not accept version upgrades/release except for bug and security patching. For this reason, only older versions of Netify are available on some versions of OpenWRT.
- Limited Plugins - OpenWRT only accepts open-source packages, restricting functionality Netify has developed on proprietary plugins.
- Continuous Integration - Most software development teams will require integration into their existing CI/CD functions, requiring custom buildroots based on OpenWRT.
For these reasons, this guide is available to assist teams responsible for compiling and maintaining Netify and its plugin ecosystem in custom OpenWRT build environments.
Setup
Step 1 - Install required dependencies
On a Debian-based environment, install the necessary packages.
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib \
gettext git libncurses-dev libssl-dev python3 python3-distutils python3-setuptools \
rsync unzip wget zlib1g-dev file sudo ccache
Step 2 - Clone the OpenWRT Source Code
cd ~
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
Step 3 - Checkout an OpenWRT Release Tag
git checkout v23.05.3
Step 4 - Create a feeds.conf File
cp feeds.conf.default feeds.conf
Step 5 - Update and Install the Feeds
./scripts/feeds update -a
./scripts/feeds install -a
Step 6 - Remove Netify
Netify is already included in the OpenWRT third-party feeds and needs to be removed so that the custom feed that will be added later is selected.
./scripts/feeds uninstall netifyd
Step 7 - Configure the Build
make menuconfig
What to Select:
- Target System: Choose the chipset for your device (e.g., Atheros, Mediatek).
- Target Profile: Select the specific hardware model.
- Base Packages: Choose essential packages to include.
- LuCI Web Interface: (Optional) If you want a web UI, enable LuCI under Base system -> LuCI.
Step 8 - Build
At this point, you should be able to run make
and begin compiling the OpenWRT core and selected packages. In fact, compiling Netify's packages from the custom feed will require this
at some point, and it could take a while, so you could start the process and then continue to the next step while it's building.
make -j$(nproc) V=s
Adding Netify Custom Feed
Netify's development and integration team have created a script to make it easier to correctly set up your environment to build Netify and plugin packages from the source.
Step 1 - Create a Folder for Netify Source
cd ~
mkdir netify-openwrt
Step 2 - Download the Netify Feed Generator Script
cd netify-openwrt
curl https://www.netify.ai/integration/netify-openwrt-feeds.sh
chmod +x netify-openwrt-feeds.sh
Step 3 - Configure the Script (Optional)
If you wish, you can configure which plugins are compiled and which are not.
Step 4 - Generate the Feed
NETIFY_BRANCH=v5.0.x ../netify-openwrt-feeds.sh
Netify OpenWrt Feeds Generator
------------------------------
https://www.netify.ai/documentation
>>> Required package dependencies:
autoconf automake bison build-essential flex gawk git libcurl4-openssl-dev libpcap-dev libtool pkg-config rsync uuid
Install package dependencies (requires sudo)? y
[sudo] password for devel:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
autoconf is already the newest version (2.71-2).
automake is already the newest version (1:1.16.5-1.3).
bison is already the newest version (2:3.8.2+dfsg-1build1).
build-essential is already the newest version (12.9ubuntu3).
flex is already the newest version (2.6.4-8build2).
libtool is already the newest version (2.4.6-15build2).
pkg-config is already the newest version (0.29.2-1ubuntu3).
uuid is already the newest version (1.6.2-1.5build9).
gawk is already the newest version (1:5.1.0-1ubuntu0.1).
git is already the newest version (1:2.34.1-1ubuntu1.12).
libcurl4-openssl-dev is already the newest version (7.81.0-1ubuntu1.20).
libpcap-dev is already the newest version (1.10.1-4ubuntu1.22.04.1).
rsync is already the newest version (3.2.7-0ubuntu0.22.04.4).
The following packages were automatically installed and are no longer required:
bridge-utils dns-root-data dnsmasq-base libflashrom1 libftdi1-2 ubuntu-fan
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.
mkdir: created directory '/home/devel/netify-openwrt/netify-feeds'
mkdir: created directory '/home/devel/netify-openwrt/netify-feeds/net'
mkdir: created directory '/home/devel/netify-openwrt/netify-feeds/libs'
>>> Preparing: netify-agent...
Cloning into 'netify-agent'...
remote: Enumerating objects: 21830, done.
remote: Counting objects: 100% (363/363), done.
remote: Compressing objects: 100% (357/357), done.
remote: Total 21830 (delta 223), reused 0 (delta 0), pack-reused 21467 (from 1)
Receiving objects: 100% (21830/21830), 6.20 MiB | 8.95 MiB/s, done.
Resolving deltas: 100% (16483/16483), done.
~/netify-openwrt/netify-agent ~/netify-openwrt
Already on 'master'
Your branch is up to date with 'origin/master'.
...
..
.
>>> Netify Feeds created:
Add the following to your custom feeds.conf:
src-link netify /home/devel/netify-openwrt/netify-feeds
>>> For generic OpenWrt builds, the Netify Feeds can be installed using:
./scripts/feeds update -a
./scripts/feeds install -a -p netify
>>> Done.
Adding Netify Custom Feed
With the Netify custom feeds folder populated with the Netify sources, it's time to add the custom feed to the OpenWRT feeds.conf file. Using the output generated by the script:
src-link netify /home/devel/netify-openwrt/netify-feeds
and add this line to the end of your feeds.conf file, so that it looks similar to the following:
cat ~/openwrt/feeds.conf
src-git packages https://git.openwrt.org/feed/packages.git^063b2393cbc3e5aab9d2b40b2911cab1c3967c59
src-git luci https://git.openwrt.org/project/luci.git^b07cf9dcfc37e021e5619a41c847e63afbd5d34a
src-git routing https://git.openwrt.org/feed/routing.git^648753932d5a7deff7f2bdb33c000018a709ad84
src-git telephony https://git.openwrt.org/feed/telephony.git^86af194d03592121f5321474ec9918dd109d3057
src-link netify /home/devel/netify-openwrt/netify-feeds
Next, update your feeds
cd ~/openwrt
./scripts/feeds update -a
./scripts/feeds install -a -p netify
Packages
make -j$(nproc) V=s package/netifyd/compile
If successful, the packages you have built can be found under ./bin/packages folder.
find ./bin/packages/ -type f | grep netify | grep ipk
./bin/packages/mips_24kc/netify/netifyd_2025-01-01-v5.0.62-1_mips_24kc.ipk
./bin/packages/mips_24kc/netify/netify-proc-core_2025-01-01-v1.0.85-1_mips_24kc.ipk
./bin/packages/mips_24kc/netify/netify-sink-socket_2025-01-01-v1.0.71-1_mips_24kc.ipk
./bin/packages/mips_24kc/netify/netify-sink-http_2025-01-01-v1.0.60-1_mips_24kc.ipk
./bin/packages/mips_24kc/netify/netify-sink-log_2025-01-01-v1.0.58-1_mips_24kc.ipk
Rebuilding Packages
If you make modifications to your Netify custom feeds folder (ex. version change, updated code etc.), run the following to force a package rebuild.
cd ~/openwrt
make -j$(nproc) V=s package/netifyd/clean
make -j$(nproc) V=s package/netifyd/compile