Currently, building the bpf samples under samples/bpf directory isn't working. Running make from the directory 'samples/bpf' will just shows following result without compiling any samples. $ make make -C ../../ /git/linux/samples/bpf/ BPF_SAMPLES_PATH=/git/linux/samples/bpf make[1]: Entering directory '/git/linux' CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool make[1]: Leaving directory '/git/linux' Due to commit 394053f4a4b3 ("kbuild: make single targets work more correctly"), building samples/bpf without support of samples/Makefile is unavailable. Instead, building the samples with 'make M=samples/bpf' from the root source directory will solve this issue.[1] This commit fixes the outdated README build command with samples/bpf. [0]: https://patchwork.kernel.org/patch/11168393/ Signed-off-by: Daniel T. Lee <danieltimlee@xxxxxxxxx> --- samples/bpf/README.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/samples/bpf/README.rst b/samples/bpf/README.rst index 5f27e4faca50..bfd2405705ed 100644 --- a/samples/bpf/README.rst +++ b/samples/bpf/README.rst @@ -32,12 +32,10 @@ Compiling For building the BPF samples, issue the below command from the kernel top level directory:: - make samples/bpf/ + make M=samples/bpf -Do notice the "/" slash after the directory name. - -It is also possible to call make from this directory. This will just -hide the the invocation of make as above with the appended "/". +Due to samples/bpf cannot be built without support in the +samples/Makefile, it is unavailable to call make from this directory. Manually compiling LLVM with 'bpf' support ------------------------------------------ @@ -63,14 +61,15 @@ Quick sniplet for manually compiling LLVM and clang It is also possible to point make to the newly compiled 'llc' or 'clang' command via redefining LLC or CLANG on the make command line:: - make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang + make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang Cross compiling samples ----------------------- In order to cross-compile, say for arm64 targets, export CROSS_COMPILE and ARCH environment variables before calling make. This will direct make to build -samples for the cross target. +samples for the cross target.:: + + export ARCH=arm64 + export CROSS_COMPILE="aarch64-linux-gnu-" + make M=samples/bpf LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang -export ARCH=arm64 -export CROSS_COMPILE="aarch64-linux-gnu-" -make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang -- 2.20.1