Makefile: Support merged and nested defconfigs.
cover Makefile: Support merged and nested defconfigs.
This is a combination and cleanup of the previous efforts by Sam Bobroff and Elizabeth Liner to introduce merged defconfigs and nested defconfig directories respectively.
Merged defconfigs allow us to create defconfig snippets for aspects that are common across multiple machines and create a combined defconfig from the snippets. The support scripts for merged kernel defconfigs is reused.
Nested defconfig directories allow us to organize the defconfig directory into sub-directories. A likely use for this is to place defconfigs into architecture-specific subdirectories.
Elizabeth Liner (1):
Makefile: Support nested config directories
Patrick Williams (4):
Makefile: Generate %_defconfig recipes from macro.
Makefile: Add nested config dirs to list-defconfigs
Makefile: Add merged defconfigs to list-defconfigs.
Makefile: Fix merge defconfig clobber of .config.old
Sam Bobroff (1):
Makefile: Support merged defconfigs
Makefile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
Signature · 1 line
2.6.3
PATCH 1/6 Makefile: Support merged defconfigs
From: Sam Bobroff <[email protected]>
Within the Linux kernel, and several other packages, it's currently possible to maintain defconfigs as diffs (fragments) against other configs but this is not possible with buildroot itself.
This patch adds the capability, although using a slightly different implementation. Files may be added in the normal config directories ($TOPDIR/configs or $BR2_EXTERNAL/configs) with the format "xxx_defconfig.merge" that contain, one per line, the files to be passed to merge_config.sh to create the matching xxx_defconfig file (the first line should contain the base config followed by the fragments). The generated defconfig file is then handled as it would normally be.
--- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+)
Makefile +10 -0
@@ -848,6 +848,16 @@ defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \ $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN) +%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig.merge outputmakefile + @cd $(TOPDIR)/configs && xargs -a [email protected] -x -P 1 $(TOPDIR)/support/kconfig/merge_config.sh -m -O $(CONFIG_DIR) + @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(CONFIG_DIR)/.config \ + $< --defconfig=$(CONFIG_DIR)/.config $(CONFIG_CONFIG_IN) + +%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig.merge outputmakefile + @cd $(BR2_EXTERNAL)/configs && xargs -a [email protected] -x -P 1 $(TOPDIR)/support/kconfig/merge_config.sh -m -O $(CONFIG_DIR) + @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(CONFIG_DIR)/.config \ + $< --defconfig=$(CONFIG_DIR)/.config $(CONFIG_CONFIG_IN) + savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @$(COMMON_CONFIG_ENV) $< \ --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
Signature · 1 line
2.6.3
PATCH 2/6 Makefile: Generate %_defconfig recipes from macro.
In reply to Patrick WilliamsTo reduce duplication in the %_defconfig recipes with $(TOPDIR) and $(BR2_EXTERNAL) versions, generate these from a macro. The macro is now called on a list of directories containing the appropriate ones.
--- Makefile | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
Makefile +13 -17
@@ -840,23 +840,19 @@ defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN) # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(TOPDIR)/configs/$@ \ - $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN) - -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig outputmakefile - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(BR2_EXTERNAL)/configs/$@ \ - $< --defconfig=$(BR2_EXTERNAL)/configs/$@ $(CONFIG_CONFIG_IN) - -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig.merge outputmakefile - @cd $(TOPDIR)/configs && xargs -a [email protected] -x -P 1 $(TOPDIR)/support/kconfig/merge_config.sh -m -O $(CONFIG_DIR) - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(CONFIG_DIR)/.config \ - $< --defconfig=$(CONFIG_DIR)/.config $(CONFIG_CONFIG_IN) - -%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(BR2_EXTERNAL)/configs/%_defconfig.merge outputmakefile - @cd $(BR2_EXTERNAL)/configs && xargs -a [email protected] -x -P 1 $(TOPDIR)/support/kconfig/merge_config.sh -m -O $(CONFIG_DIR) - @$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(CONFIG_DIR)/.config \ - $< --defconfig=$(CONFIG_DIR)/.config $(CONFIG_CONFIG_IN) +define CREATE_DEFCONFIG_RECIPES +%_defconfig: $$(BUILD_DIR)/buildroot-config/conf $1/%_defconfig outputmakefile + @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(TOPDIR)/configs/$$@ \ + $$< --defconfig=$1/$$@ $$(CONFIG_CONFIG_IN) + +%_defconfig: $$(BUILD_DIR)/buildroot-config/conf $1/%_defconfig.merge outputmakefile + @cd $1 && xargs -a [email protected] -x -P 1 $$(TOPDIR)/support/kconfig/merge_config.sh -m -O $$(CONFIG_DIR) + @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(CONFIG_DIR)/.config \ + $$< --defconfig=$$(CONFIG_DIR)/.config $$(CONFIG_CONFIG_IN) +endef + +BR2_DEFCONFIG_PATHS=$(TOPDIR)/configs $(BR2_EXTERNAL)/configs +$(foreach path,$(BR2_DEFCONFIG_PATHS),$(eval $(call CREATE_DEFCONFIG_RECIPES,$(path)))) savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile @$(COMMON_CONFIG_ENV) $< \
Signature · 1 line
2.6.3
PATCH 3/6 Makefile: Support nested config directories
In reply to Patrick WilliamsFrom: Elizabeth Liner <[email protected]>
Extend the BR2_DEFCONFIG_PATH to support nested config directories. This allows us to place config files in both .../config and .../config/<arch>.
Both $(TOPDIR) and $(BR2_EXTERNAL) are supported.
--- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
@@ -851,7 +851,8 @@ define CREATE_DEFCONFIG_RECIPES $$< --defconfig=$$(CONFIG_DIR)/.config $$(CONFIG_CONFIG_IN) endef -BR2_DEFCONFIG_PATHS=$(TOPDIR)/configs $(BR2_EXTERNAL)/configs +BR2_DEFCONFIG_PATHS=$(sort $(dir $(wildcard $(TOPDIR)/configs/*/))) \ + $(sort $(dir $(wildcard $(BR2_EXTERNAL)/configs/*/))) $(foreach path,$(BR2_DEFCONFIG_PATHS),$(eval $(call CREATE_DEFCONFIG_RECIPES,$(path)))) savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
Signature · 1 line
2.6.3
PATCH 4/6 Makefile: Add nested config dirs to list-defconfigs
In reply to Patrick Williams--- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Makefile +6 -4
@@ -201,6 +201,10 @@ LEGAL_LICENSES_TXT_HOST = $(LEGAL_INFO_DIR)/host-licenses.txt LEGAL_WARNINGS = $(LEGAL_INFO_DIR)/.warnings LEGAL_REPORT = $(LEGAL_INFO_DIR)/README +BR2_DEFCONFIG_PATHS_LOCAL=$(sort $(dir $(wildcard $(TOPDIR)/configs/*/))) +BR2_DEFCONFIG_PATHS_USER=$(sort $(dir $(wildcard $(BR2_EXTERNAL)/configs/*/))) +BR2_DEFCONFIG_PATHS=$(BR2_DEFCONFIG_PATHS_LOCAL) $(BR2_DEFCONFIG_PATHS_USER) + BR2_CONFIG = $(CONFIG_DIR)/.config # Pull in the user's configuration file
@@ -851,8 +855,6 @@ define CREATE_DEFCONFIG_RECIPES $$< --defconfig=$$(CONFIG_DIR)/.config $$(CONFIG_CONFIG_IN) endef -BR2_DEFCONFIG_PATHS=$(sort $(dir $(wildcard $(TOPDIR)/configs/*/))) \ - $(sort $(dir $(wildcard $(BR2_EXTERNAL)/configs/*/))) $(foreach path,$(BR2_DEFCONFIG_PATHS),$(eval $(call CREATE_DEFCONFIG_RECIPES,$(path)))) savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
@@ -986,12 +988,12 @@ endif list-defconfigs: @echo 'Built-in configs:' - @$(foreach b, $(sort $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig))), \ + @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_LOCAL),$(wildcard $(path)/*_defconfig)))), \ printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),) @echo @echo 'User-provided configs:' - @$(foreach b, $(sort $(notdir $(wildcard $(BR2_EXTERNAL)/configs/*_defconfig))), \ + @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_USER),$(wildcard $(path)/*_defconfig)))), \ printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) endif @echo
Signature · 1 line
2.6.3
PATCH 5/6 Makefile: Add merged defconfigs to list-defconfigs.
In reply to Patrick Williams--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -988,12 +988,12 @@ endif list-defconfigs: @echo 'Built-in configs:' - @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_LOCAL),$(wildcard $(path)/*_defconfig)))), \ + @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_LOCAL),$(basename $(wildcard $(path)/*_defconfig $(path)/*_defconfig.merge))))), \ printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) ifneq ($(wildcard $(BR2_EXTERNAL)/configs/*_defconfig),) @echo @echo 'User-provided configs:' - @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_USER),$(wildcard $(path)/*_defconfig)))), \ + @$(foreach b, $(sort $(notdir $(foreach path,$(BR2_DEFCONFIG_PATHS_USER),$(basename $(wildcard $(path)/*_defconfig $(path)/*_defconfig.merge))))), \ printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) endif @echo
Signature · 1 line
2.6.3
PATCH 6/6 Makefile: Fix merge defconfig clobber of .config.old
In reply to Patrick WilliamsThe merged defconfig support was using .config as a temporary file to store the merged defconfig. The result of then running the 'conf' tool is that .config.old contains the contents of the merged defconfig instead of the actual old .config.
Place the temporary merged defconfig into $(CONFIG_DIR)/.merge_config instead to prevent this clobbering.
--- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Makefile +5 -3
@@ -850,9 +850,11 @@ define CREATE_DEFCONFIG_RECIPES $$< --defconfig=$1/$$@ $$(CONFIG_CONFIG_IN) %_defconfig: $$(BUILD_DIR)/buildroot-config/conf $1/%_defconfig.merge outputmakefile - @cd $1 && xargs -a [email protected] -x -P 1 $$(TOPDIR)/support/kconfig/merge_config.sh -m -O $$(CONFIG_DIR) - @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(CONFIG_DIR)/.config \ - $$< --defconfig=$$(CONFIG_DIR)/.config $$(CONFIG_CONFIG_IN) + @mkdir $$(CONFIG_DIR)/.merge_config + @cd $1 && xargs -a [email protected] -x -P 1 $$(TOPDIR)/support/kconfig/merge_config.sh -m -O $$(CONFIG_DIR)/.merge_config + @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$$(CONFIG_DIR)/.merge_config/.config \ + $$< --defconfig=$$(CONFIG_DIR)/.merge_config/.config $$(CONFIG_CONFIG_IN) + @rm -rf $$(CONFIG_DIR)/.merge_config endef $(foreach path,$(BR2_DEFCONFIG_PATHS),$(eval $(call CREATE_DEFCONFIG_RECIPES,$(path))))
Signature · 1 line
2.6.3
cover Makefile: Support merged and nested defconfigs.
In reply to Patrick WilliamsQuoted 22 lines · Patrick Williams
This is a combination and cleanup of the previous efforts by Sam Bobroff and Elizabeth Liner to introduce merged defconfigs and nested defconfig directories respectively.
Merged defconfigs allow us to create defconfig snippets for aspects that are common across multiple machines and create a combined defconfig from the snippets. The support scripts for merged kernel defconfigs is reused.
Nested defconfig directories allow us to organize the defconfig directory into sub-directories. A likely use for this is to place defconfigs into architecture-specific subdirectories.
Elizabeth Liner (1):
Makefile: Support nested config directoriesPatrick Williams (4):
Makefile: Generate %_defconfig recipes from macro.
Makefile: Add nested config dirs to list-defconfigs
Makefile: Add merged defconfigs to list-defconfigs.
Makefile: Fix merge defconfig clobber of .config.old
Quoted 5 lines
Sam Bobroff (1):
Makefile: Support merged defconfigsMakefile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
Quoted 9 lines
Signature · 8 lines
-- 2.6.3 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
cover Makefile: Support merged and nested defconfigs.
In reply to Patrick WilliamsAny feedback on this patch set?
Quoted 31 lines · Patrick Williams
This is a combination and cleanup of the previous efforts by Sam Bobroff and Elizabeth Liner to introduce merged defconfigs and nested defconfig directories respectively.
Merged defconfigs allow us to create defconfig snippets for aspects that are common across multiple machines and create a combined defconfig from the snippets. The support scripts for merged kernel defconfigs is reused.
Nested defconfig directories allow us to organize the defconfig directory into sub-directories. A likely use for this is to place defconfigs into architecture-specific subdirectories.
Elizabeth Liner (1):
Makefile: Support nested config directoriesPatrick Williams (4):
Makefile: Generate %_defconfig recipes from macro.
Makefile: Add nested config dirs to list-defconfigs
Makefile: Add merged defconfigs to list-defconfigs.
Makefile: Fix merge defconfig clobber of .config.oldSam Bobroff (1):
Makefile: Support merged defconfigsMakefile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)Signature · 1 line
2.6.3
Signature · 8 lines
Patrick Williams -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160524/3382ea7d/attachment.asc>