[RFC bpf-next 13/13] bpf: Supporting building verifier.ko out-of-tree

Daniel Xu posted 13 patches 10 months ago
[RFC bpf-next 13/13] bpf: Supporting building verifier.ko out-of-tree
Posted by Daniel Xu 10 months ago
This supports out-of-tree builds against the in-tree verifier.ko. This
is intended to be used to build newer upstream verifiers against older
kernel sources.

You can also do an "in-tree out-of-tree" build as proof of concept:

    $ make clean
    $ make modules_prepare
    $ cd kernel/bpf
    $ make -C ../.. M=$PWD

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 kernel/bpf/Kbuild | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 kernel/bpf/Kbuild

diff --git a/kernel/bpf/Kbuild b/kernel/bpf/Kbuild
new file mode 100644
index 000000000000..0b4a9ce14c6f
--- /dev/null
+++ b/kernel/bpf/Kbuild
@@ -0,0 +1,8 @@
+# Because Kbuild is preferred over Makefile for in-tree builds
+# but Kbuild is necessary for an out-of-tree module, we need an
+# explicit dispatch to Makefile if doing an in-tree build.
+ifneq ($(M),)
+	obj-m = verifier.o
+else
+	include $(src)/Makefile
+endif
-- 
2.47.1