Adding a Modified ‘openwrt/packages’ from my fork to my Buildroot

I opened a fork of openwrt/packages. I modded just the init, config, and Makefile files in my forked repo and added a hotplug script and README.md files.

It's been pretty easy just to add my modifications in my Buildroot/files and select the relevant package from the openwrt/packages feed in make nconfig to compile the binaries. Now that I've accomplished the changes I wanted I figured I'd try this approach in my Buildroot: *https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#creating_a_local_feed

Points 1 & 2 are clear enough, but I struggle starting at point 3.

? - please correct me:
I assume I want the Makefile from my forked repo I modified to add the hotplug script, and I have download the source package from sources.openwrt.org, extracted the tarball and placed the files in my Buildroot/<package_name> directory.

Forgive me for being obtuse, but could some one explain to me how this updates/installs my changes into my local Buildroot?

Just copy the folder where resides the package you have modified.
Makefile and directory files and other if there is !
The full directory.
Copy it to another destination (it is the my_package reference of the documentation)...

Then add in feeds.conf.default the src-link to your new directory (my_package).

Check and add with ./scripts/feeds update -a and ./scripts/feeds install -a

Then you can do your make, make menuconfig or make package/my_package/build !

Hope it will help, but keep it simple.

Creating a local feed

  1. Prepare your <buildroot> with git cloning openwrt sources from github (e.g. from your fork).

  2. Create a dir:
    mkdir -p <buildroot>/my_packages/<section>/<category>/<package_name>.
    Replace the <package_name> with the name of your package.
    e.g. mkdir -p my_packages/net/network/rpcbind.
    The section and category can be found in the Makefile.

  3. Write a Makefile or download one Makefile from another package, look at samples on github.
    Edit your Makefile and add necessary files, sources...
    https://openwrt.org/docs/guide-developer/packages
    https://openwrt.org/docs/guide-developer/helloworld/chapter3

  4. Append a line with your custom feed to
    feeds.conf.default: src-link my_packages <buildroot>/my_packages.
    Replace the <buildroot> with cloned openwrt sources directory e.g. ~/openwrt.
    Move the line with your custom feed above standard feeds to override them.

  5. Now run: ./scripts/feeds update -a; ./scripts/feeds install <package_name>

  6. If you are doing this to resolve a dependency you can run install one more time and you should notice the dependency has been resolved.

  7. Build your package.
    Select it in the menu of Make menuconfig.
    Build it with make package/my_package/{clean,compile}
    https://openwrt.org/docs/guide-developer/single.package

EDIT : the same doc as https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#creating_a_local_feed but a little reordered !

Thank you! Much clearer.

I'm going to rebuild my buildroot first. Who knows what havoc I may have created to it.

@vgaetera I have review/reword this section on the wiki

1 Like

It seems I am still missing a link to the solution.

By the steps:

  1. go to my fork of openwrt/packages in github, select my branch, select Code and generate a zip archive - i.e. Clone my source.

  2. in my buildroot I mkdir -p /openwrt/my_package/net/network/<package_name> and extract my <package_name> contents here.

  3. Makefile has been updated properly.

  4. I append a line with my custom feed to the top of feeds.conf.default:
    src-link my_package <buildroot>/<package_name>

  5. Run: make clean, ./scripts/feeds update -a -f; ./scripts/feeds install -a -f

  6. Build new firmware incorporating <package_name> into new build:
    make nconfig, select <package_name>, and save .config and run date && make -j $(($(nproc)+1)) download && date && make -j $(($(nproc)+1)) && date

Result: same package as openwrt/packages results, not my updated package.

(It's been a trial considering everything already worked by simply copying config, init.d, and hotplug scripts into <buildroot>/files, but then, I did ask for this ¯\_(ツ)_/¯ .

After several days trying different permutations and builds, I cannot make it work as advertised, but, simply overlaying the openwrt/feeds/packages/net/ with my openwrt/my_package/net/network/<my_package> does produce a working build to my specs.

I copied /openwrt/my_package/net/network/<package_name> into the relevent Master
/openwrt/feeds/packages/net/<my_package>, and rebuilt once more - AND - It all works in the new build!

Looking through my buildroot, I did notice that openwrt/feeds/my_package indicates link(broken)` in a directory listing. Haven't pursued that yet.

Convoluted I'm sure. I can make my build work with this workaround, but cannot make it work with a local source????????????????????????? per the wiki.

Any further HINTS?