Supporting scripts and config to easily build OpenWRT packages using the OpenWRT SDK
We recommend using Ubuntu 22.04 Linux to build this repo. See the OpenWRT Build System Setup instructions for details on what packages are required.
By default, this repo is setup to build OpenWRT packages (based on source code in a Git repo) for deployment.
- Run
bash onion_buildenv setup_sdk
to download and setup the OpenWRT SDK - Two options here:
- Run
bash onion_buildenv build_all_packages
to build all packages listed in theSDK_PACKAGES
variable inprofile
- Run
bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN>
to build the specified packages - Find compiled package ipk files at
openwrt-sdk/bin/packages/mipsel_24kc/onion
The bash onion_buildenv setup_sdk
command:
- Will download and setup the OpenWRT SDK
- Add the custom feeds specified as env variable
PACKAGE_FEEDS
in a buildprofile
to the SDK
The bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN>
command:
- Will compile the packages in the
<pkg1> <pkg2> ... <pkgN>
arguments
The bash onion_buildenv build_all_packages
command:
- Will compile all the packages specified as env variable
SDK_PACKAGES
in a buildprofile
to the SDK - Will build a package index signed with the keys in the
keys/
directory (learn more about package signing here and here) - All output will be in the
openwrt-sdk/bin/packages/mipsel_24kc/onion
directory
By default, the packages are built from source code in git repo specified as env variable PACKAGE_FEEDS
in a build profile to SDK.
While your packages are still under development and you are iterating on the package source code, it will be more straight-forward to work from a local copy of the package source instead.
To work from a local copy of your source code:
- Clone your package source code repo to your development machine
- Update env variable
PACKAGE_FEEDS
in aprofile
to the local source. See profiles/README.md for details. - Make any changes to the package source code
- Run
bash onion_buildenv setup_sdk
to download and setup the OpenWRT SDK - Run
bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN>
to build the desired packages - Find your compiled packages in the
openwrt-sdk/bin/packages/mipsel_24kc/<feed>/
directory - Test compiled packages on the device. If more code changes are required, start again from step 3.
If we wanted to build the packages from the Onion OpenWRT-Packages repo for development, the steps would be as follows:
- clone your package source code repo to your development machine
- Clone the repo:
git clone https://github.com/OnionIoT/OpenWRT-Packages.git
note the path to the cloned directory, in our case it's/home/ubuntu/OpenWRT-Packages
- Checkout desired branch if required
- Clone the repo:
- Update env variable
PACKAGE_FEEDS
in aprofile
:- set a value:
PACKAGE_FEEDS="src-link custom /home/ubuntu/OpenWRT-Packages"
, since/home/ubuntu/OpenWRT-Packages
is the absolute path to the cloned directory from step 1
- set a value:
- Make any changes to the package source files in
/home/ubuntu/OpenWRT-Packages
- Run
bash onion_buildenv setup_sdk
to download and setup the OpenWRT SDK - Run
bash onion_buildenv build_packages
to build the desired packages - Find the compiled packages in the
openwrt-sdk/bin/packages/mipsel_24kc/custom/
directory