Skip to contentSkip to conversation

kbuild: find kernel/configs for fragments in fragment merging

PATCH Superseded Zhang Bingwu 2 participants 7 messages Jan 13, 2024 – Jan 27, 2024 Kbuild

lore
Share & tools
lore
#0 lore raw

cover kbuild: find kernel/configs for fragments in fragment merging

From: Zhang Bingwu <[email protected]>

Function merge_into_defconfig and merge_into_defconfig_override merge
a defconfig with several fragments, which should also be searched for in kernel/configs/*.config.
When using 'make xxx_defconfig xxx.config' to merge fragments,
scripts/kconfig/Makefile also searches kernel/configs/*.config for fragments.

This patch also switched usages of ARCH to SRCARCH.
For some ARCH values, such as i386 and x86_64, SRCARCH is different
from ARCH and arch/$(ARCH) does not exist anymore.
If the two functions are used in these ARCHs which has
a different SRCARCH, kbuild may fail to find fragments.

Zhang Bingwu (1):
kbuild: find kernel/configs for fragments in fragment merging

 scripts/Makefile.defconf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 kbuild: find kernel/configs for fragments in fragment merging

From: Zhang Bingwu <[email protected]>

Function merge_into_defconfig and merge_into_defconfig_override merge a defconfig with several fragments, which should also be searched for in kernel/configs/*.config.

This also switched ARCH to $(SRCARCH).
For some ARCH, SRCARCH is different from ARCH and arch/$(ARCH) does not exist.

---
 scripts/Makefile.defconf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.defconf +2 -2
index ab271b205..6e61c1784 100644
@@ -10,7 +10,7 @@
 define merge_into_defconfig
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
 		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+		$(foreach config,$(2),$(wildcard $(srctree)/kernel/configs/$(config).config $(srctree)/arch/$(SRCARCH)/configs/$(config).config))
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
 
@@ -24,6 +24,6 @@ endef
 define merge_into_defconfig_override
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
 		-Q -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+		$(foreach config,$(2),$(wildcard $(srctree)/kernel/configs/$(config).config $(srctree)/arch/$(SRCARCH)/configs/$(config).config))
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
Signature · 1 line
2.43.0
#2 lore raw

v2 cover kbuild: find kernel/configs for merged fragments

In reply to Zhang Bingwu

From: Zhang Bingwu <[email protected]>

First patch changed usages of ARCH to SRCARCH.
For some ARCH values, such as i386 and x86_64, SRCARCH is different from ARCH and arch/$(ARCH) does not exist.

Config fragments merged by merge_into_defconfig and merge_into_defconfig_override should also be searched for in kernel/configs/*.config.
When using 'make xxx_defconfig xxx.config' to merge fragments, scripts/kconfig/Makefile also searches kernel/configs/*.config for fragments. This behaviour should also be in merge_into_defconfig.

Changed in v2:
- Split changes to two patches

Zhang Bingwu (2):
kbuild: defconf: use SRCARCH to find merged configs
kbuild: find kernel/configs/ for merged fragments

 scripts/Makefile.defconf | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 1/2 kbuild: defconf: use SRCARCH to find merged configs

From: Zhang Bingwu <[email protected]>

For some ARCH values, SRCARCH, which should be used for finding arch/ subdirectory, is different from ARCH.

---
 scripts/Makefile.defconf | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/Makefile.defconf +4 -4
index ab271b205..226ea3df3 100644
@@ -9,8 +9,8 @@
 # Input config fragments without '.config' suffix
 define merge_into_defconfig
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
-		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+		-m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+		$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
 
@@ -23,7 +23,7 @@ endef
 # Input config fragments without '.config' suffix
 define merge_into_defconfig_override
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
-		-Q -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+		-Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+		$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v2 1/2] kbuild: defconf: use SRCARCH to find merged configs

Quoted 7 lines · Zhang Bingwu

From: Zhang Bingwu <[email protected]>

For some ARCH values, SRCARCH, which should be used for finding arch/ subdirectory, is different from ARCH.

As you can see in "git log scripts/Makefile.defconf", I was not involved in anything about this file.

I do not see much interest in this patch set, but
Arnd Bergmann might be excited about it.

(You did not accompany with a real use case though)

Quoted 30 lines
---
 scripts/Makefile.defconf | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/Makefile.defconf +4 -5
index ab271b205..226ea3df3 100644
@@ -9,8 +9,8 @@
 # Input config fragments without '.config' suffix
 define merge_into_defconfig
        $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
-               -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-               $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+               -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+               $(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
        +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
 
@@ -23,7 +23,7 @@ endef
 # Input config fragments without '.config' suffix
 define merge_into_defconfig_override
        $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
-               -Q -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
-               $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
+               -Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
+               $(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
        +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
--
Quoted 3 lines

2.43.0

--
Best Regards
Masahiro Yamada

#5 lore raw

Re: [PATCH v2 1/2] kbuild: defconf: use SRCARCH to find merged configs

Quoted 12 lines · Masahiro Yamada
Quoted 7 lines · Zhang Bingwu

From: Zhang Bingwu <[email protected]>

For some ARCH values, SRCARCH, which should be used for finding arch/ subdirectory, is different from ARCH.

Quoted 7 lines

As you can see in "git log scripts/Makefile.defconf", I was not involved in anything about this file.

I do not see much interest in this patch set, but
Arnd Bergmann might be excited about it.

(You did not accompany with a real use case though)

Having said that, 1/2 is a bug fix.

I applied this to linux-kbuild/fixes. Thanks.

Signature · 2 lines
Best Regards
Masahiro Yamada
#6 lore raw

PATCH v2 2/2 kbuild: find kernel/configs/ for merged fragments

In reply to Zhang Bingwu

From: Zhang Bingwu <[email protected]>

kernel/configs consists of several arch-independent config fragments, which should also be searched for by merge_into_defconfig.

When using 'make xxx_defconfig xxx.config' to merge fragments, scripts/kconfig/Makefile also searches kernel/configs/*.config for fragments. This behaviour should also be in merge_into_defconfig.

---
 scripts/Makefile.defconf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/Makefile.defconf +2 -2
index 226ea3df3..777be9bf7 100644
@@ -10,7 +10,7 @@
 define merge_into_defconfig
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
 		-m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
+		$(foreach config,$(2),$(wildcard $(srctree)/kernel/configs/$(config).config $(srctree)/arch/$(SRCARCH)/configs/$(config).config))
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
 
@@ -24,6 +24,6 @@ endef
 define merge_into_defconfig_override
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
 		-Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
-		$(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
+		$(foreach config,$(2),$(wildcard $(srctree)/kernel/configs/$(config).config $(srctree)/arch/$(SRCARCH)/configs/$(config).config))
 	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
 endef
Signature · 1 line
2.43.0