Skip to contentSkip to conversation

kconfig: allow defconfigs to live in board directory

PATCH New Troy Kisky 1 participant 1 message Nov 5, 2021 Kconfig

lore
Share & tools
lore

Troy Kisky

author
#0 lore raw

PATCH 1/1 kconfig: allow defconfigs to live in board directory

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

---
 scripts/kconfig/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
scripts/kconfig/Makefile +8 -1
index 12e525ee31..fbeb00749a 100644
@@ -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 configs 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
Signature · 1 line
2.32.0