OpenWrt SDK and ImageBuilder Usage Guide

OpenWrt SDK

The OpenWrt SDK provides a cross-compilation toolchain, libraries, header files, and development tools, allowing developers to compile and debug applications on their local machines before deploying them to OpenWrt devices.

With the OpenWrt SDK, developers can add custom features, modify kernel options, add new packages, customize interfaces, and more. This makes OpenWrt very flexible and extensible, suitable for various application scenarios and needs.

OpenWrt ImageBuilder

The OpenWrt ImageBuilder is a tool that helps users customize OpenWrt firmware images. Compared to the OpenWrt SDK, ImageBuilder is simpler and easier to use, requiring no compilation or debugging from the user.

Using ImageBuilder, users can select the required packages, configuration files, file systems, etc., and generate a customized OpenWrt firmware image. Users can customize according to their needs, such as adding specific packages, configuring network settings, adding custom scripts, etc.

ImageBuilder supports multiple OpenWrt platforms and architectures, including x86, ARM, MIPS, etc. Users can choose the platform and architecture suitable for their devices.

Download Link

SDKs and ImageBuilders for various architectures can be downloaded from the OpenWrt firmware release official website, for example, the download link for X86 is:

https://mirrors.cloud.tencent.com/openwrt/releases/22.03.3/targets/x86/64/

Usage Guide

Download the SDK and ImageBuilder

wget https://mirrors.cloud.tencent.com/openwrt/releases/22.03.3/targets/x86/64/openwrt-imagebuilder-22.03.3-x86-64.Linux-x86_64.tar.xzwget https://mirrors.cloud.tencent.com/openwrt/releases/22.03.3/targets/x86/64/openwrt-sdk-22.03.3-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz

OpenWrt SDK and ImageBuilder Usage Guide

Update feeds

./scripts/feeds update -a

OpenWrt SDK and ImageBuilder Usage Guide

OpenWrt SDK and ImageBuilder Usage Guide

Now you can add plugin packages for compilation

Here we take compiling the application filtering plugin as an example.

Download the plugin source code

https://github.com/destan19/OpenAppFilter

OpenWrt SDK and ImageBuilder Usage Guide

make menuconfig select luci-app-oaf

OpenWrt SDK and ImageBuilder Usage Guide

Save and exit

make package/luci-app-oaf/compile V=s

The first compilation takes a while, ensure the network is fine, especially:

https://github.com

https://cdn.kernel.org

OpenWrt SDK and ImageBuilder Usage Guide

Compiled generated ipk

bin/targets/x86/64/packages/kmod-oaf_5.10.161-1_x86_64.ipkbin/packages/x86_64/base/luci-app-oaf_5.0.2_all.ipkbin/packages/x86_64/base/luci-i18n-oaf-zh-cn_git-22.333.43289-fd21eb3_all.ipkbin/packages/x86_64/base/appfilter_5.0.2-1_x86_64.ipk

Enter the imagebuilder root directory, prepare to package the firmware

OpenWrt SDK and ImageBuilder Usage Guide

repositories.conf is used to configure the directory for querying packages, you can configure the cloud OpenWrt source address, for example, the default is downloads.openwrt.org, and you can also configure the local query packages directory, which defaults to the packages directory in the root directory.

So we just need to put the added ipk packages in that directory.

OpenWrt SDK and ImageBuilder Usage Guide

To speed up the packaging speed, change the cloud address to domestic to improve the download speed.

sed -i “s/downloads.openwrt.org/mirrors.cloud.tencent.com\/openwrt\//g” repositories.conf

OpenWrt SDK and ImageBuilder Usage Guide

Make sure the complete address is accessible.

Copy the ipk generated in the sdk to the packages directory.

OpenWrt SDK and ImageBuilder Usage Guide

make help to view image builder usage commands

OpenWrt SDK and ImageBuilder Usage Guide

Generally, we only need to specify PROFILE and PACKAGES two parameters to package and generate firmware.

PROFILES indicates the product type corresponding to that architecture, for example, if X86/64 includes generic, just specify PROFILE as generic.

make info can view the profiles supported by the current sdk.

OpenWrt SDK and ImageBuilder Usage Guide

PACKAGES parameter is used to specify the packages to add or exclude, generally we only need to add.

Format PACKAGES=”pkg1 pkg2 pkg3″

Since the official OpenWrt sdk does not include a web interface by default, we need to add luci-related plugins by default.

The following is the command to package the base firmware with the application filtering plugin added:

make image PROFILE=generic PACKAGES=”luci luci-base luci-i18n-base-zh-cn luci-compat luci-app-firewall luci-lib-ip luci-lib-nixio luci-mod-admin-full luci-proto-ppp luci-theme-bootstrap luci-app-oaf luci-i18n-oaf-zh-cn appfilter kmod-oaf”

OpenWrt SDK and ImageBuilder Usage Guide

Finally, the OpenWrt firmware has been generated.

OpenWrt SDK and ImageBuilder Usage Guide

It can be seen that the application filtering plugin has been included.

OpenWrt SDK and ImageBuilder Usage Guide

OpenWrt SDK and ImageBuilder Usage Guide

OpenWrt SDK and ImageBuilder Usage Guide

OpenWrt SDK and ImageBuilder Usage Guide

LongpresstheQRcodetofollow

RegularlyshareOpenWrtfirmwareandtechnology

Leave a Comment

×