On Wed, Jun 11, 2025 at 4:38 PM Thomas Weißschuh thomas.weissschuh@linutronix.de wrote:
Various subsystems embed non-code build artifacts into the kernel, for example the initramfs, /proc/config.gz, vDSO image, etc. Currently each user has their own implementation for that.
Add a common "blob" framework to provide this functionality. It provides standard kbuild and C APIs to embed and later access non-code build artifacts into the kernel image or modules.
Reviewed-by: Nicolas Schier n.schier@avm.de Signed-off-by: Thomas Weißschuh thomas.weissschuh@linutronix.de
Kbuild provides only a small set of syntaxes, yet it's flexible enough to allow each Makefile to implement what it needs. I aim to keep Kbuild scripts as simple as possible and avoid over-engineering.
Instead, you can implement this in lib/kunit/Makefile.kunit-uapi or somewhere. That way, I do not have to be worried about what you do.
Also, your separate blob approach looks questionable to me. In your approach, the blob (kunit-example-uapi.blob.o) and the entry point (kunit-example-test.o) can be separate modules. The entry point would be a small amount of boilerplate. I would keep the user-program blob and its entry point in the same C file. (and I may consider writing a macro for populating a blob + knit entry)
Due to its closeness to kbuild this is currently added to its MAINTAINER entry. But I can also maintain it on its own.
Or, maybe do not add this.