Open Muffo opened 2 years ago
The Linux kernel has a very robust... and fairly large... build system infrastructure. Part of that is a quite excellent extensibility system which lets you write a very tiny makefile of a single line and have it work: https://www.kernel.org/doc/html/latest/kbuild/modules.html
You can have an additional two lines for a target that actually runs uname -r and passes the right directory to a sub-make.
Duplicating this in meson is theoretically possible, however figuring out how to integrate with the kernel build system would be complicated and I'm not sure it's actually worth it.
If anyone is interested in writing a meson module for building kernel modules, that would be neat ;)
I remember having discussed using Meson's external-project module for that, but it does not seems to be a great fit. As far as I understand replacing kbuild is way too complicated, so the best we can do it wrap around make
.
Thanks for the inputs! If I understand, the recommendation would be to wrap the make with a custom target, right?
@Muffo yes, you still need to write the makefile, but you can call it from meson with custom_target().
I know xmake support linux kernel module https://github.com/xmake-io/xmake/issues/1902
Maybe meson can refer its commit to support it :smile:
This is clearly a question from some one who doesn't have much experience with the compilation of Linux kernel modules :)
I searched online and found tutorials on how these can be created using Makefile. However, I couldn't figure out if Meson also supports these builds.
I hate Makefiles and thought I would make one last attempt asking here: can I build Linux kernel modules with Meson?