[PATCH v1 1/5] kconfig: allow defconfigs to live in board directory

Troy Kisky troy.kisky at boundarydevices.com
Sat Dec 18 00:01:27 CET 2021


This will reduce the size of the configs directory, and
make it more clear which board directory uses the defconfig
file.

Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
---
 scripts/kconfig/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 12e525ee31f..307262e00de 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -92,8 +92,15 @@ else
 endif
 endif
 
+%_defconfig: SHELL:=/bin/bash
 %_defconfig: $(obj)/conf
-	$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
+	$(Q)readarray -d '' names < <(find $(srctree)/configs $(srctree)/board -type f -name $@ -print0); \
+	if (test $${#names[*]} -eq 1); then \
+		$< $(silent) --defconfig="$${names[0]}" $(Kconfig); \
+	else \
+		echo "$@" not found or ambiguous error; \
+		echo "$${names[@]}"; exit 1; \
+	fi
 
 # Added for U-Boot (backward compatibility)
 %_config: %_defconfig
-- 
2.32.0



More information about the U-Boot mailing list