[PATCH] kbuild: drop dependency on .config for tools/

Alexis Lothoré (eBPF Foundation) posted 1 patch 2 weeks ago
Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] kbuild: drop dependency on .config for tools/
Posted by Alexis Lothoré (eBPF Foundation) 2 weeks ago
When trying to build some tooling from tools/ in an unconfigured kernel
tree, the build fails to start because of missing .config:

  $ make tools/bpf
  ***
  *** Configuration file ".config" not found!
  ***
  *** Please run some configurator (e.g. "make oldconfig" or
  *** "make menuconfig" or "make xconfig").
  ***
  /home/alexis/src/linux/Makefile:810: include/config/auto.conf: No such file or directory
  make[1]: *** [/home/alexis/src/linux/Makefile:892: .config] Error 1
  make: *** [Makefile:248: __sub-make] Error 2

The failure is due to the tools/<foo> targets having need-config=1 set.
With a proper .config present, a standard `make tools/bpf` works, but:
  - those tools don't need a .config to build and run, they are built
    independently of the kernel configuration
  - when trying to build some tools in a specific output directory
    (O=foo), we still end up having to configure a kernel first in this
    directory

Rather than having to systematically configure the kernel to only build
those tools, add the tools/% pattern to the no-dot-config-targets listing.

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 570f0c68aadd..eb4bdf4a52cc 100644
--- a/Makefile
+++ b/Makefile
@@ -298,7 +298,8 @@ no-dot-config-targets := $(clean-targets) \
 			 %asm-generic kernelversion %src-pkg dt_binding_check \
 			 dt_style_selftest \
 			 outputmakefile rustavailable rustfmt rustfmtcheck \
-			 run-command
+			 run-command \
+			 tools/%
 no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
 			  image_name
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %/

---
base-commit: 51794b107d54b3c9a8ebbe12a3b81d8495bd482c
change-id: 20260911-tools-build-output-18157e524114

Best regards,
--  
Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>

Re: [PATCH] kbuild: drop dependency on .config for tools/
Posted by Nicolas Schier 1 week, 6 days ago
On Fri, Sep 11, 2026 at 12:42:33PM +0200, Alexis Lothoré (eBPF Foundation) wrote:
> When trying to build some tooling from tools/ in an unconfigured kernel
> tree, the build fails to start because of missing .config:
> 
>   $ make tools/bpf
>   ***
>   *** Configuration file ".config" not found!
>   ***
>   *** Please run some configurator (e.g. "make oldconfig" or
>   *** "make menuconfig" or "make xconfig").
>   ***
>   /home/alexis/src/linux/Makefile:810: include/config/auto.conf: No such file or directory
>   make[1]: *** [/home/alexis/src/linux/Makefile:892: .config] Error 1
>   make: *** [Makefile:248: __sub-make] Error 2
> 
> The failure is due to the tools/<foo> targets having need-config=1 set.
> With a proper .config present, a standard `make tools/bpf` works, but:
>   - those tools don't need a .config to build and run, they are built
>     independently of the kernel configuration

Doesn't tools/testing/ need a kernel configuration?

-- 
Nicolas