The SDK and toolchain can produce incompatible packages when the branch, target, or ABI differs. Always use the tool that matches the target firmware.
SDK, toolchain, and build system
These concepts are related but different:
- Build system: the complete OpenWrt build environment. It can create the toolchain, kernel, root filesystem, packages, and firmware image.
- Toolchain: the compiler and cross-compilation tools used to build for the target architecture, such as ARM or MIPS rather than the build computer's CPU.
- SDK: a smaller environment normally used to compile external packages for a known firmware target.
The SDK is useful when you need to build an individual package without rebuilding the entire firmware.
Which tool should you use?
| Need | Suitable tool |
|---|---|
| Create a customized image from available packages | ImageBuilder |
| Build an individual package for a target | SDK |
| Modify package source or patches | SDK or build system |
| Modify the kernel, driver, or target | Build system |
| Create a toolchain from scratch | Build system |
| Build a complete firmware image | Build system |
Download the correct SDK
The SDK must match at least:
- OpenWrt version or branch.
- Target and subtarget.
- CPU architecture.
- ABI and toolchain.
Start at:
| |
Do not use an SDK from another target simply because the package looks simple. An ABI mismatch may appear only when the package is installed or executed on the router.
Prepare the package source
Get a package from the OpenWrt source tree:
| |
For a downloaded SDK archive:
| |
The directory layout can vary. Check that it contains Makefile, include/, and the required package directories.
Update SDK feeds
Some packages require feeds:
| |
If a package is in a source checkout, verify its path before building. Do not copy a package from another branch without checking dependencies and APIs.
Select the target
Open configuration:
| |
Select the correct target architecture and the options required by the package. Even when the SDK is released for a fixed target, read its configuration information to avoid choosing the wrong variant.
Generate defaults if needed:
| |
Build a package
For a package in package/aiot/hello/:
| |
The package path may be different in another tree. Locate its Makefile and adjust the command.
Build all selected packages:
| |
The resulting .ipk files are normally placed under bin/packages/ or the corresponding output directory.
Test the package on a router
Check the router architecture and dependencies:
| |
Copy and install the package:
| |
Use a package only on a router with a compatible target and ABI. If opkg reports a missing dependency, do not force the installation unless you understand the consequences.
Where is the toolchain?
When building OpenWrt from source, the toolchain is created inside the build tree and used for the selected target. Beginners normally do not need to call the compiler directly; OpenWrt's Makefiles set the environment and compiler flags.
Verbose output helps inspect the compiler, sysroot, CFLAGS, and staging paths:
| |
Do not substitute an arbitrary system compiler for the OpenWrt toolchain.
Common errors
Exec format error
The package was probably built for the wrong CPU architecture.
cannot find -l...
A dependency or development library is missing from the staging directory.
Kernel too old or symbol errors
The package may have been built for a different branch or kernel than the firmware.
The package installs but does not run
Check ABI, dynamic linker, execute permissions, runtime dependencies, and the service log on the router.
Compatibility checklist
Before distributing a package:
- The OpenWrt branch matches the target firmware.
- Target and subtarget are correct.
- Architecture and ABI are correct.
- Dependencies are declared in the Makefile.
- The package was tested on the matching router or image.
- No secret, token, or build-machine path is included.
Official sources
- OpenWrt — Using the SDK
- OpenWrt — Build system essentials
- OpenWrt — Using build environments
- OpenWrt source repository


Góp Ý / Bình Luận / Đánh giá