Skip to contentSkip to conversation

kbuild: take vmlinux.[ao] out of single-targets

PATCH In review Wei Yang 2 participants 2 messages Jan 15, 2024 – Jan 16, 2024 Kbuild

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 kbuild: take vmlinux.[ao] out of single-targets

For current kernel, when we make vmlinux.a or vmlinux.o, following message would display.

$make vmlinux.o
/dir/to/kernel/Makefile:1887: warning: overriding recipe for target 'vmlinux.o' /dir/to/kernel/Makefile:1138: warning: ignoring old recipe for target 'vmlinux.o'
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
make[2]: Nothing to be done for 'vmlinux.o'.

The reason is vmlinux.[ao] is treated as single target, while the rule is written in root Makefile.

This patch fixes this by take them out of single-targets.

CC Masahiro Yamada <[email protected]>
CC Miguel Ojeda <[email protected]>
CC Nathan Chancellor <[email protected]>
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -1
index f1b2fd977275..66fb08f6d971 100644
@@ -280,6 +280,7 @@ no-dot-config-targets := $(clean-targets) \
 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 %.symtypes %/
+no-single-targets := vmlinux.o vmlinux.a
 
 config-build	:=
 mixed-build	:=
@@ -315,11 +316,14 @@ ifeq ($(KBUILD_EXTMOD),)
 endif
 
 # We cannot build single targets and the others at the same time
-ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
+ifneq ($(filter-out $(no-single-targets), $(filter $(single-targets), $(MAKECMDGOALS))),)
 	single-build := 1
 	ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
 		mixed-build := 1
 	endif
+	ifneq ($(filter $(no-single-targets), $(MAKECMDGOALS)),)
+		mixed-build := 1
+	endif
 endif
 
 # For "make -j clean all", "make -j mrproper defconfig all", etc.
Signature · 1 line
2.34.1
#1 lore raw
Quoted 15 lines · Wei Yang

For current kernel, when we make vmlinux.a or vmlinux.o, following message would display.

$make vmlinux.o
/dir/to/kernel/Makefile:1887: warning: overriding recipe for target 'vmlinux.o' /dir/to/kernel/Makefile:1138: warning: ignoring old recipe for target 'vmlinux.o'
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
make[2]: Nothing to be done for 'vmlinux.o'.

The reason is vmlinux.[ao] is treated as single target, while the rule is written in root Makefile.

Quoted 7 lines

This patch fixes this by take them out of single-targets.

CC Masahiro Yamada <[email protected]>
CC Miguel Ojeda <[email protected]>
CC Nathan Chancellor <[email protected]>

---

Not all targets can be built by the single-target.

Just do not do "make vmlinux.o".

Quoted 34 lines
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -2
index f1b2fd977275..66fb08f6d971 100644
@@ -280,6 +280,7 @@ no-dot-config-targets := $(clean-targets) \
 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 %.symtypes %/
+no-single-targets := vmlinux.o vmlinux.a
 
 config-build   :=
 mixed-build    :=
@@ -315,11 +316,14 @@ ifeq ($(KBUILD_EXTMOD),)
 endif
 
 # We cannot build single targets and the others at the same time
-ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
+ifneq ($(filter-out $(no-single-targets), $(filter $(single-targets), $(MAKECMDGOALS))),)
        single-build := 1
        ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
                mixed-build := 1
        endif
+       ifneq ($(filter $(no-single-targets), $(MAKECMDGOALS)),)
+               mixed-build := 1
+       endif
 endif
 
 # For "make -j clean all", "make -j mrproper defconfig all", etc.
--

2.34.1

Signature · 2 lines
Best Regards
Masahiro Yamada