How to overwrite a core package?

I cannot change the sources in the build system.

I would have liked to test the functionality I developed in odhcpd.

I've only managed to do this on the production version by applying patches.

I tried to create a feed but unfortunately the build system tries to download the sources on the OpenWrt server (wget).

It's really hopeless. I don't understand what needs to be done.

I'll assume two things for the following:

  1. You've got a working buildroot set up to create your own images;
  2. You have a local copy of your odhcpd repo on the same machine.

This is all from memory as I can never find the docs for it, but it's in there somewhere (not sure if the docs describe it better, but here goes)...

First thing to do is create a symbolic link in the buildroot package directory, named git-src and linked to the .git directory in your local odhcp repo.

$ cd ~/openwrt
$ ln -s  ~/local-repos/odhcpd/.git  package/network/services/odhcp/git-src

Now you need to point the makefile to your changes, which must be committed in your local repo:

$ vi package/network/services/odhcpd/Makefile

change two things in that file, reset these two to match the commit over in your local repo

PKG_SOURCE_DATE:=2024-05-08
PKG_SOURCE_VERSION:=a29882318a4ccb3ae26f7cc0145e06ad4ead224b

Then run two commands to include your code into the build

$ make package/odhcpd/download
$ make package/odhcpd/check V=s FIXUP=1

Now if you git diff, you should see that the PKG_MIRROR_HASH:= line has also been updated to correspond to your code.

Your next make world or make package/odhcpd/compile will now pick up your modified repo as the source, and the result should land in the bin dir:

$ find bin/packages/ -name 'odhcp*apk'
bin/packages/x86_64/base/odhcp6c-2025.02.06~8aa8b706-r1.apk
bin/packages/x86_64/base/odhcpd-ipv6only-2024.05.08~a2988231-r1.apk

And the resulting images will also include your new package, if that's more convenient.

3 Likes

One option is to add your commit as a local patch to odhcpd.
You can simply add the commit in raw patch format into patches/ directory of the odhcpd package. If there is no such directory, just create it.
(Look example from packages that have local patches)

3 Likes

By following your instructions it works like a charm, thank you very much!

As a precaution, I activated the option indicated in the Wiki beforehand. I find the documentation somewhat difficult to follow.

1 Like

I thought patches could only be integrated via the quilt utility. That's what I did during my first tests. But it's hard to keep in sync with sources that change over time.

The information can be found in several Wiki articles.

No.
Quilt is not mandatory.
But it can make it easier to integrate new patches to packages that have lots of patches.

Thanks for the link, not sure why I can never find it.

Indeed, I had completely forgotten about that "enabling" step. Here it is for posterity: you need to enable both "Advanced config..." and "Enable package..."

Oho, now that you've mentioned it, I think this might be the best way to get https://github.com/openwrt/rpcd/pull/8 into 24.10 easily, since rpcd doesn't have an openwrt_24.10 branch... So double :+1:t3:!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.