2024-12-23 16:33 UTC+0800 ~ Li Zhijian <lizhij...@fujitsu.com>
> Fixes an issue where out-of-tree kselftest builds fail when building
> the BPF and bpftools components. The failure occurs because the top-level
> Makefile passes a relative srctree path to its sub-Makefiles, which
> leads to errors in locating necessary files.
> 
> For example, the following error is encountered:
> 
> ```
> $ make V=1 O=$build/ TARGETS=hid kselftest-all
> ...
> make -C ../tools/testing/selftests all
> make[4]: Entering directory '/path/to/linux/tools/testing/selftests/hid'
> make  -C /path/to/linux/tools/testing/selftests/../../../tools/lib/bpf 
> OUTPUT=/path/to/linux/O/kselftest/hid/tools/build/libbpf/ \
>             EXTRA_CFLAGS='-g -O0'                                      \
>             DESTDIR=/path/to/linux/O/kselftest/hid/tools prefix= all 
> install_headers
> make[5]: Entering directory '/path/to/linux/tools/lib/bpf'
> ...
> make[5]: Entering directory '/path/to/linux/tools/bpf/bpftool'
> Makefile:127: ../tools/build/Makefile.feature: No such file or directory
> make[5]: *** No rule to make target '../tools/build/Makefile.feature'.  Stop.
> ```
> 
> To resolve this, override the srctree in the kselftests's top Makefile
> when performing an out-of-tree build. This ensures that all sub-Makefiles
> have the correct path to the source tree, preventing directory resolution
> errors.
> 
> Signed-off-by: Li Zhijian <lizhij...@fujitsu.com>


I simply tested with "make V=1 O=build/ TARGETS=hid kselftest-all", this
approach fixes the build just as well as v1. Thanks!

Tested-by: Quentin Monnet <q...@kernel.org>

Reply via email to