How to integrate openwrt/packages on top of openwrt/openwrt repository

Hi,

I have a build system working on Debian Virtual machine and can compile basic .c files for openwrt on my architecture.

I’m using this repository for this:

Now i want to add additional packages to my build system using this repository below, because i trying to compile a more extended .c program with extra libraries not in base openwrt included.

What is the quickest way to add those packages to my build system?

This sounds like a Job for Image Builder: https://openwrt.org/docs/guide-user/additional-software/imagebuilder

Image Builder needs no virtual machine and allows to include custom files. To get images closest to the official images, I build with

make image PROFILE=<your model> PACKAGES="luci luci-ssl"

Builds are rather quick, in my case 9 seconds.

The default one.

The "feeds" like that "packages repo that you referenced, get included by default with feeds.conf.default (or feeds.conf) to the main OpenWrt build system. Just update (and install) the feeds normally.

PS. The source code directories are located in feeds/packages/ etc. in case you want to modify some of the package Makefiels or so.

2 Likes

Okay thanks for your feedback.

The goal is to compile a c program on the Debian machine as package for my openwrt device bcm2711.

The c program uses a static lora library and a the integrated library libopen62541

It is exactly like @hnyman said.

To clarify things I give you my example.

I have a repository with some add-on packages which I want in my own compiled build.
When compiling I have a build script which adds a number of patches and the patch below will add my own repository to feeds.conf.default

-- a/feeds.conf.default	2025-03-08 07:50:12.060014321 +0100
+++ b/feeds.conf.default	2025-03-08 08:12:53.985652750 +0100
@@ -2,3 +2,4 @@
 src-git luci https://git.openwrt.org/project/luci.git;openwrt-24.10
 src-git routing https://git.openwrt.org/feed/routing.git;openwrt-24.10
 src-git telephony https://git.openwrt.org/feed/telephony.git;openwrt-24.10
+src-git egc https://github.com/egc112/OpenWRT-egc-add-on.git

That way my build system has access to this repository.

The build system will scan your repo for packages which you can install with make menuconfig

this is a link to one of the packages I install that way:

The trick is in the Makefile

It is a really cool build system kudos to the OpenWRT developers

Okay, I am gradually becoming familiar with it.

I see libopen62541 is using version 1.3.6, which is default in the openwrt packages.

If i want to use the newest version 1.4.14, i only have to change te PKG_VERSION to 1.4.14?

When i build this repository: https://github.com/Lora-net/sx1302_hal using make i get a libloragw.a file.

My .c file should also use that library.

I’m asking this because compiling for my architecture gave problems.

Whem i built the .c file using gcc and add the static library and the dynamic open62541 library i get no errors.

After that i compile using make /package/package_name/compile

then i get errors that functions of the libloragw.a and functions of the open62541 library are not found

It’s a bit more involved. You will want to ensure your libopen62541 version at 1.4.14 takes precedence over the OpenWrt version that exists in openwrt/feeds/packages/libs for version 1.3.6.

You will likely want to use Custom Feeds

Okay if i understand correctly:

i only have to copy the makefile of version of libopen62541 1.3.6 to

<buildroot>/my_packages/<section>/<category>/<package_name>

And change the PKG_VERSION variable in the makefile to 1.4.14

after that execeuting this:

./scripts/feeds update -a; ./scripts/feeds install libopen62541

Select the package using make menuconfig

and last command:

make /package/libopen62541/compile?

Yes, and you should also change the SHA256 hash in PKG_HASH line, once you have tried the download.

As you are editing an already existing package, much easier than "custom feeds" would be to just modify the already existing local copy of the package Makefile.
Should be located in <buildroot>/feeds/packages/libs/libopen62541

1 Like

Okay, i changed the version number in the Makefile of the libopen62541 package under /feeds/packages/libs/libopen62541. i commented out the hash because i have to calculate it using

make package/<path-to-your-package>/download
make package/<path-to-your-package>/check FIXUP=1

But the output of both of this commands is ‘No rule to make target’

Do i something wrong?

It should be enough to have just the package name there, not the whole path.

That was the problem indeed, now it’s compiling.