mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD
@ 2025-03-17 11:32 Ahmad Fatoum
  2025-03-17 11:32 ` [PATCH v2 2/2] MAKEALL: parse kconfig_add out of YAML files Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-03-17 11:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

KCONFIG_ADD currently expects a list of files to be merged.
As MAKEALL is a bash script, let's make use of process substitution
to create temporary files out of -k CONFIG_foo=bar options.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - fix Regex (Sascha)
---
 MAKEALL | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 1966eedb4673..bc612b45561f 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -56,7 +56,7 @@ usage() {
 	echo "BUILDDIR    -O      build dir"
 	echo "LOGDIR      -l      log dir"
 	echo "REGEX       -e      regex"
-	echo "KCONFIG_ADD -k      kconfig fragment"
+	echo "KCONFIG_ADD -k      kconfig fragment or option"
 	echo "TARGET      -t      Makefile target"
 	echo "V           -v      verbosity"
 	echo "INCREMENTAL -i"
@@ -116,6 +116,11 @@ report() {
 	fi
 }
 
+merge_config() {
+	with_logs_collected ./scripts/kconfig/merge_config.sh -m -O \
+		${BUILDDIR} "$@"
+}
+
 do_build_defconfig() {
 	local arch=$1
 	local defconfig=$2
@@ -156,8 +161,11 @@ do_build_defconfig() {
 	MAKE="${MAKE} $silent_flag CROSS_COMPILE=${cross_compile}"
 	with_logs_collected ${MAKE} ${defconfig}
 	for i in ${KCONFIG_ADD}; do
-		with_logs_collected ./scripts/kconfig/merge_config.sh -m -O \
-			${BUILDDIR} ${BUILDDIR}/.config $i
+		if [[ $i =~ ^CONFIG_.*=.* ]]; then
+			merge_config ${BUILDDIR}/.config <(echo $i)
+		else
+			merge_config ${BUILDDIR}/.config $i
+		fi
 	done
 	with_logs_collected ${MAKE} $silent_flag olddefconfig
 
-- 
2.39.5




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] MAKEALL: parse kconfig_add out of YAML files
  2025-03-17 11:32 [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Ahmad Fatoum
@ 2025-03-17 11:32 ` Ahmad Fatoum
  2025-03-17 12:28 ` [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Sascha Hauer
  2025-03-27 10:37 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-03-17 11:32 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Now that MAKEALL supports direct options in KCONFIG_ADD, teach it to
read runner kconfig_add keys out of the labgrid environment YAML files.

This is a further step towards removal of test/emulate.pl.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
  - no change
---
 MAKEALL            | 13 +++++++++++++
 test/Containerfile |  1 +
 2 files changed, 14 insertions(+)

diff --git a/MAKEALL b/MAKEALL
index bc612b45561f..a9409fbf7b07 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -422,6 +422,19 @@ else
 		if [[ $i =~ ^.*/([^/]+)/([^@]*@|)([^.]+).yaml$ ]]; then
 			arch=${BASH_REMATCH[1]}
 			defconfig=${BASH_REMATCH[3]}
+
+			if grep -q "^\s\+kconfig_add:" $i; then
+				if command -v yq 2>&1 >/dev/null; then
+					KCONFIG_ADD="${KCONFIG_ADD} $(yq -M -r \
+					'.targets.main.runner.kconfig_add |
+					keys[] as $k | .[$k]' < $i)"
+				else
+					echo "WARNING: yq command not found in path" >&2
+					echo "WARNING: ignoring kconfig_add in $i" >&2
+					echo
+				fi
+			fi
+
 			do_build_defconfig $arch $defconfig
 			if [ $? -eq 0 ]; then
 				do_test_defconfig $config $defconfig "${pytest_opts[@]}"
diff --git a/test/Containerfile b/test/Containerfile
index db43d039b922..53a5443e48fe 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -51,6 +51,7 @@ RUN apt-get update && apt-get install -y \
 	sudo \
 	u-boot-tools \
 	yamllint \
+	yq \
 	&& rm -rf /var/lib/apt/lists/*
 
 ENV GCC_VERSION=14.2.0
-- 
2.39.5




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD
  2025-03-17 11:32 [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Ahmad Fatoum
  2025-03-17 11:32 ` [PATCH v2 2/2] MAKEALL: parse kconfig_add out of YAML files Ahmad Fatoum
@ 2025-03-17 12:28 ` Sascha Hauer
  2025-03-27 10:37 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-03-17 12:28 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Mon, 17 Mar 2025 12:32:07 +0100, Ahmad Fatoum wrote:
> KCONFIG_ADD currently expects a list of files to be merged.
> As MAKEALL is a bash script, let's make use of process substitution
> to create temporary files out of -k CONFIG_foo=bar options.
> 
> 

Applied, thanks!

[1/2] MAKEALL: support direct options for KCONFIG_ADD
      https://git.pengutronix.de/cgit/barebox/commit/?id=b39351c0036f (link may not be stable)
[2/2] MAKEALL: parse kconfig_add out of YAML files
      https://git.pengutronix.de/cgit/barebox/commit/?id=3b288224cc6c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD
  2025-03-17 11:32 [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Ahmad Fatoum
  2025-03-17 11:32 ` [PATCH v2 2/2] MAKEALL: parse kconfig_add out of YAML files Ahmad Fatoum
  2025-03-17 12:28 ` [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Sascha Hauer
@ 2025-03-27 10:37 ` Ahmad Fatoum
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-03-27 10:37 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: BAREBOX

Hello Sascha,

On 3/17/25 12:32, Ahmad Fatoum wrote:
> KCONFIG_ADD currently expects a list of files to be merged.
> As MAKEALL is a bash script, let's make use of process substitution
> to create temporary files out of -k CONFIG_foo=bar options.

Please pick these two patches to the ci branch to workaround the build
breakage there.

Thanks,
Ahmad

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> v1 -> v2:
>   - fix Regex (Sascha)
> ---
>  MAKEALL | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/MAKEALL b/MAKEALL
> index 1966eedb4673..bc612b45561f 100755
> --- a/MAKEALL
> +++ b/MAKEALL
> @@ -56,7 +56,7 @@ usage() {
>  	echo "BUILDDIR    -O      build dir"
>  	echo "LOGDIR      -l      log dir"
>  	echo "REGEX       -e      regex"
> -	echo "KCONFIG_ADD -k      kconfig fragment"
> +	echo "KCONFIG_ADD -k      kconfig fragment or option"
>  	echo "TARGET      -t      Makefile target"
>  	echo "V           -v      verbosity"
>  	echo "INCREMENTAL -i"
> @@ -116,6 +116,11 @@ report() {
>  	fi
>  }
>  
> +merge_config() {
> +	with_logs_collected ./scripts/kconfig/merge_config.sh -m -O \
> +		${BUILDDIR} "$@"
> +}
> +
>  do_build_defconfig() {
>  	local arch=$1
>  	local defconfig=$2
> @@ -156,8 +161,11 @@ do_build_defconfig() {
>  	MAKE="${MAKE} $silent_flag CROSS_COMPILE=${cross_compile}"
>  	with_logs_collected ${MAKE} ${defconfig}
>  	for i in ${KCONFIG_ADD}; do
> -		with_logs_collected ./scripts/kconfig/merge_config.sh -m -O \
> -			${BUILDDIR} ${BUILDDIR}/.config $i
> +		if [[ $i =~ ^CONFIG_.*=.* ]]; then
> +			merge_config ${BUILDDIR}/.config <(echo $i)
> +		else
> +			merge_config ${BUILDDIR}/.config $i
> +		fi
>  	done
>  	with_logs_collected ${MAKE} $silent_flag olddefconfig
>  




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-27 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-17 11:32 [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Ahmad Fatoum
2025-03-17 11:32 ` [PATCH v2 2/2] MAKEALL: parse kconfig_add out of YAML files Ahmad Fatoum
2025-03-17 12:28 ` [PATCH v2 1/2] MAKEALL: support direct options for KCONFIG_ADD Sascha Hauer
2025-03-27 10:37 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox