HOWTO modify package contents

I want to modify the contents of a certain package, to remove some unnecesary files, and to replace a few other ones, because of squeezing everything into 4MB of flash, by doing a custom build.
One approach would be to manually edit the standard Makefile, but that could be lost in case of new version of package.
Is there a more elegant solution ?

Fork the package to a new name, install as a custom feed. Rebase your changes as needed.

You can use the files/ directory to overwrite the files from the packages before the image is generated. Replace the files you want to remove with 0 or 1 byte files (not sure if 0 byte files are allowed). I don't know about elegant, but it's certainly easier.

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#custom_files

1 Like

Thanx, will try the trick using 0/1-byte files.

touch works, though only if a potential "reader" of the file degrades gracefully if the file exists, but doesn't have the expected content.