From patchwork Fri Mar 28 20:56:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032435 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 888E33C0C for ; Fri, 28 Mar 2025 20:56:32 +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=1743195392; cv=none; b=gGYzX6SnqmJHdaWjIIbWbVKRSbAcN6lWLe/e37que3ka2u3kztDGh6QBUJP0aSSsVUtwd8LwiahBoyZNHb8pIKexek6obORZWLQ2x1WeirLG9EkaxkC+mc/Yva1pjVO0riaPrcCtHHHftGhqbB2y1xizjiHn87eHyhl9G5l4yTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195392; c=relaxed/simple; bh=FP/yr/n/Y5witxqnJlyrfXTCWn/YLFWyt9r22JRTsLg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sdpqOcwUBEdlPLfEyR1LlEX+ogr7Z/HbONB/MVHvre+RR4SqUWvfH16X3F7xSTK1zra8b6nSs1G+iPgJ42vCuFDqt72pwfhbOPmOkssRO1tTCFN6PYPgcasALJc2aZ3eZ/InL2rcYDJTDBLRRfpPkCL+5rcZOixzcpBg0rvncq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZhYROk15; 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="ZhYROk15" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C4CC4CEE8; Fri, 28 Mar 2025 20:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195392; bh=FP/yr/n/Y5witxqnJlyrfXTCWn/YLFWyt9r22JRTsLg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZhYROk15QdoLruBiI7LuvLC3n2r9VawygqiRKV/aXvR1S3d+/wT97mnkHol6QQLI1 4IjpvDUSU5zJp+7o+R3BtLEf+t+Dr49ec2rT06x7SBRkQcHWex7S7li32Ldave8gd5 05Je0VRez2NTZYGFxSz06CNKPEa2qNnG5MVDsLKPXEJdnISFQfeQ1bazJDcve1u+eS M5jwHFeLgHZdHQ8nWH+cQe7z2+mdtFvXf+hnD1EK7tnOvbUPb63f5c90yeWb4ksjGM EsF5iy6GmY/6h1Mg0hTMeCgVqBqGFD8wmLlJ0EMUNjlRgltOE8GQGMJqjNh0PyzJ8N byCQfC57zvbZg== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:14 +0000 Subject: [PATCH RFC 1/6] merge_config: add fragment support from kernel Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-1-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez Add merge_config.sh script support from upstream Linux kernel. This allows to use fragments in kdevops. Example: A fragment to enable fstests is called fstests.config. To enable it while keeping the same config, we can simply do: ./scripts/kconfig/merge_config.sh -m .config fstests.config make olddefconfig Signed-off-by: Daniel Gomez --- scripts/kconfig/merge_config.sh | 213 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh new file mode 100755 index 0000000000000000000000000000000000000000..ad35a60de350ae1c5b60d39bf752115d27276f52 --- /dev/null +++ b/scripts/kconfig/merge_config.sh @@ -0,0 +1,213 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# merge_config.sh - Takes a list of config fragment values, and merges +# them one by one. Provides warnings on overridden values, and specified +# values that did not make it to the resulting .config file (due to missed +# dependencies or config symbol removal). +# +# Portions reused from kconf_check and generate_cfg: +# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check +# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg +# +# Copyright (c) 2009-2010 Wind River Systems, Inc. +# Copyright 2011 Linaro + +set -e + +clean_up() { + rm -f $TMP_FILE + rm -f $MERGE_FILE +} + +usage() { + echo "Usage: $0 [OPTIONS] [CONFIG [...]]" + echo " -h display this help text" + echo " -m only merge the fragments, do not execute the make command" + echo " -n use allnoconfig instead of alldefconfig" + echo " -r list redundant entries when merging fragments" + echo " -y make builtin have precedence over modules" + echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." + echo " -s strict mode. Fail if the fragment redefines any value." + echo " -Q disable warning messages for overridden options." + echo + echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." +} + +RUNMAKE=true +ALLTARGET=alldefconfig +WARNREDUN=false +BUILTIN=false +OUTPUT=. +STRICT=false +CONFIG_PREFIX=${CONFIG_-CONFIG_} +WARNOVERRIDE=echo + +while true; do + case $1 in + "-n") + ALLTARGET=allnoconfig + shift + continue + ;; + "-m") + RUNMAKE=false + shift + continue + ;; + "-h") + usage + exit + ;; + "-r") + WARNREDUN=true + shift + continue + ;; + "-y") + BUILTIN=true + shift + continue + ;; + "-O") + if [ -d $2 ];then + OUTPUT=$(echo $2 | sed 's/\/*$//') + else + echo "output directory $2 does not exist" 1>&2 + exit 1 + fi + shift 2 + continue + ;; + "-s") + STRICT=true + shift + continue + ;; + "-Q") + WARNOVERRIDE=true + shift + continue + ;; + *) + break + ;; + esac +done + +if [ "$#" -lt 1 ] ; then + usage + exit +fi + +if [ -z "$KCONFIG_CONFIG" ]; then + if [ "$OUTPUT" != . ]; then + KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config") + else + KCONFIG_CONFIG=.config + fi +fi + +INITFILE=$1 +shift; + +if [ ! -r "$INITFILE" ]; then + echo "The base file '$INITFILE' does not exist. Creating one..." >&2 + touch $INITFILE +fi + +MERGE_LIST=$* +SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" +SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" + +TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) +MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX) + +echo "Using $INITFILE as base" + +trap clean_up EXIT + +cat $INITFILE > $TMP_FILE + +# Merge files, printing warnings on overridden values +for ORIG_MERGE_FILE in $MERGE_LIST ; do + echo "Merging $ORIG_MERGE_FILE" + if [ ! -r "$ORIG_MERGE_FILE" ]; then + echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2 + exit 1 + fi + cat $ORIG_MERGE_FILE > $MERGE_FILE + CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) + + for CFG in $CFG_LIST ; do + grep -q -w $CFG $TMP_FILE || continue + PREV_VAL=$(grep -w $CFG $TMP_FILE) + NEW_VAL=$(grep -w $CFG $MERGE_FILE) + BUILTIN_FLAG=false + if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then + ${WARNOVERRIDE} Previous value: $PREV_VAL + ${WARNOVERRIDE} New value: $NEW_VAL + ${WARNOVERRIDE} -y passed, will not demote y to m + ${WARNOVERRIDE} + BUILTIN_FLAG=true + elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then + ${WARNOVERRIDE} Value of $CFG is redefined by fragment $ORIG_MERGE_FILE: + ${WARNOVERRIDE} Previous value: $PREV_VAL + ${WARNOVERRIDE} New value: $NEW_VAL + ${WARNOVERRIDE} + if [ "$STRICT" = "true" ]; then + STRICT_MODE_VIOLATED=true + fi + elif [ "$WARNREDUN" = "true" ]; then + ${WARNOVERRIDE} Value of $CFG is redundant by fragment $ORIG_MERGE_FILE: + fi + if [ "$BUILTIN_FLAG" = "false" ]; then + sed -i "/$CFG[ =]/d" $TMP_FILE + else + sed -i "/$CFG[ =]/d" $MERGE_FILE + fi + done + # In case the previous file lacks a new line at the end + echo >> $TMP_FILE + cat $MERGE_FILE >> $TMP_FILE +done + +if [ "$STRICT_MODE_VIOLATED" = "true" ]; then + echo "The fragment redefined a value and strict mode had been passed." + exit 1 +fi + +if [ "$RUNMAKE" = "false" ]; then + cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG" + echo "#" + echo "# merged configuration written to $KCONFIG_CONFIG (needs make)" + echo "#" + exit +fi + +# If we have an output dir, setup the O= argument, otherwise leave +# it blank, since O=. will create an unnecessary ./source softlink +OUTPUT_ARG="" +if [ "$OUTPUT" != "." ] ; then + OUTPUT_ARG="O=$OUTPUT" +fi + + +# Use the merged file as the starting point for: +# alldefconfig: Fills in any missing symbols with Kconfig default +# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set +make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET + + +# Check all specified config values took (might have missed-dependency issues) +for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do + + REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) + ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG" || true) + if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then + echo "Value requested for $CFG not in final .config" + echo "Requested value: $REQUESTED_VAL" + echo "Actual value: $ACTUAL_VAL" + echo "" + fi +done From patchwork Fri Mar 28 20:56:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032436 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 BCEAA3C0C for ; Fri, 28 Mar 2025 20:56:33 +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=1743195393; cv=none; b=Zm2XhXxwcSUHiouFPeRmX+0krmQMKTOx7QYKfBDm++MhWVBRJkGEwj2GQuFSvr4Y2uVlQ+zao7hz9/d+j/ecyBmsORPsiBjx/NwE29Ac93JGUjOEqHQhUolypQWfu1dNPRWEtfxw4YLQd+ZaVJhS10hNya0eJnljM0lRMWhy5+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195393; c=relaxed/simple; bh=/yRuVlMJJvZTjFdJdUrgNhLMFHHQ3djFIcR5s8Wdmyk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LGPow9hj/B89GOyS6TtlBYNum6ufc4bzmJ7WMT/G4rRWb9uct18LIhgYsDJc31itJp3QyZpZVIFGhXr/f4DfgQFF3LIss/qnKgIXIgNPgK5Ac3HYy4+n8LwdmTOlwfdSjIEk68DTImvgUgtWcyBPSY+KubSU8ZKTWBSTpIbiuNA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gQAbQTdE; 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="gQAbQTdE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE73C4CEE9; Fri, 28 Mar 2025 20:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195393; bh=/yRuVlMJJvZTjFdJdUrgNhLMFHHQ3djFIcR5s8Wdmyk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gQAbQTdE0pplqAX7Jn01tRNgLIiHSlCs2/gkGPGs+2875olQ1YGSXM3jZsdeb5tZm Gf58rd1iwrUEJDcjdUWRVY9NaID0TvbLkqqsjag/pQZnB50CTgggphLoT/hLEofwb6 Q4Q0ci2zjh90kCGR26G6tPpqk8wAnqrF9Cd8wWeghw1ISnbbIHOsVzQgmgHniGACrS 19n7J43tg8LgJjjK9hrHKw756scu5hKvt10wNcffCeyAcy5GrBiR3y7OKLkYcb4O4b FJ/kweQHmqbLh8toUhsu+lY9s8CsdhimjmQScaqBFiAYlTJUisL4qO7g5VH6VzJIRk lYkT6TI8+Rr/g== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:15 +0000 Subject: [PATCH RFC 2/6] scripts/kconfig/kconfig.Makefile: extend simple-targets Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-2-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez Add oldconfig and olddefconfig targets. Signed-off-by: Daniel Gomez --- scripts/kconfig/Makefile | 3 +++ scripts/kconfig/kconfig.Makefile | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index e3694365bf98281a00fb56d76d3400d236776476..7cef3498e4c9e751c05190fb3da7507587d9ad84 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -69,6 +69,9 @@ help: @echo "allyesconfig - enables all bells and whistles" @echo "allnoconfig - disables all bells and whistles" @echo "randconfig - random configuration" + @echo "oldconfig - update a configuration using provided .config as base" + @echo "olddefconfig - Same as oldconfig but sets new symbosl to their default" + @echo "defconfig-* - If you have files in the defconfig directory use default config from there" .PHONY: clean diff --git a/scripts/kconfig/kconfig.Makefile b/scripts/kconfig/kconfig.Makefile index e227ea4233a7e790e90f38c1817c745a0c805132..cc24c7ff3e1c23487aec767075c69fdf3876b39d 100644 --- a/scripts/kconfig/kconfig.Makefile +++ b/scripts/kconfig/kconfig.Makefile @@ -51,7 +51,7 @@ $(KCONFIG_DIR)/conf: # More are supported, however we only list the ones tested on this top # level Makefile. -simple-targets := allnoconfig allyesconfig alldefconfig randconfig +simple-targets := allnoconfig allyesconfig alldefconfig randconfig oldconfig olddefconfig PHONY += $(simple-targets) $(simple-targets): $(KCONFIG_DIR)/conf Kconfig From patchwork Fri Mar 28 20:56:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032437 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 EC4163C0C for ; Fri, 28 Mar 2025 20:56:34 +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=1743195395; cv=none; b=LoGDLlHk9kC7HvupwSIbzhexU11EC76Jap9ZX084WbX+7L7w519Hprw4j4zsWEKyct+RUWcwDBsslbjFUmlocAm6KfAfDzIpFvJBAYCsQ2C4Fz5i7SEHU4Tfx4j66ZtM6cguqcDUWa8FK9mj/j3gGIbkpcAojePV7PY3JChIp84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195395; c=relaxed/simple; bh=h4MMV21iNBgqUSXQMHwNNhmF/xVNGhsVhmke4ODEvVI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kbb9qMc6/DmTEwGpGWpiXzJ/C0pJL7rw7Gj3YinF1MxuMoIkyH5yTWbFB2K1K+27Jm0yHsQaKIOpoKu1ZGfBaukoUAAMXjRh+WvY3eWjzIxn9Q/B5TbDQD4r/RoUVMfgp+I5M19bXAPo9/Dyz7FnywlJ/+MZcK6gF77K2nftHkg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aReqp+uN; 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="aReqp+uN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0916C4CEE8; Fri, 28 Mar 2025 20:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195394; bh=h4MMV21iNBgqUSXQMHwNNhmF/xVNGhsVhmke4ODEvVI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=aReqp+uNojxwL9R2mu4FeLUuYik9TNG6UGax+Y+ezLRjrNRVa6Fqo7H2O4/M44CJQ S2ksOGmlGJgFk3m+aI+XzwSyOhjZ3lS1NlUyX+EHE8dKJd8KdcytUZPiG5n7nGja7N NiOT7uRfbKz5o3cbXnV+2lrHCvVJ4lhdlLqrrIJPgRWThp6pAOqH1GFMjP/BKSDx97 p1jm0rB9GTcSPodm936cGAdhb5hDlu0VIw28gtgP6dYtf2zVuIMY6+v1EF52HuL50C Ff0sCb8u/yaHu7yz8oMEjj4t0VOsn2sF8YMZOdWZ+NcQYKlTWiE34vPdZpNMfoRKzm EtMze+2ulyxhQ== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:16 +0000 Subject: [PATCH RFC 3/6] kconfig-fragments: add docs and fragments folder Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-3-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez Add configs/ directory to hold kdevops fragments. Add docs/kconfig-fragments explaining the fragment workflow. Signed-off-by: Daniel Gomez --- configs/callback-debug.config | 2 ++ configs/callback-dense.config | 2 ++ docs/kconfig-fragments.md | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/configs/callback-debug.config b/configs/callback-debug.config new file mode 100644 index 0000000000000000000000000000000000000000..880da5fcb4ec60a7ee04490f21ea2a7efa240926 --- /dev/null +++ b/configs/callback-debug.config @@ -0,0 +1,2 @@ +CONFIG_ANSIBLE_CFG_CALLBACK_PLUGIN_DENSE=n +CONFIG_ANSIBLE_CFG_CALLBACK_PLUGIN_DEBUG=y diff --git a/configs/callback-dense.config b/configs/callback-dense.config new file mode 100644 index 0000000000000000000000000000000000000000..c59925c4bd30634633be322c9e3b24bb91d2d25b --- /dev/null +++ b/configs/callback-dense.config @@ -0,0 +1,2 @@ +CONFIG_ANSIBLE_CFG_CALLBACK_PLUGIN_DENSE=y +CONFIG_ANSIBLE_CFG_CALLBACK_PLUGIN_DEBUG=n diff --git a/docs/kconfig-fragments.md b/docs/kconfig-fragments.md new file mode 100644 index 0000000000000000000000000000000000000000..969a7289b8be10fbb9eb2fb96d3a28be7b5db39d --- /dev/null +++ b/docs/kconfig-fragments.md @@ -0,0 +1,19 @@ +# Kconfig Fragments + +kdevops fragments are supported and can be used with the `scripts/kconfig/merge_config.sh` script. + +Workflow: + +```sh +./scripts/kconfig/merge_config.sh \ +-m \ + +``` + +Example: + +```sh +./scripts/kconfig/merge_config.sh \ +-m .config \ +callback-dense.config +``` From patchwork Fri Mar 28 20:56:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032438 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 CC00F3C0C for ; Fri, 28 Mar 2025 20:56:35 +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=1743195395; cv=none; b=McA481EbQ/7EJe2t1hokTk8Va9+w15GVkqDBmFwMKgI7nlFIy6nCQglS1vrMkWH5LimpnDTF4BpS+XwI37fPpwTqdqMzEhZdnQ/1xMgafeF5OaPtCZkeOkQ4gQLKrF1b58IeZmLYPE3SJtTSgJwcFAMPrmoGlyP+jqvRYXWgym0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195395; c=relaxed/simple; bh=pKj/hXGsEobjrM4yl7h4q3QXysnVBU5D82XXBZRVR6s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fHgZ9fUK7WnuDXIXqwjUc309PEq3aEuxggRHix4H08ldsMk8YiOtN/abb3k3vQzqLi+nGUvYVKUDeu885+5dXGp/BVcGDNm9MRJONy3HuE1sRKYSJLxQTkLGYOK5mQsihW+cm8QZuZzZKg9Eqhdp6pwwUWnOjmAkgfzGI83xGKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hculuiry; 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="Hculuiry" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5AA6C4CEE9; Fri, 28 Mar 2025 20:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195395; bh=pKj/hXGsEobjrM4yl7h4q3QXysnVBU5D82XXBZRVR6s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HculuiryjHzo8XSN+OMbSB3pf7jq7xmn6dq7WObuadLJEdInFViflYkGaM+H69Nkh FD+u0MMW5MzOlW2pA9PVGK5pqezB8q9oVJ2hWEE0FiF7BhtnBS4DpeRlIRyDqtuPd4 K7AelvjcdPms80KrAUwd8hdNMg7cZzQRf9SFhDqA7J0oLPUlm6uFhxrBNNe3OaLePR DdIfpOdzDorhUHzq+S6KUQZ+DbR7fOcr3NqitbVfBYx6TVqAfhz6HXEs72/kLGvwCe mMp/5RATWlCXhJ81cU4fwB/6hzUyd/Pjr3Xe2t742AoceCLfahhtcaesc24GJMdJfh gLuLxn8JFxDqw== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:17 +0000 Subject: [PATCH RFC 4/6] kconfig-env: generate kconfig environment Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-4-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez When menuconfig target is run, generate first the kconfig environment and merge with current .config. Signed-off-by: Daniel Gomez --- Makefile | 1 + scripts/kconfig-env.Makefile | 14 ++++++++++++++ scripts/kconfig/kconfig.Makefile | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5ee7db7d988b9271fed7cb470f807bb9e9ce3cb6..1f939c52284f218a23430a7c5350d7827cb1b905 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ export KDEVOPS_VAGRANT := export PYTHONUNBUFFERED=1 export TOPDIR=./ export TOPDIR_PATH = $(shell readlink -f $(TOPDIR)) +include scripts/kconfig-env.Makefile include scripts/refs.Makefile KDEVOPS_NODES_ROLE_TEMPLATE_DIR := $(KDEVOPS_PLAYBOOKS_DIR)/roles/gen_nodes/templates diff --git a/scripts/kconfig-env.Makefile b/scripts/kconfig-env.Makefile new file mode 100644 index 0000000000000000000000000000000000000000..dc2b9f2a65001ba8698a61bfb20b43b366e3d92a --- /dev/null +++ b/scripts/kconfig-env.Makefile @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: copyleft-next-0.3.1 + +PHONY += kconfig-env +kconfig-env: + $(Q)ANSIBLE_STDOUT_CALLBACK=null ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \ + --inventory localhost, \ + playbooks/kconfig.yml \ + -e 'ansible_python_interpreter=/usr/bin/python3' \ + --extra-vars "topdir_path=$(TOPDIR_PATH)" + $(Q)$(TOPDIR_PATH)/scripts/kconfig/merge_config.sh -m .config \ + $(TOPDIR_PATH)/.env.config + $(Q)$(MAKE) -C $(TOPDIR_PATH) olddefconfig + +.PHONY = $(PHONY) diff --git a/scripts/kconfig/kconfig.Makefile b/scripts/kconfig/kconfig.Makefile index cc24c7ff3e1c23487aec767075c69fdf3876b39d..19ed56b01db5817dc1e8b7a4db6fa726d87d8065 100644 --- a/scripts/kconfig/kconfig.Makefile +++ b/scripts/kconfig/kconfig.Makefile @@ -36,8 +36,8 @@ $(KCONFIG_DIR)/mconf: $(MAKE) -C $(KCONFIG_DIR)/ mconf PHONY += menuconfig -menuconfig: $(KCONFIG_DIR)/mconf include/config/project.release Kconfig - @$< Kconfig +menuconfig: $(KCONFIG_DIR)/mconf include/config/project.release Kconfig kconfig-env + $< Kconfig $(KCONFIG_DIR)/nconf: $(MAKE) -C $(KCONFIG_DIR)/ nconf From patchwork Fri Mar 28 20:56:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032439 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 56EE23C0C for ; Fri, 28 Mar 2025 20:56:36 +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=1743195397; cv=none; b=D6c2WhYDT2NQg26Q3mz16Lx5eV0R7xU3mWJpiBjK2+ebuVDPY4kEkmCXay43aGfnpAfgbT/VsRMRRRRQfRTu3UZkcAqiuz+OwoE5knseQDEy60MiWresGyFuhntrwbgflTq5f1v/CQkUkt2XJGE771T6s5gH3T/jvqZ2oL5uv3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195397; c=relaxed/simple; bh=UTTSiNO4jd28Y9/O3BXvtWI5RAFd0Vmzxb5GEx0xsmY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cxajv61E+6LPvmUF4VPY2GAd59dPkpXfxCr5j4KEJYZ+oQSKrPqBOYrGnp3H/RXtRz0QR/jU6bE4dl0gQwBbFTIkTkc8+XQPv5xV566OpY+g+p3q+ee2cYlJDHHuub8TQoS8fWZ04Z7IOOgybvxkILG4ifz9woZnc0uPnSQmBz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X4Kz5Cq0; 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="X4Kz5Cq0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 163E8C4CEE8; Fri, 28 Mar 2025 20:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195396; bh=UTTSiNO4jd28Y9/O3BXvtWI5RAFd0Vmzxb5GEx0xsmY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X4Kz5Cq0RdRDUO7bM9eLuY6tE8uvFtF7fSirP+SinYRs+WFLUeUXbxwI05B4rbprk HoIN286WoX+uBhEQ6/dXfybWdD6nNwLS2Z5R4FMKhaJsCzD49xiiCzX6eB3J5P5Vtu TR9bZ66N9HVlhUXfW4f1JNQbtEOQj5i/EgRPy7zwqi28zWCy6jsUxBbc34FZkYUKlJ HOh2puXTg4f57xlPgBT4i2OrtOuClmMiwE0/62XO/3y37UWZTRfgabFHvaOr07NOMB MV0rvcPMljk384Z0qccyDpJnregPCQlTQgKN2fB9Zz3riPyn3hpQ7EnFhtrYZZZ5G0 3q6xUS+rEfRpg== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:18 +0000 Subject: [PATCH RFC 5/6] kconfig: env: add support Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-5-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez Updating Kconfig with a fragment requires symbols to be visible. Add an environment submenu to display all generated variables. Signed-off-by: Daniel Gomez --- Kconfig | 9 ++++----- kconfigs/Kconfig.env | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index 357341be108de3dab79883f9a6babd29547d62de..6877b7aebd5057a925b371d8c6afd9ad568faa6e 100644 --- a/Kconfig +++ b/Kconfig @@ -15,11 +15,6 @@ config TOPDIR_PATH_HAS_SHA256SUM output yaml default y -config TOPDIR_PATH_SHA256SUM - string - output yaml - default $(shell, ./scripts/compute_sha256sum.sh $(TOPDIR_PATH)) - config HAVE_KDEVOPS_CUSTOM_DEFAULTS bool default n @@ -81,3 +76,7 @@ endmenu menu "Kdevops configuration" source "kconfigs/Kconfig.kdevops" endmenu + +menu "Environment" +source "kconfigs/Kconfig.env" +endmenu diff --git a/kconfigs/Kconfig.env b/kconfigs/Kconfig.env new file mode 100644 index 0000000000000000000000000000000000000000..400643f9a304556f27a63792239a383be51866c3 --- /dev/null +++ b/kconfigs/Kconfig.env @@ -0,0 +1,5 @@ +config TOPDIR_PATH_SHA256SUM + string "TOPDIR_PATH checksum" + output yaml + help + TOPDIR_PATH checksum From patchwork Fri Mar 28 20:56:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 14032440 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 4343E3C0C for ; Fri, 28 Mar 2025 20:56:38 +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=1743195398; cv=none; b=sBI0z2FwNBQYzNaPIFQicYMmxe5rUBTHU6MQd2q19Ic53gCzPTVO8UhJA6w+dBtyDAGPnlUps3AseyDMcszs6h2EENhBu1pvJf3p3Vw96gh6HDYamm1f29XzEaB8ccKQ6E/JEm2q75OCfbRJSGwvIuxSHayhR4scFJEkYK5n+8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743195398; c=relaxed/simple; bh=FVzb5Fp33m7QFt8V7OpbhxX3bgpeTMe72Ave92xfsLM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UcOpecLY5Nq4fkGkwBahEpUfnPT1Cui2Ebx+FWUgLeTi/fZTQyOfXTRvIGuR9B4m9dapZXSgjM7h6YXbwUxavuk1KHf5sSj7i4w7mBOqJPw/E8xrOI2yTe3zV8HdsjJ5gXoRr1TdXykVVdmjhO7XLUfIfXxlRjXclcfKNlZ1TK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r2wH7/gH; 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="r2wH7/gH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B3A6C4CEEA; Fri, 28 Mar 2025 20:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743195398; bh=FVzb5Fp33m7QFt8V7OpbhxX3bgpeTMe72Ave92xfsLM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=r2wH7/gHB2e3T5aYuCTVeBZ7KELMU2HfT/Vmk7Nszp3lG2AeRC42eqgEL0ujB39vD 6XpyMwL4oce7UOf6In6fhnzirCKJBZnF7r1kSL0Mxlh4dT/oaWGifUhmGJ/ZYsXmb+ As3ahXbVeS0LhgUlDrhI6k+d/L1CyOf0+yNIBnkK9M67O89UxQ7fObinhFjxVR7nNG pFk/iONoQX4JJgzUFrG+N9p5GxMqhWyMk7qq/hLi0tXJY4LkwTgu0/PFv0FvtoJHWP n/HLtAL3CpvUqvfs7+jxQXzCuKy13OK0txbvphHc7qnjed7JyL5MaF18r+IvMwryuD KpOIkQNJZZrAg== From: Daniel Gomez Date: Fri, 28 Mar 2025 20:56:19 +0000 Subject: [PATCH RFC 6/6] playbooks: add kconfig support Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250328-kconfig-env-with-ansible-v1-6-3231c0272457@samsung.com> References: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> In-Reply-To: <20250328-kconfig-env-with-ansible-v1-0-3231c0272457@samsung.com> To: Luis Chamberlain Cc: kdevops@lists.linux.dev, Daniel Gomez , Daniel Gomez X-Mailer: b4 0.14.2 From: Daniel Gomez Add kconfig playbook to generate Kconfig environment with Ansible. The output will be a Kconfig fragment (.env.config) that will be merged with existing configuration file. Add .env.config to the list of git-ignored files. Signed-off-by: Daniel Gomez --- .gitignore | 2 ++ playbooks/kconfig.yml | 6 ++++++ playbooks/roles/kconfig/tasks/main.yml | 15 +++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index 5ddfcc45e544ddb09ac81807e84fe88b329aec88..2fd102276301a2ce159e1c475f88ad464e2dc735 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ *.o *.retry +.env.config + .kdevops\.depcheck .provisioned_once* diff --git a/playbooks/kconfig.yml b/playbooks/kconfig.yml new file mode 100644 index 0000000000000000000000000000000000000000..4fa725c9046282a32d9a57c72c637194f3ad2335 --- /dev/null +++ b/playbooks/kconfig.yml @@ -0,0 +1,6 @@ +--- +- name: Kconfig + hosts: localhost + gather_facts: no + roles: + - role: kconfig diff --git a/playbooks/roles/kconfig/tasks/main.yml b/playbooks/roles/kconfig/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..36e92076c3a63d617f8df6b66dae9d2925800208 --- /dev/null +++ b/playbooks/roles/kconfig/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Checksum + ansible.builtin.shell: | + set -o pipefail + echo "{{ topdir_path }}" | sha256sum | awk '{print $1}' + register: kconfig_checksum + changed_when: false + +- name: Create env.config + ansible.builtin.copy: + dest: "{{ topdir_path }}/.env.config" + mode: "0755" + content: | + CONFIG_TOPDIR_PATH_SHA256SUM="{{ kconfig_checksum.stdout }}" + changed_when: true