Skip to contentSkip to conversation

introduce xen/scripts/config

PATCH In review [email protected] 4 participants 12 messages Jan 16 – Jan 27

lore
Share & tools
lore
#0 lore raw

cover introduce xen/scripts/config

There is currently no in-tree tool to manipulate Kconfig settings in a non-interactive way similar to the Linux scripts/config utility [1]. Such tooling is useful when building Xen via external build systems (e.g., Yocto) and can also simplify custom CI configuration.

This series imports the Linux scripts/config helper and integrates it into an existing Xen automation script.

Example of usage:

  ./xen/scripts/config --file xen/.config -y FOO -n BAR -y BAZ

Patch 1 imports scripts/config from Linux (based on v6.19-rc5) [1]. Patch 2 drops the -m option, since Xen does not support modules. Patch 3 adds convenience flags -y (set to yes) and -n (set to no). Patch 4 performs minimal integration into existing Xen build system.

[1] https://github.com/torvalds/linux/blob/master/scripts/config
[2] https://gitlab.com/xen-project/people/dmukhin/xen/-/pipelines/2266369021

Denis Mukhin (4):
scripts/config: import Kconfig manipulation tool from Linux scripts/config: drop modules support scripts/config: add -y|-n flags
scripts/config: hook to automation build script

 automation/scripts/build |   2 +-
 xen/scripts/config       | 225 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+), 1 deletion(-)
 create mode 100755 xen/scripts/config
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/4 scripts/config: import Kconfig manipulation tool from Linux

From: Denis Mukhin <[email protected]>

Manipulating Kconfig settings is often required when preparing a custom Xen build using an external build system (e.g., a Yocto-based workflow).

Import the Kconfig manipulation tool from the Linux kernel (commit 0f61b1860cc3, Linux v6.19-rc5) to support this use case.

---
 xen/scripts/config | 236 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 236 insertions(+)
 create mode 100755 xen/scripts/config
xen/scripts/config new file +236 -0
new file mode 100755
index 000000000000..ea475c07de28
@@ -0,0 +1,236 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0
+# Manipulate options in a .config file from the command line
+
+myname=${0##*/}
+
+# If no prefix forced, use the default CONFIG_
+CONFIG_="${CONFIG_-CONFIG_}"
+
+# We use an uncommon delimiter for sed substitutions
+SED_DELIM=$(echo -en "\001")
+
+usage() {
+	cat >&2 <<EOL
+Manipulate options in a .config file from the command line.
+Usage:
+$myname options command ...
+commands:
+	--enable|-e option   Enable option
+	--disable|-d option  Disable option
+	--module|-m option   Turn option into a module
+	--set-str option string
+	                     Set option to "string"
+	--set-val option value
+	                     Set option to value
+	--undefine|-u option Undefine option
+	--state|-s option    Print state of option (n,y,m,undef)
+
+	--enable-after|-E beforeopt option
+                             Enable option directly after other option
+	--disable-after|-D beforeopt option
+                             Disable option directly after other option
+	--module-after|-M beforeopt option
+                             Turn option into module directly after other option
+	--refresh            Refresh the config using old settings
+
+	commands can be repeated multiple times
+
+options:
+	--file config-file   .config file to change (default .config)
+	--keep-case|-k       Keep next symbols' case (dont' upper-case it)
+
+$myname doesn't check the validity of the .config file. This is done at next
+make time.
+
+By default, $myname will upper-case the given symbol. Use --keep-case to keep
+the case of all following symbols unchanged.
+
+$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
+EOL
+	exit 1
+}
+
+checkarg() {
+	ARG="$1"
+	if [ "$ARG" = "" ] ; then
+		usage
+	fi
+	case "$ARG" in
+	${CONFIG_}*)
+		ARG="${ARG/${CONFIG_}/}"
+		;;
+	esac
+	if [ "$MUNGE_CASE" = "yes" ] ; then
+		ARG="`echo $ARG | tr a-z A-Z`"
+	fi
+}
+
+txt_append() {
+	local anchor="$1"
+	local insert="$2"
+	local infile="$3"
+	local tmpfile="$infile.swp"
+
+	# sed append cmd: 'a\' + newline + text + newline
+	cmd="$(printf "a\\%b$insert" "\n")"
+
+	sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+txt_subst() {
+	local before="$1"
+	local after="$2"
+	local infile="$3"
+	local tmpfile="$infile.swp"
+
+	sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+txt_delete() {
+	local text="$1"
+	local infile="$2"
+	local tmpfile="$infile.swp"
+
+	sed -e "/$text/d" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+set_var() {
+	local name=$1 new=$2 before=$3
+
+	name_re="^($name=|# $name is not set)"
+	before_re="^($before=|# $before is not set)"
+	if test -n "$before" && grep -Eq "$before_re" "$FN"; then
+		txt_append "^$before=" "$new" "$FN"
+		txt_append "^# $before is not set" "$new" "$FN"
+	elif grep -Eq "$name_re" "$FN"; then
+		txt_subst "^$name=.*" "$new" "$FN"
+		txt_subst "^# $name is not set" "$new" "$FN"
+	else
+		echo "$new" >>"$FN"
+	fi
+}
+
+undef_var() {
+	local name=$1
+
+	txt_delete "^$name=" "$FN"
+	txt_delete "^# $name is not set" "$FN"
+}
+
+FN=.config
+CMDS=()
+while [[ $# -gt 0 ]]; do
+	if [ "$1" = "--file" ]; then
+		if [ "$2" = "" ]; then
+			usage
+		fi
+		FN="$2"
+		shift 2
+	else
+		CMDS+=("$1")
+		shift
+	fi
+done
+
+set -- "${CMDS[@]}"
+if [ "$1" = "" ] ; then
+	usage
+fi
+
+MUNGE_CASE=yes
+while [ "$1" != "" ] ; do
+	CMD="$1"
+	shift
+	case "$CMD" in
+	--keep-case|-k)
+		MUNGE_CASE=no
+		continue
+		;;
+	--refresh)
+		;;
+	--*-after|-E|-D|-M)
+		checkarg "$1"
+		A=$ARG
+		checkarg "$2"
+		B=$ARG
+		shift 2
+		;;
+	-*)
+		checkarg "$1"
+		shift
+		;;
+	esac
+	case "$CMD" in
+	--enable|-e)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
+		;;
+
+	--disable|-d)
+		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
+		;;
+
+	--module|-m)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
+		;;
+
+	--set-str)
+		# sed swallows one level of escaping, so we need double-escaping
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
+		shift
+		;;
+
+	--set-val)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
+		shift
+		;;
+	--undefine|-u)
+		undef_var "${CONFIG_}$ARG"
+		;;
+
+	--state|-s)
+		if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
+			echo n
+		else
+			V="$(grep "^${CONFIG_}$ARG=" $FN)"
+			if [ $? != 0 ] ; then
+				echo undef
+			else
+				V="${V/#${CONFIG_}$ARG=/}"
+				V="${V/#\"/}"
+				V="${V/%\"/}"
+				V="${V//\\\"/\"}"
+				echo "${V}"
+			fi
+		fi
+		;;
+
+	--enable-after|-E)
+		set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
+		;;
+
+	--disable-after|-D)
+		set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
+		;;
+
+	--module-after|-M)
+		set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
+		;;
+
+	--refresh)
+		yes "" | make oldconfig KCONFIG_CONFIG=$FN
+		;;
+
+	*)
+		echo "bad command: $CMD" >&2
+		usage
+		;;
+	esac
+done
Signature · 1 line
2.52.0
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH v1 1/4] scripts/config: import Kconfig manipulation tool from Linux

Quoted 9 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Manipulating Kconfig settings is often required when preparing a custom Xen build using an external build system (e.g., a Yocto-based workflow).

Import the Kconfig manipulation tool from the Linux kernel (commit 0f61b1860cc3, Linux v6.19-rc5) to support this use case.

Quoted 250 lines
---
 xen/scripts/config | 236 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 236 insertions(+)
 create mode 100755 xen/scripts/config
xen/scripts/config new file +236 -0
new file mode 100755
index 000000000000..ea475c07de28
@@ -0,0 +1,236 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0
+# Manipulate options in a .config file from the command line
+
+myname=${0##*/}
+
+# If no prefix forced, use the default CONFIG_
+CONFIG_="${CONFIG_-CONFIG_}"
+
+# We use an uncommon delimiter for sed substitutions
+SED_DELIM=$(echo -en "\001")
+
+usage() {
+	cat >&2 <<EOL
+Manipulate options in a .config file from the command line.
+Usage:
+$myname options command ...
+commands:
+	--enable|-e option   Enable option
+	--disable|-d option  Disable option
+	--module|-m option   Turn option into a module
+	--set-str option string
+	                     Set option to "string"
+	--set-val option value
+	                     Set option to value
+	--undefine|-u option Undefine option
+	--state|-s option    Print state of option (n,y,m,undef)
+
+	--enable-after|-E beforeopt option
+                             Enable option directly after other option
+	--disable-after|-D beforeopt option
+                             Disable option directly after other option
+	--module-after|-M beforeopt option
+                             Turn option into module directly after other option
+	--refresh            Refresh the config using old settings
+
+	commands can be repeated multiple times
+
+options:
+	--file config-file   .config file to change (default .config)
+	--keep-case|-k       Keep next symbols' case (dont' upper-case it)
+
+$myname doesn't check the validity of the .config file. This is done at next
+make time.
+
+By default, $myname will upper-case the given symbol. Use --keep-case to keep
+the case of all following symbols unchanged.
+
+$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
+EOL
+	exit 1
+}
+
+checkarg() {
+	ARG="$1"
+	if [ "$ARG" = "" ] ; then
+		usage
+	fi
+	case "$ARG" in
+	${CONFIG_}*)
+		ARG="${ARG/${CONFIG_}/}"
+		;;
+	esac
+	if [ "$MUNGE_CASE" = "yes" ] ; then
+		ARG="`echo $ARG | tr a-z A-Z`"
+	fi
+}
+
+txt_append() {
+	local anchor="$1"
+	local insert="$2"
+	local infile="$3"
+	local tmpfile="$infile.swp"
+
+	# sed append cmd: 'a\' + newline + text + newline
+	cmd="$(printf "a\\%b$insert" "\n")"
+
+	sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+txt_subst() {
+	local before="$1"
+	local after="$2"
+	local infile="$3"
+	local tmpfile="$infile.swp"
+
+	sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+txt_delete() {
+	local text="$1"
+	local infile="$2"
+	local tmpfile="$infile.swp"
+
+	sed -e "/$text/d" "$infile" >"$tmpfile"
+	# replace original file with the edited one
+	mv "$tmpfile" "$infile"
+}
+
+set_var() {
+	local name=$1 new=$2 before=$3
+
+	name_re="^($name=|# $name is not set)"
+	before_re="^($before=|# $before is not set)"
+	if test -n "$before" && grep -Eq "$before_re" "$FN"; then
+		txt_append "^$before=" "$new" "$FN"
+		txt_append "^# $before is not set" "$new" "$FN"
+	elif grep -Eq "$name_re" "$FN"; then
+		txt_subst "^$name=.*" "$new" "$FN"
+		txt_subst "^# $name is not set" "$new" "$FN"
+	else
+		echo "$new" >>"$FN"
+	fi
+}
+
+undef_var() {
+	local name=$1
+
+	txt_delete "^$name=" "$FN"
+	txt_delete "^# $name is not set" "$FN"
+}
+
+FN=.config
+CMDS=()
+while [[ $# -gt 0 ]]; do
+	if [ "$1" = "--file" ]; then
+		if [ "$2" = "" ]; then
+			usage
+		fi
+		FN="$2"
+		shift 2
+	else
+		CMDS+=("$1")
+		shift
+	fi
+done
+
+set -- "${CMDS[@]}"
+if [ "$1" = "" ] ; then
+	usage
+fi
+
+MUNGE_CASE=yes
+while [ "$1" != "" ] ; do
+	CMD="$1"
+	shift
+	case "$CMD" in
+	--keep-case|-k)
+		MUNGE_CASE=no
+		continue
+		;;
+	--refresh)
+		;;
+	--*-after|-E|-D|-M)
+		checkarg "$1"
+		A=$ARG
+		checkarg "$2"
+		B=$ARG
+		shift 2
+		;;
+	-*)
+		checkarg "$1"
+		shift
+		;;
+	esac
+	case "$CMD" in
+	--enable|-e)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
+		;;
+
+	--disable|-d)
+		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
+		;;
+
+	--module|-m)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
+		;;
+
+	--set-str)
+		# sed swallows one level of escaping, so we need double-escaping
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
+		shift
+		;;
+
+	--set-val)
+		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
+		shift
+		;;
+	--undefine|-u)
+		undef_var "${CONFIG_}$ARG"
+		;;
+
+	--state|-s)
+		if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
+			echo n
+		else
+			V="$(grep "^${CONFIG_}$ARG=" $FN)"
+			if [ $? != 0 ] ; then
+				echo undef
+			else
+				V="${V/#${CONFIG_}$ARG=/}"
+				V="${V/#\"/}"
+				V="${V/%\"/}"
+				V="${V//\\\"/\"}"
+				echo "${V}"
+			fi
+		fi
+		;;
+
+	--enable-after|-E)
+		set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
+		;;
+
+	--disable-after|-D)
+		set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
+		;;
+
+	--module-after|-M)
+		set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
+		;;
+
+	--refresh)
+		yes "" | make oldconfig KCONFIG_CONFIG=$FN
+		;;
+
+	*)
+		echo "bad command: $CMD" >&2
+		usage
+		;;
+	esac
+done
Signature · 1 line
2.52.0
#3 lore raw

PATCH 2/4 scripts/config: drop modules support

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Drop the --module (-m) and --module-after (-M) options, as Xen does not support loadable modules, so options are not applicable.

---
 xen/scripts/config | 11 -----------
 1 file changed, 11 deletions(-)
xen/scripts/config +0 -11
index ea475c07de28..1050812aae8d 100755
@@ -18,7 +18,6 @@ $myname options command ...
 commands:
 	--enable|-e option   Enable option
 	--disable|-d option  Disable option
-	--module|-m option   Turn option into a module
 	--set-str option string
 	                     Set option to "string"
 	--set-val option value
@@ -30,8 +29,6 @@ commands:
                              Enable option directly after other option
 	--disable-after|-D beforeopt option
                              Disable option directly after other option
-	--module-after|-M beforeopt option
-                             Turn option into module directly after other option
 	--refresh            Refresh the config using old settings
 
 	commands can be repeated multiple times
@@ -177,10 +174,6 @@ while [ "$1" != "" ] ; do
 		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
 		;;
 
-	--module|-m)
-		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
-		;;
-
 	--set-str)
 		# sed swallows one level of escaping, so we need double-escaping
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
@@ -220,10 +213,6 @@ while [ "$1" != "" ] ; do
 		set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
 		;;
 
-	--module-after|-M)
-		set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
-		;;
-
 	--refresh)
 		yes "" | make oldconfig KCONFIG_CONFIG=$FN
 		;;
Signature · 1 line
2.52.0
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH v1 2/4] scripts/config: drop modules support

Quoted 6 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Drop the --module (-m) and --module-after (-M) options, as Xen does not support loadable modules, so options are not applicable.

Quoted 50 lines
---
 xen/scripts/config | 11 -----------
 1 file changed, 11 deletions(-)
xen/scripts/config +0 -11
index ea475c07de28..1050812aae8d 100755
@@ -18,7 +18,6 @@ $myname options command ...
 commands:
 	--enable|-e option   Enable option
 	--disable|-d option  Disable option
-	--module|-m option   Turn option into a module
 	--set-str option string
 	                     Set option to "string"
 	--set-val option value
@@ -30,8 +29,6 @@ commands:
                              Enable option directly after other option
 	--disable-after|-D beforeopt option
                              Disable option directly after other option
-	--module-after|-M beforeopt option
-                             Turn option into module directly after other option
 	--refresh            Refresh the config using old settings
 
 	commands can be repeated multiple times
@@ -177,10 +174,6 @@ while [ "$1" != "" ] ; do
 		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
 		;;
 
-	--module|-m)
-		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
-		;;
-
 	--set-str)
 		# sed swallows one level of escaping, so we need double-escaping
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
@@ -220,10 +213,6 @@ while [ "$1" != "" ] ; do
 		set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
 		;;
 
-	--module-after|-M)
-		set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
-		;;
-
 	--refresh)
 		yes "" | make oldconfig KCONFIG_CONFIG=$FN
 		;;
Signature · 1 line
2.52.0
#5 lore raw

PATCH 3/4 scripts/config: add -y|-n flags

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Add alias -y ("yes") to --enable and -n ("no") to --disable a Kconfig option for better scripting experience.

---
 xen/scripts/config | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
xen/scripts/config +4 -4
index 1050812aae8d..1ede964320cf 100755
@@ -16,8 +16,8 @@ Manipulate options in a .config file from the command line.
 Usage:
 $myname options command ...
 commands:
-	--enable|-e option   Enable option
-	--disable|-d option  Disable option
+	--enable|-e|-y|--yes    option   Enable option
+	--disable|-d|-n|--no    option   Disable option
 	--set-str option string
 	                     Set option to "string"
 	--set-val option value
@@ -166,11 +166,11 @@ while [ "$1" != "" ] ; do
 		;;
 	esac
 	case "$CMD" in
-	--enable|-e)
+	--enable|-e|-y|--yes)
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
 		;;
 
-	--disable|-d)
+	--disable|-d|-n|--no)
 		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
 		;;
 
Signature · 1 line
2.52.0
Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH v1 3/4] scripts/config: add -y|-n flags

Quoted 6 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Add alias -y ("yes") to --enable and -n ("no") to --disable a Kconfig option for better scripting experience.

Quoted 36 lines
---
 xen/scripts/config | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
xen/scripts/config +4 -4
index 1050812aae8d..1ede964320cf 100755
@@ -16,8 +16,8 @@ Manipulate options in a .config file from the command line.
 Usage:
 $myname options command ...
 commands:
-	--enable|-e option   Enable option
-	--disable|-d option  Disable option
+	--enable|-e|-y|--yes    option   Enable option
+	--disable|-d|-n|--no    option   Disable option
 	--set-str option string
 	                     Set option to "string"
 	--set-val option value
@@ -166,11 +166,11 @@ while [ "$1" != "" ] ; do
 		;;
 	esac
 	case "$CMD" in
-	--enable|-e)
+	--enable|-e|-y|--yes)
 		set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
 		;;
 
-	--disable|-d)
+	--disable|-d|-n|--no)
 		set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
 		;;
 
Signature · 1 line
2.52.0
#7 lore raw

Re: [PATCH v1 3/4] scripts/config: add -y|-n flags

In reply to [email protected]
Quoted 6 lines · On 16.01.2026 05:34, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Add alias -y ("yes") to --enable and -n ("no") to --disable a Kconfig option for better scripting experience.

Seeing this has been ack-ed as-is, I'd like to put on record that I don't think we should be adding extensions like this. If such is wanted and deemed generally useful, it can surely go to the Linux original first.

Jan

#8 lore raw

PATCH 4/4 scripts/config: hook to automation build script

In reply to [email protected]

From: Denis Mukhin <[email protected]>

Use the new .config manipulation tool to toggle CONFIG_DEBUG in the Xen automation build script.

---
 automation/scripts/build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
automation/scripts/build +1 -1
index 7a81d229decd..ee1127c53dc5 100755
@@ -27,7 +27,7 @@ else
     # Start off with arch's defconfig
     make -C xen defconfig
 
-    echo "CONFIG_DEBUG=${debug}" >> xen/.config
+    xen/scripts/config --file xen/.config -${debug} DEBUG
 
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config
Signature · 1 line
2.52.0
#9 lore raw

Re: [PATCH v1 4/4] scripts/config: hook to automation build script

Quoted 15 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use the new .config manipulation tool to toggle CONFIG_DEBUG in the Xen automation build script.

---
 automation/scripts/build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
automation/scripts/build +0 -0
index 7a81d229decd..ee1127c53dc5 100755

automation/scripts/build else · line 30

Quoted 5 lines
automation/scripts/build +1 -1
@@ -27,7 +27,7 @@ else
     # Start off with arch's defconfig
     make -C xen defconfig
 
-    echo "CONFIG_DEBUG=${debug}" >> xen/.config
+    xen/scripts/config --file xen/.config -${debug} DEBUG

I'd suggest to add:

debug="${debug:-n}"

before calling xen/scripts/config to avoid errors in case debug is not set

I could make the change on commit if you are OK with it

Quoted 5 lines
automation/scripts/build +0 -0
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config
Signature · 1 line
2.52.0
#10 lore raw

Re: [PATCH v1 4/4] scripts/config: hook to automation build script

Quoted 23 lines · Stefano Stabellini
Quoted 15 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use the new .config manipulation tool to toggle CONFIG_DEBUG in the Xen automation build script.

---
 automation/scripts/build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
automation/scripts/build +0 -0
index 7a81d229decd..ee1127c53dc5 100755

automation/scripts/build else · line 30

Quoted 5 lines
automation/scripts/build +1 -1
@@ -27,7 +27,7 @@ else
     # Start off with arch's defconfig
     make -C xen defconfig
 
-    echo "CONFIG_DEBUG=${debug}" >> xen/.config
+    xen/scripts/config --file xen/.config -${debug} DEBUG

I'd suggest to add:

Quoted 6 lines

debug="${debug:-n}"

before calling xen/scripts/config to avoid errors in case debug is not set

I could make the change on commit if you are OK with it

$debug is always set in automation, which is why the script is written this way.  But being resilient might be better.

Quoted 2 lines

automation/scripts/build else · line 33

Quoted 2 lines
automation/scripts/build +0 -0
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config

This part of context is the same pattern, and wants a similar adjustment, although maybe the script wants a bulk adjustment mode. This pattern is also repeated in the Eclair scripting too.

~Andrew

#11 lore raw

Re: [PATCH v1 4/4] scripts/config: hook to automation build script

In reply to Stefano Stabellini
Quoted 24 lines · Stefano Stabellini
Quoted 15 lines · On Thu, 15 Jan 2026, [email protected] wrote:

From: Denis Mukhin <[email protected]>

Use the new .config manipulation tool to toggle CONFIG_DEBUG in the Xen automation build script.

---
 automation/scripts/build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
automation/scripts/build +0 -0
index 7a81d229decd..ee1127c53dc5 100755

automation/scripts/build else · line 30

Quoted 5 lines
automation/scripts/build +1 -1
@@ -27,7 +27,7 @@ else
     # Start off with arch's defconfig
     make -C xen defconfig
 
-    echo "CONFIG_DEBUG=${debug}" >> xen/.config
+    xen/scripts/config --file xen/.config -${debug} DEBUG

I'd suggest to add:

Quoted 6 lines

debug="${debug:-n}"

before calling xen/scripts/config to avoid errors in case debug is not set

I could make the change on commit if you are OK with it

Yes, will appreciate help!
Thanks!

Quoted 7 lines
Quoted 7 lines
automation/scripts/build +0 -0
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config
Signature · 1 line
2.52.0