samples/bpf: kbuild: add CONFIG_SAMPLE_BPF Kconfig
Subsystems (4)
PATCH 1/1 samples/bpf: kbuild: add CONFIG_SAMPLE_BPF Kconfig
From: Björn Töpel <[email protected]>
This commit makes it possible to build the BPF samples via a Kconfig option, CONFIG_SAMPLE_BPF. Further, it fixes that samples/bpf/ could not be built due to a missing samples/Makefile subdir-y entry, after the introduction of commit 394053f4a4b3 ("kbuild: make single targets work more correctly").
--- samples/Kconfig | 4 ++++ samples/Makefile | 1 + 2 files changed, 5 insertions(+)
samples/Kconfig +4 -0
@@ -169,4 +169,8 @@ config SAMPLE_VFS as mount API and statx(). Note that this is restricted to the x86 arch whilst it accesses system calls that aren't yet in all arches. +config SAMPLE_BPF + bool "BPF samples" + depends on HEADERS_INSTALL + endif # SAMPLES
samples/Makefile +1 -0
@@ -20,3 +20,4 @@ obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/ obj-$(CONFIG_VIDEO_PCI_SKELETON) += v4l/ obj-y += vfio-mdev/ subdir-$(CONFIG_SAMPLE_VFS) += vfs +subdir-$(CONFIG_SAMPLE_BPF) += bpf
Signature · 1 line
2.20.1
Quoted 10 lines · Björn Töpel
From: Björn Töpel <[email protected]>
This commit makes it possible to build the BPF samples via a
Kconfigoption,CONFIG_SAMPLE_BPF. Further, it fixes thatsamples/bpf/could not be built due to a missingsamples/Makefilesubdir-y entry, after the introduction of commit394053f4a4b3("kbuild: make single targets work more correctly").Signed-off-by Björn Töpel <[email protected]>
I didn't add a Fixes:-tag for the kbuild commit above; The fix is a fallout from the kbuild change.
Hi Bjorn
Quoted 33 lines · Björn Töpel
From: Björn Töpel <[email protected]>
This commit makes it possible to build the BPF samples via a
Kconfigoption,CONFIG_SAMPLE_BPF. Further, it fixes thatsamples/bpf/could not be built due to a missingsamples/Makefilesubdir-y entry, after the introduction of commit394053f4a4b3("kbuild: make single targets work more correctly").Signed-off-by Björn Töpel <[email protected]>--- samples/Kconfig | 4 ++++ samples/Makefile | 1 + 2 files changed, 5 insertions(+)samples/Kconfig +4
-0@@ -169,4 +169,8 @@ config SAMPLE_VFS as mount API and statx(). Note that this is restricted to the x86 arch whilst it accesses system calls that aren't yet in all arches. +config SAMPLE_BPF + bool "BPF samples" + depends on HEADERS_INSTALL + endif # SAMPLESsamples/Makefile +0
-0
samples/Makefile obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/ · line 23
Quoted 4 lines
samples/Makefile +1
-0@@ -20,3 +20,4 @@ obj-$(CONFIG_SAMPLE_TRACE_PRINTK) += trace_printk/ obj-$(CONFIG_VIDEO_PCI_SKELETON) += v4l/ obj-y += vfio-mdev/ subdir-$(CONFIG_SAMPLE_VFS) += vfs +subdir-$(CONFIG_SAMPLE_BPF) += bpf
Please keep samples/Makefile sorted alphabetically.
I am not checking samples/bpf/Makefile, but
allmodconfig no longer compiles for me.
samples/bpf/Makefile:209: WARNING: Detected possible issues with include path. samples/bpf/Makefile:210: WARNING: Please install kernel headers locally (make headers_install).
error: unable to create target: 'No available targets are compatible with triple "bpf"'
1 error generated.
readelf: Error: './llvm_btf_verify.o': No such file
*** ERROR: LLVM (llc) does not support 'bpf' target
NOTICE: LLVM version >= 3.7.1 required
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 5 lines · Masahiro Yamada
Hi Bjorn
Quoted 1 line · Björn Töpel
[...]
Quoted 6 lines
Quoted 2 lines
subdir-$(CONFIG_SAMPLE_VFS) += vfs
+subdir-$(CONFIG_SAMPLE_BPF) += bpfPlease keep
samples/Makefilesorted alphabetically.
Thank you, I'll address that in the v2!
Quoted 8 lines
I am not checking
samples/bpf/Makefile, but
allmodconfig no longer compiles for me.
Quoted 10 lines
samples/bpf/Makefile:209: WARNING: Detected possible issues with include path.samples/bpf/Makefile:210: WARNING: Please install kernel headers locally (makeheaders_install).
error: unable to create target: 'No available targets are compatible with triple "bpf"'
1 error generated.
readelf: Error: './llvm_btf_verify.o': No such file
*** ERROR: LLVM (llc) does not support 'bpf' target
NOTICE: LLVM version >= 3.7.1 required
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit 394053f4a4b3 ("kbuild: make single targets work more correctly"), it's no longer possible to build samples/bpf without support in the samples/Makefile.
Thanks,
Björn
Quoted 3 lines
--
Best Regards
Masahiro Yamada
Quoted 9 lines · Björn Töpel
Quoted 5 lines · Masahiro Yamada
Hi Bjorn
Quoted 1 line · Björn Töpel
[...]
Quoted 27 lines
Quoted 6 lines
Quoted 2 lines
subdir-$(CONFIG_SAMPLE_VFS) += vfs
+subdir-$(CONFIG_SAMPLE_BPF) += bpfPlease keep
samples/Makefilesorted alphabetically.Thank you, I'll address that in the v2!
Quoted 18 lines
I am not checking
samples/bpf/Makefile, but
allmodconfig no longer compiles for me.
samples/bpf/Makefile:209: WARNING: Detected possible issues with include path.samples/bpf/Makefile:210: WARNING: Please install kernel headers locally (makeheaders_install).
error: unable to create target: 'No available targets are compatible with triple "bpf"'
1 error generated.
readelf: Error: './llvm_btf_verify.o': No such file
*** ERROR: LLVM (llc) does not support 'bpf' target
NOTICE: LLVM version >= 3.7.1 required
So, samples/bpf intentionally opts out the normal build because most of people fail to build it.
It must be fixed somehow
before supporting it in samples/Makefile.
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.
You can with
"make M=samples/bpf"
--
Best Regards
Masahiro Yamada
Quoted 1 line · Masahiro Yamada
[...]
Quoted 11 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.You can with
"make M=samples/bpf"
Oh, I didn't know that. Does M= support "output" builds (O=)?
I usually just build samples/bpf/ with:
$ make V=1 O=/home/foo/build/bleh samples/bpf/
Björn
Quoted 16 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 11 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.You can with
"make M=samples/bpf"
Quoted 8 lines
Oh, I didn't know that. Does M= support "output" builds (O=)?
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Björn
Shouldn't README be updated?
Signature · 2 lines
Regards, Ivan Khoronzhuk
Quoted 20 lines · Ivan Khoronzhuk
Quoted 18 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 11 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.You can with
"make M=samples/bpf"
Oh, I didn't know that. Does M= support "output" builds (O=)?
Quoted 9 lines
Quoted 6 lines
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Björn
Shouldn't README be updated?
Hmm, the M= variant doesn't work at all for me. The build is still broken for me. Maybe I'm missing anything obvious...
Quoted 3 lines
--
Regards,
Ivan Khoronzhuk
Quoted 15 lines · Björn Töpel
Quoted 13 lines · Ivan Khoronzhuk
Quoted 11 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 7 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
You can with
"make M=samples/bpf"
Oh, I didn't know that. Does M= support "output" builds (O=)?
No.
O= points to the output directory of vmlinux,
not of the external module.
You cannot put the build artifacts from samples/bpf/ in a separate directory.
Quoted 17 lines
Quoted 9 lines
Quoted 6 lines
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Björn
Shouldn't README be updated?
Hmm, the M= variant doesn't work at all for me. The build is still broken for me. Maybe I'm missing anything obvious...
Quoted 3 lines
--
Regards,
Ivan Khoronzhuk
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 22 lines · Masahiro Yamada
Quoted 20 lines · Björn Töpel
Quoted 18 lines · Ivan Khoronzhuk
Quoted 16 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 11 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.You can with
"make M=samples/bpf"
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Oh, I didn't know that. Does M= support "output" builds (O=)?
No.
O= points to the output directory of vmlinux,
not of the external module.You cannot put the build artifacts from
samples/bpf/in a separate directory.
Hmm, I can't even get "make M=samples/bpf/" to build. Am I missing something obvious?
Prior 394053f4a4b3 "make samples/bpf/" and "make O=/foo/bar samples/bpf/" worked, but I guess I can live with that...
Thanks!
Björn
Quoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Quoted 12 lines
Quoted 4 lines
Quoted 1 line
Björn
Shouldn't README be updated?
Hmm, the M= variant doesn't work at all for me. The build is still broken for me. Maybe I'm missing anything obvious...
Quoted 3 lines
--
Regards,
Ivan Khoronzhuk--
Best Regards
Masahiro Yamada
Quoted 31 lines · Björn Töpel
Quoted 28 lines · Masahiro Yamada
Quoted 15 lines · Björn Töpel
Quoted 13 lines · Ivan Khoronzhuk
Quoted 11 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 7 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
You can with
"make M=samples/bpf"
Oh, I didn't know that. Does M= support "output" builds (O=)?
No.
O= points to the output directory of vmlinux,
not of the external module.
Quoted 6 lines
Quoted 3 lines
You cannot put the build artifacts from
samples/bpf/in a separate directory.Hmm, I can't even get "make M=samples/bpf/" to build. Am I missing something obvious?
There were 3 or 4 separate fixes submitted for samples/bpf yesterday, maybe you are hitting some of those issues. Try to pull latest (not sure if bpf or bpf-next tree). I tried make M=samples/bpf and it worked for me.
Quoted 34 lines
Prior
394053f4a4b3"makesamples/bpf/" and "make O=/foo/barsamples/bpf/" worked, but I guess I can live with that...Thanks!
BjörnQuoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Quoted 12 lines
Quoted 4 lines
Quoted 1 line
Björn
Shouldn't README be updated?
Hmm, the M= variant doesn't work at all for me. The build is still broken for me. Maybe I'm missing anything obvious...
Quoted 3 lines
--
Regards,
Ivan Khoronzhuk--
Best Regards
Masahiro Yamada
Quoted 37 lines · Andrii Nakryiko
Quoted 35 lines · Björn Töpel
Quoted 31 lines · Masahiro Yamada
Quoted 15 lines · Björn Töpel
Quoted 13 lines · Ivan Khoronzhuk
Quoted 11 lines · Björn Töpel
Quoted 1 line · Masahiro Yamada
[...]
Quoted 7 lines
Quoted 5 lines
Yes, the BPF samples require clang/LLVM with BPF support to build. Any suggestion on a good way to address this (missing tools), better than the warning above? After the commit
394053f4a4b3("kbuild: make single targets work more correctly"), it's no longer possible to buildsamples/bpfwithout support in thesamples/Makefile.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
You can with
"make M=samples/bpf"
Oh, I didn't know that. Does M= support "output" builds (O=)?
No.
O= points to the output directory of vmlinux,
not of the external module.You cannot put the build artifacts from
samples/bpf/in a separate directory.
Quoted 8 lines
Quoted 2 lines
Hmm, I can't even get "make M=samples/bpf/" to build. Am I missing something obvious?
There were 3 or 4 separate fixes submitted for
samples/bpfyesterday, maybe you are hitting some of those issues. Try to pull latest (not sure if bpf or bpf-next tree). I tried make M=samples/bpf and it worked for me.
Yeah, it was PEBKAC. "make M=samples/bpf" works if you have a proper .config + "make prepare" ;-)
I guess I need to change my workflow. I build all my kernels "O=", and did so with samples/bpf as well. Everything ended up in the same output directory. Now I need to have all this build output in source tree, and need to manage the .config files in where the source is at. Oh well... I'll stop complaining now. :-)
Thanks,
Björn
Quoted 34 lines
Quoted 34 lines
Prior
394053f4a4b3"makesamples/bpf/" and "make O=/foo/barsamples/bpf/" worked, but I guess I can live with that...Thanks!
BjörnQuoted 25 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I usually just build
samples/bpf/with:$ make V=1 O=/home/foo/build/bleh samples/bpf/Quoted 12 lines
Quoted 4 lines
Quoted 1 line
Björn
Shouldn't README be updated?
Hmm, the M= variant doesn't work at all for me. The build is still broken for me. Maybe I'm missing anything obvious...
Quoted 3 lines
--
Regards,
Ivan Khoronzhuk--
Best Regards
Masahiro Yamada