Skip to contentSkip to conversation

Kbuild/Kconfig

PATCH In review Arnaud Lacombe 2 participants 10 messages Aug 16, 2011 – Sep 16, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Kbuild/Kconfig

Hi Michal,

The following small serie unexpose a few Kconfig variable from Kbuild, and vice-versa. The idea is that Kbuild is a user of Kconfig, not the other way around.

In the same time, fix a couple of place where we hardcode the `.config' string.

Comments Welcome !
- Arnaud

Arnaud Lacombe (4):
kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG
kbuild: reduce kbuild invasivity within kconfig
kbuild: do not hardcode .config
kconfig: do not hardcode .config

 Makefile                                |   20 ++++++++++++++------
 arch/arm/boot/compressed/Makefile       |    2 +-
 arch/unicore32/boot/compressed/Makefile |    2 +-
 scripts/kconfig/Makefile                |   31 ++++++++++++++++---------------
 4 files changed, 32 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.6.153.g78432
#1 lore raw

PATCH 1/4 kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG

Refine the Kbuild interface to expose it's own variable to architecture Makefile's and prepare Kconfig environment prior to any %config invocation.

---
 Makefile                                |    8 ++++++--
 arch/arm/boot/compressed/Makefile       |    2 +-
 arch/unicore32/boot/compressed/Makefile |    2 +-
 scripts/kconfig/Makefile                |    3 +++
 4 files changed, 11 insertions(+), 4 deletions(-)
Makefile +6 -2
index b4ca4e1..26798a4 100644
@@ -235,8 +235,8 @@ ifeq ($(ARCH),m68knommu)
        hdr-arch  := m68k
 endif
 
-KCONFIG_CONFIG	?= .config
-export KCONFIG_CONFIG
+KBUILD_CONFIG	?= .config
+export KBUILD_CONFIG
 
 # SHELL used by kbuild
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -484,6 +484,10 @@ ifeq ($(config-targets),1)
 include $(srctree)/arch/$(SRCARCH)/Makefile
 export KBUILD_DEFCONFIG KBUILD_KCONFIG
 
+# Prepare Kconfig environment
+KCONFIG_CONFIG    = $(KBUILD_CONFIG)
+export KCONFIG_CONFIG
+
 config: scripts_basic outputmakefile FORCE
 	$(Q)mkdir -p include/linux include/config
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
arch/arm/boot/compressed/Makefile +1 -1
index 0c74a6f..1891c0c 100644
@@ -154,5 +154,5 @@ CFLAGS_font.o := -Dstatic=
 $(obj)/font.c: $(FONTC)
 	$(call cmd,shipped)
 
-$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KCONFIG_CONFIG)
+$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile $(KBUILD_CONFIG)
 	@sed "$(SEDFLAGS)" < $< > $@
arch/unicore32/boot/compressed/Makefile +1 -1
index b0954a2..90a9841 100644
@@ -63,6 +63,6 @@ ZTEXTADDR	:= 0x03000000
 ZBSSADDR	:= ALIGN(4)
 
 SEDFLAGS_lds	= s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
-$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/unicore32/boot/Makefile $(KCONFIG_CONFIG)
+$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/unicore32/boot/Makefile $(KBUILD_CONFIG)
 	@sed "$(SEDFLAGS_lds)" < $< > $@
 
scripts/kconfig/Makefile +3 -0
index 82d2eb2..3fa5a65 100644
@@ -11,6 +11,9 @@ else
 Kconfig := Kconfig
 endif
 
+KCONFIG_CONFIG    ?= .config
+export KCONFIG_CONFIG
+
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
 
Signature · 1 line
1.7.6.153.g78432
#2 lore raw

Re: [PATCH 1/4] kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG

Quoted 15 lines · Arnaud Lacombe

Refine the Kbuild interface to expose it's own variable to architecture Makefile's and prepare Kconfig environment prior to any %config invocation.

---
 Makefile                                |    8 ++++++--
 arch/arm/boot/compressed/Makefile       |    2 +-
 arch/unicore32/boot/compressed/Makefile |    2 +-
 scripts/kconfig/Makefile                |    3 +++
 4 files changed, 11 insertions(+), 4 deletions(-)
Makefile +0 -0
index b4ca4e1..26798a4 100644

[...]

Makefile ifeq ($(config-targets),1) · line 489

Quoted 3 lines
Makefile +3 -0
+# Prepare Kconfig environment
+KCONFIG_CONFIG    = $(KBUILD_CONFIG)
+export KCONFIG_CONFIG

IMO we should preserve the semantics of KCONFIG_CONFIG as much as possible. make KCONFIG_CONFIG=blah works, but setting it in the environment does not, because the '=' assignment take precendence.

Michal

#3 lore raw

Re: [PATCH 1/4] kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG

Quoted 17 lines · Michal Marek
Quoted 15 lines · Arnaud Lacombe

Refine the Kbuild interface to expose it's own variable to architecture Makefile's and prepare Kconfig environment prior to any %config invocation.

---
 Makefile                                |    8 ++++++--
 arch/arm/boot/compressed/Makefile       |    2 +-
 arch/unicore32/boot/compressed/Makefile |    2 +-
 scripts/kconfig/Makefile                |    3 +++
 4 files changed, 11 insertions(+), 4 deletions(-)
Makefile +0 -0
index b4ca4e1..26798a4 100644

[...]

Quoted 7 lines

Makefile ifeq ($(config-targets),1) · line 489

Quoted 3 lines
Makefile +3 -0
+# Prepare Kconfig environment
+KCONFIG_CONFIG    = $(KBUILD_CONFIG)
+export KCONFIG_CONFIG

IMO we should preserve the semantics of KCONFIG_CONFIG as much as possible. make KCONFIG_CONFIG=blah works, but setting it in the environment does not, because the '=' assignment take precendence.

Also, please mention KBUILD_CONFIG variable in Documentation/kbuild/kconfig.txt. Or maybe Documentation/kbuild/kbuild.txt, I'm not sure what is the best fit now.

Michal

#4 lore raw

PATCH 2/4 kbuild: reduce kbuild invasivity within kconfig

In reply to Arnaud Lacombe

Introduce Kconfig' and KCONFIG_DEFCONFIG' as a Kconfig's interface to kbuild. These variable are set in the top-level Makefile, which remove reference to KBUILD_ prefixed variable within Kconfig makefile.

---
 Makefile                 |    8 ++++++--
 scripts/kconfig/Makefile |   14 +++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)
Makefile +6 -2
index 26798a4..e7b576e 100644
@@ -238,6 +238,9 @@ endif
 KBUILD_CONFIG	?= .config
 export KBUILD_CONFIG
 
+KBUILD_KCONFIG	?= Kconfig
+export KBUILD_KCONFIG
+
 # SHELL used by kbuild
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
@@ -482,11 +485,12 @@ ifeq ($(config-targets),1)
 # KBUILD_DEFCONFIG may point out an alternative default configuration
 # used for 'make defconfig'
 include $(srctree)/arch/$(SRCARCH)/Makefile
-export KBUILD_DEFCONFIG KBUILD_KCONFIG
 
 # Prepare Kconfig environment
+Kconfig           = $(KBUILD_KCONFIG)
 KCONFIG_CONFIG    = $(KBUILD_CONFIG)
-export KCONFIG_CONFIG
+KCONFIG_DEFCONFIG = $(KBUILD_DEFCONFIG)
+export Kconfig KCONFIG_CONFIG KCONFIG_DEFCONFIG
 
 config: scripts_basic outputmakefile FORCE
 	$(Q)mkdir -p include/linux include/config
scripts/kconfig/Makefile +5 -9
index 3fa5a65..dabb4f1 100644
@@ -5,13 +5,9 @@
 PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \
 	localmodconfig localyesconfig
 
-ifdef KBUILD_KCONFIG
-Kconfig := $(KBUILD_KCONFIG)
-else
-Kconfig := Kconfig
-endif
-
+Kconfig           ?= Kconfig
 KCONFIG_CONFIG    ?= .config
+KCONFIG_DEFCONFIG ?=
 export KCONFIG_CONFIG
 
 xconfig: $(obj)/qconf
@@ -113,11 +109,11 @@ savedefconfig: $(obj)/conf
 	$< --$@=defconfig $(Kconfig)
 
 defconfig: $(obj)/conf
-ifeq ($(KBUILD_DEFCONFIG),)
+ifeq ($(KCONFIG_DEFCONFIG),)
 	$< --defconfig $(Kconfig)
 else
-	@echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'"
-	$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig)
+	@echo "*** Default configuration is based on '$(KCONFIG_DEFCONFIG)'"
+	$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KCONFIG_DEFCONFIG) $(Kconfig)
 endif
 
 %_defconfig: $(obj)/conf
Signature · 1 line
1.7.6.153.g78432
#5 lore raw

PATCH 3/4 kbuild: do not hardcode .config

In reply to Arnaud Lacombe
---
 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index e7b576e..c36195a 100644
@@ -973,7 +973,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3
 prepare3: include/config/kernel.release
 ifneq ($(KBUILD_SRC),)
 	@$(kecho) '  Using $(srctree) as source for kernel'
-	$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
+	$(Q)if [ -f $(srctree)/$(KBUILD_CONFIG) -o -d $(srctree)/include/config ]; then \
 		echo "  $(srctree) is not clean, please run 'make mrproper'";\
 		echo "  in the '$(srctree)' directory.";\
 		/bin/false; \
@@ -1168,7 +1168,7 @@ CLEAN_FILES +=	vmlinux System.map \
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config usr/include include/generated          \
                   arch/*/include/generated
-MRPROPER_FILES += .config .config.old .version .old_version             \
+MRPROPER_FILES += $(KBUILD_CONFIG) $(KBUILD_CONFIG).old .version .old_version \
                   include/linux/version.h                               \
 		  Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
 
@@ -1295,7 +1295,7 @@ help:
 
 	@echo  '  make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
 	@echo  '  make V=2   [targets] 2 => give reason for rebuild of target'
-	@echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
+	@echo  '  make O=dir [targets] Locate all output files in "dir", including $(KBUILD_CONFIG)'
 	@echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
 	@echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
 	@echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
Signature · 1 line
1.7.6.153.g78432
#6 lore raw

PATCH 4/4 kconfig: do not hardcode .config

In reply to Arnaud Lacombe
---
 scripts/kconfig/Makefile |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
scripts/kconfig/Makefile +9 -7
index dabb4f1..a86924b 100644
@@ -10,6 +10,8 @@ KCONFIG_CONFIG    ?= .config
 KCONFIG_DEFCONFIG ?=
 export KCONFIG_CONFIG
 
+dot-config := $(KCONFIG_CONFIG)
+
 xconfig: $(obj)/qconf
 	$< $(Kconfig)
 
@@ -43,14 +45,14 @@ endif
 localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
 	$(Q)mkdir -p include/generated
 	$(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
-	$(Q)if [ -f .config ]; then 					\
-			cmp -s .tmp.config .config ||			\
-			(mv -f .config .config.old.1;			\
-			 mv -f .tmp.config .config;			\
+	$(Q)if [ -f $(dot-config) ]; then 					\
+			cmp -s .tmp.config .$(dot-config) ||			\
+			(mv -f $(dot-config) $(dot-config).old.1;		\
+			 mv -f .tmp.config $(dot-config);			\
 			 $(obj)/conf --silentoldconfig $(Kconfig);	\
-			 mv -f .config.old.1 .config.old)		\
+			 mv -f $(dot-config).old.1 $(dot-config).old)	\
 	else								\
-			mv -f .tmp.config .config;			\
+			mv -f .tmp.config $(dot-config);		\
 			$(obj)/conf --silentoldconfig $(Kconfig);	\
 	fi
 	$(Q)rm -f .tmp.config
@@ -126,7 +128,7 @@ help:
 	@echo  '  menuconfig	  - Update current config utilising a menu based program'
 	@echo  '  xconfig	  - Update current config utilising a QT based front-end'
 	@echo  '  gconfig	  - Update current config utilising a GTK based front-end'
-	@echo  '  oldconfig	  - Update current config utilising a provided .config as base'
+	@echo  '  oldconfig	  - Update current config utilising a provided $(dot-config) as base'
 	@echo  '  localmodconfig  - Update current config disabling modules not loaded'
 	@echo  '  localyesconfig  - Update current config converting local mods to core'
 	@echo  '  silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
Signature · 1 line
1.7.6.153.g78432
#7 lore raw
In reply to Arnaud Lacombe

Hi,

Quoted 11 lines · Arnaud Lacombe

Hi Michal,

The following small serie unexpose a few Kconfig variable from Kbuild, and vice-versa. The idea is that Kbuild is a user of Kconfig, not the other way around.

In the same time, fix a couple of place where we hardcode the `.config' string.

Comments Welcome !
 - Arnaud

ping ?

- Arnaud

Quoted 16 lines

Arnaud Lacombe (4):
 kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG
 kbuild: reduce kbuild invasivity within kconfig
 kbuild: do not hardcode .config
 kconfig: do not hardcode .config

 Makefile                                |   20 ++++++++++++++------ arch/arm/boot/compressed/Makefile       |    2 +- arch/unicore32/boot/compressed/Makefile |    2 +- scripts/kconfig/Makefile                |   31 ++++++++++++++++---------------

 4 files changed, 32 insertions(+), 23 deletions(-)

--
1.7.6.153.g78432

#8 lore raw

Hi,

Quoted 9 lines · Arnaud Lacombe

Hi,

Quoted 6 lines · Arnaud Lacombe

Hi Michal,

The following small serie unexpose a few Kconfig variable from Kbuild, and vice-versa. The idea is that Kbuild is a user of Kconfig, not the other way around.

Quoted 7 lines
Quoted 5 lines

In the same time, fix a couple of place where we hardcode the `.config' string.

Comments Welcome !
 - Arnaud

ping ?

ping^2 ?

- Arnaud

Quoted 19 lines

 - Arnaud

Quoted 16 lines

Arnaud Lacombe (4):
 kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG
 kbuild: reduce kbuild invasivity within kconfig
 kbuild: do not hardcode .config
 kconfig: do not hardcode .config

 Makefile                                |   20 ++++++++++++++------ arch/arm/boot/compressed/Makefile       |    2 +- arch/unicore32/boot/compressed/Makefile |    2 +- scripts/kconfig/Makefile                |   31 ++++++++++++++++---------------

 4 files changed, 32 insertions(+), 23 deletions(-)

--
1.7.6.153.g78432

#9 lore raw

Hi,

Quoted 12 lines · Arnaud Lacombe

Hi,

Quoted 9 lines · Arnaud Lacombe

Hi,

Quoted 6 lines · Arnaud Lacombe

Hi Michal,

The following small serie unexpose a few Kconfig variable from Kbuild, and vice-versa. The idea is that Kbuild is a user of Kconfig, not the other way around.

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

In the same time, fix a couple of place where we hardcode the `.config' string.

Comments Welcome !
 - Arnaud

ping ?

ping^2 ?

ping^3 ?

- Arnaud

Quoted 22 lines

 - Arnaud

Quoted 19 lines

 - Arnaud

Quoted 16 lines

Arnaud Lacombe (4):
 kbuild: introduce KBUILD_CONFIG; unexpose KCONFIG_CONFIG
 kbuild: reduce kbuild invasivity within kconfig
 kbuild: do not hardcode .config
 kconfig: do not hardcode .config

 Makefile                                |   20 ++++++++++++++------ arch/arm/boot/compressed/Makefile       |    2 +- arch/unicore32/boot/compressed/Makefile |    2 +- scripts/kconfig/Makefile                |   31 ++++++++++++++++---------------

 4 files changed, 32 insertions(+), 23 deletions(-)

--
1.7.6.153.g78432