Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18F4C243956 for ; Sun, 7 Dec 2025 20:37:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765139863; cv=none; b=YCmTXur48L386PBOP842SXJIyXXh5u5cs/7bxohGaibzgWs2G9+dpGDvnpgXf4U5On5tr7ixDpWTGo926dW+55kT7xREbcOUkS3xSYlqJbHaZxt73zsMQGQiLEVeOMWdGgrqgkXrD0VFWH9V4VAchJZciBCBmz4GLuppLbOR2ao= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765139863; c=relaxed/simple; bh=fChEkwcb2xpUdsfWBvOIA+/IjbsEmvsrp0S9SV37bmw=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=DxfFqkfkym6ff4+Q/OUgDOYvh8a28XH+gniQjoCS+yGdn1/JQnjAgQkkDMfY7kZExsITa/HYVRqkpXhtCvt782NUh72lYzbDX2wEgyKJIpU/AXwFmSEqHZLDNpzZUyyOQdnPRzqMpQUfatGrPihhKOvLHBkZ17tCMxQd2zvYx60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EpPyrA2r; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EpPyrA2r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8ECCC4CEFB; Sun, 7 Dec 2025 20:37:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765139862; bh=fChEkwcb2xpUdsfWBvOIA+/IjbsEmvsrp0S9SV37bmw=; h=Date:Reply-To:Subject:To:References:From:In-Reply-To:From; b=EpPyrA2r6D55ypo57I1ia+LJjw9SWPgvPh6MELkPdn4UMT/raCigYSN0uycVmwTI/ TQieBb1wDjSi7TedaEq9YJpOVvGYjVedBtGdo+pBsCwCv2sRzEbX52HvnYlMmmgjIG Hdqgw2oml+YCQbUg/qKxM1UCBpdNGeRbkpdQLrrM5f1ffdrxOsk0ywkPsugS85jBOW akM2DWBJ+RWcYsytXX5x2C/ju7WcA7D9cTniEBwMwv/K1fwYO92QKgrDloHpGwjgPX RbyjW/Sl5n3IDBpvMFSL0OpZc8/58yNYx/sOs3isMILN4B2kbmw7blUTe6r31ZwF7L gPf/mKto5owOg== Message-ID: Date: Sun, 7 Dec 2025 21:37:39 +0100 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: Daniel Gomez Subject: Re: [PATCH 5/8] kconfig: Add support for merging defconfig fragments To: Luis Chamberlain , Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev References: <20251206165624.2640158-1-mcgrof@kernel.org> <20251206165624.2640158-6-mcgrof@kernel.org> Content-Language: en-US From: Daniel Gomez Organization: kernel.org In-Reply-To: <20251206165624.2640158-6-mcgrof@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 06/12/2025 17.56, Luis Chamberlain wrote: > Add support for composing defconfigs from base configurations and > fragments using the + syntax. This allows users to combine a base > defconfig with additional config fragments stored in defconfigs/configs/. > > The merge_config.sh script from the kernel is used to combine the > configurations. Multiple fragments can be chained together. > > Example usage: > make defconfig-datacrunch-b200-or-less+myworkflow > make defconfig-aws+fstests+debug > > This enables modular configuration management where common settings > can be shared across different base configurations. As a user of fragments for both kernel and kdevops, I think this is handy for upstream kernel too. The only difference in the way I use fragments is that for kernel configs I always start from scratch while for kdevops I always start with a defconfig. My kernel config step starts with: ./scripts/kconfig/merge_config.sh \ -n \ .config \ fragment1.config fragment2.config make -j$(nproc) For kdevops I always do: make defconfig- ./scripts/kconfig/merge_config.sh \ -n \ .config \ fragment1.config fragment2.config Not sure if users could simply do: make +fragment1+fragment2 > > Generated-by: Claude AI > Signed-off-by: Luis Chamberlain > --- > scripts/kconfig/kconfig.Makefile | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/scripts/kconfig/kconfig.Makefile b/scripts/kconfig/kconfig.Makefile > index 5d6db4b8..0113ffd3 100644 > --- a/scripts/kconfig/kconfig.Makefile > +++ b/scripts/kconfig/kconfig.Makefile > @@ -57,7 +57,25 @@ PHONY += $(simple-targets) > $(simple-targets): $(KCONFIG_DIR)/conf Kconfig > $< --$@ Kconfig > > +# Support merging config fragments with base defconfigs > +# Usage: make defconfig-+ > +# Example: make defconfig-datacrunch-b200-or-less+myworkflow > +# > +# The fragment is looked up in defconfigs/configs/.config > +# Multiple fragments can be chained: make defconfig-base+frag1+frag2 > defconfig-%:: $(KCONFIG_DIR)/conf include/config/project.release Kconfig > - @$< --defconfig=defconfigs/$(@:defconfig-%=%) Kconfig > + @STEM="$(@:defconfig-%=%)"; \ > + if echo "$$STEM" | grep -q '+'; then \ > + BASE=$$(echo "$$STEM" | cut -d'+' -f1); \ > + FRAGS=$$(echo "$$STEM" | cut -d'+' -f2- | tr '+' ' '); \ > + FRAG_FILES=""; \ > + for f in $$FRAGS; do \ > + FRAG_FILES="$$FRAG_FILES defconfigs/configs/$$f.config"; \ > + done; \ > + $(KCONFIG_DIR)/merge_config.sh -m -Q defconfigs/$$BASE $$FRAG_FILES && \ > + $< --defconfig=.config Kconfig; \ This command only merges/combines the fragments into the target .config. -m only merge the fragments, do not execute the make command I normally run it with -n (see above) to validate the final .config with allnoconfig: -n use allnoconfig instead of alldefconfig I think we need here too. Or why is not needed in this case? It would also be useful to support out-of-tree configs. For example, I keep some for PCIe passthrough devices and workflow setups with device-specific names, along with a few other local (not generic) settings. > + else \ > + $< --defconfig=defconfigs/$$STEM Kconfig; \ > + fi > > .PHONY: $(PHONY)