OnionIoT / openwrt-sdk-wrapper

Easily build packages using the OpenWRT SDK
MIT License
1 stars 1 forks source link
omega2 openwrt openwrt-packages

OpenWRT SDK Wrapper

Supporting scripts and config to easily build OpenWRT packages using the OpenWRT SDK

System Requirements

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.

How to use this Repo

By default, this repo is setup to build OpenWRT packages (based on source code in a Git repo) for deployment.

  1. Run bash onion_buildenv setup_sdk to download and setup the OpenWRT SDK
  2. Two options here:
    1. Run bash onion_buildenv build_all_packages to build all packages listed in the SDK_PACKAGES variable in profile
    2. Run bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN> to build the specified packages
  3. Find compiled package ipk files at openwrt-sdk/bin/packages/mipsel_24kc/onion

Details

The bash onion_buildenv setup_sdk command:

The bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN> command:

The bash onion_buildenv build_all_packages command:


Using this Repo for Development

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:

  1. Clone your package source code repo to your development machine
  2. Update env variable PACKAGE_FEEDS in a profile to the local source. See profiles/README.md for details.
  3. Make any changes to the package source code
  4. Run bash onion_buildenv setup_sdk to download and setup the OpenWRT SDK
  5. Run bash onion_buildenv build_packages <pkg1> <pkg2> ... <pkgN> to build the desired packages
  6. Find your compiled packages in the openwrt-sdk/bin/packages/mipsel_24kc/<feed>/ directory
  7. Test compiled packages on the device. If more code changes are required, start again from step 3.

Example

If we wanted to build the packages from the Onion OpenWRT-Packages repo for development, the steps would be as follows:

  1. 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
  2. Update env variable PACKAGE_FEEDS in a profile:
    • 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
  3. Make any changes to the package source files in /home/ubuntu/OpenWRT-Packages
  4. Run bash onion_buildenv setup_sdk to download and setup the OpenWRT SDK
  5. Run bash onion_buildenv build_packages to build the desired packages
  6. Find the compiled packages in the openwrt-sdk/bin/packages/mipsel_24kc/custom/ directory