diff mbox series

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

Message ID 20211217230131.2715940-2-troy.kisky@boundarydevices.com
State Deferred
Delegated to: Tom Rini
Headers show
Series Move board specific files to board directory | expand

Commit Message

Troy Kisky Dec. 17, 2021, 11:01 p.m. UTC
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@boundarydevices.com>
---
 scripts/kconfig/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Simon Glass Dec. 28, 2021, 8:33 a.m. UTC | #1
Hi Troy,

On Fri, 17 Dec 2021 at 16:02, Troy Kisky <troy.kisky@boundarydevices.com> wrote:
>
> 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@boundarydevices.com>
> ---
>  scripts/kconfig/Makefile | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

>
> 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
>

How could this ever match more than one file?

Regards,
Simon
Troy Kisky Jan. 6, 2022, 9 p.m. UTC | #2
On 12/28/2021 12:33 AM, Simon Glass wrote:
> Hi Troy,
> 
> On Fri, 17 Dec 2021 at 16:02, Troy Kisky <troy.kisky@boundarydevices.com> wrote:
>>
>> 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@boundarydevices.com>
>> ---
>>  scripts/kconfig/Makefile | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
>>
>> 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
>>
> 
> How could this ever match more than one file?
> 
> Regards,
> Simon

If two different vendors decide to use the same defconfig file name, this will hit when the 2nd one
tries to merge it upstream.

BR
Troy
diff mbox series

Patch

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