Using the SDK

The SDK is a pre-compiled toolchain designed to cross compile packages for a specific target without compiling the whole system from scratch.

Tasks you can do with the SDK:

  • Compile custom software for a specific release while ensuring binary and feature compatibility
  • Compile newer versions of certain packages for a specific release
  • Recompile existing packages with custom patches or different features

Tasks you cannot do with the SDK:

  • Use it as a drop-in for a cross-compiling toolchain to compile the whole firmware.

Prerequisites

The SDK has the same prerequisites as the buildroot system, so please see Build system – Installation page to install the needed software to build the packages on the SDK.

Note: On some hosts it is needed to install the ccache package.

  • Do everything as an unprivileged user, not root, without sudo.
  • Make sure there are no spaces in the full path to the build directory.

You can either download a precompiled SDK or compile it yourself from sources. Compilation from source is done by simply enabling the menuconfig option Build the OpenWrt SDK (CONFIG_SDK). The precompiled SDK is found in the same download folder where you find the firmware images for your device.

  • development snapshot SDKPlatforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz
  • 21.02.3Platforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz
  • 19.07.10Platforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz

After decompressing the SDK archive, optionally edit the feeds.conf.default file to add your package feeds. By default, this will contain the feeds used when the SDK was built. You can add your own feeds, local or remote, just like using the buildroot. If you are simply rebuilding extra packages, you don't need to do this at all.

NOTE: if you want to override packages coming from an existing feed, you must write your custom feed ABOVE the line of the package feed containing the packages you want to override.
For example, you want to make a custom version of a package that is already shipped in Packages feed, this is how your feeds.conf.default will look like (the first line is your own custom package feed)

src-link local /path/to/local/custom/feed
src-git packages https://git.openwrt.org/feed/packages.git
src-git luci https://git.openwrt.org/project/luci.git
src-git routing https://git.openwrt.org/feed/routing.git
src-git telephony https://git.openwrt.org/feed/telephony.git
#src-git video https://github.com/openwrt/video.git
#src-git targets https://github.com/openwrt/targets.git
#src-git oldpackages http://git.openwrt.org/packages.git
#src-link custom /usr/src/openwrt/custom-feed
  • Use ./scripts/feeds update -a command to obtain and update package definitions.
  • After the definitions have been updated, ./scripts/feeds install <packagename> to prepare the package and its dependencies.

./scripts/feeds install -a will make all packages available, again, just like in the buildroot.

Open a terminal in the SDK's folder and then open the SDK's menu by writing make menuconfig. The SDK menuconfig system is the same as the buildroot. Instructions are at the top and help is available via the ? key.

You probably want to disable some default settings, which build every available package. Enter Global Build Settings and in the submenu, deselect/exclude the following options:

  • Select all target specific packages by default
  • Select all kernel module packages by default
  • Select all userspace packages by default

Still in the menu, find the package you want to build and select it by pressing “m”, this will also select all the dependencies, and you will see that they are all tagged with “<M>” in the menu. You can select multiple packages too.

Save the configuration and exit the menu.

After the Makefile is in place, the usual buildroot commands apply:

  • make package/example/download - download the soures of example
  • make package/example/prepare - extract the sources, apply patches and download if necessary
  • make package/example/compile - compile example, prepare and download if necessary
  • make package/example/clean - clean the sourcecode
  • make package/index - build a repository index to make the output directory usable as local opkg source

Or, just run make to build everything selected. You can compile faster by writing make -j5 or similar as appropriate for your build host.

After the compilation is finished, the generated .ipk files are placed in the bin/packages and bin/targets directories inside the directory you extracted the SDK into.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2022/04/21 18:11
  • by tatami