setall will set all possible dependencies automatically to value "y". Signed-off-by: Jukka Kaartinen <jukka.kaartinen@xxxxxxxxxx> --- scripts/kconfig/kconfig | 77 +++++++++++++++++++++++++++++++++-------- scripts/kconfig/lconf.c | 16 +++++++++ 2 files changed, 79 insertions(+), 14 deletions(-) diff --git a/scripts/kconfig/kconfig b/scripts/kconfig/kconfig index 2762c8dc04a8..7dd7bca2e0e8 100755 --- a/scripts/kconfig/kconfig +++ b/scripts/kconfig/kconfig @@ -1,34 +1,83 @@ -#!/bin/sh +#!/bin/bash # SPDX-License-Identifier: GPL-2.0 usage() { - echo "kconfig [search|set] string" + echo "kconfig [search|set|setall|val|out] string" + echo " search Search config option" + echo " set Config option" + echo " setall Set all possible dependencies to 'y'" + echo " val Value for config option" + echo " out Directory for O=<out>" + echo "" + echo " example:" + echo " $0 set I2C val y" exit 1; } -if [ "$1" = "" ] ; then - usage -fi +search="" +search_val="" +config="" +config_val="" +output="" +setting="" + +while [[ $# -gt 0 ]] +do + key="$1" + case $key in + search) + search=1 + search_val="$2" + shift # past argument + shift # past value + ;; + set) + config=1 + config_val="$2" + shift # past argument + shift # past value + ;; + setall) + all="y" + shift # past argument + ;; + val) + setting="$2" + shift # past argument + shift # past value + ;; + out) + output="O=$2" + shift # past argument + shift # past value + ;; + *) # unknown option + echo "Unknown option: $1" + usage + exit 1 + ;; + esac +done -if [ "$1" = "search" ] ; then +if [ "$search" != "" ] ; then - search=$2 - NCONFIG_MODE=kconfig_search SEARCH=${search} make lconfig + if [ $search_val = "" ] ; then + echo "nothing to search" + exit 1 + fi -elif [ "$1" = "set" ] ; then + NCONFIG_MODE=kconfig_search SEARCH=${search_val} make lconfig ${output} - config=$2 - setting=$3 +elif [ "$config" != "" ] ; then - if [ $config = "" ] ; then + if [ $config_val = "" ] ; then echo "nothing to set" exit 1 fi - NCONFIG_MODE=kconfig_set CONFIG=${config} SETTING=${setting} make lconfig + ALLYES=${all} NCONFIG_MODE=kconfig_set CONFIG=${config_val} SETTING=${setting} make lconfig ${output} else usage fi - diff --git a/scripts/kconfig/lconf.c b/scripts/kconfig/lconf.c index cde717f36eb1..b8634f8f662d 100644 --- a/scripts/kconfig/lconf.c +++ b/scripts/kconfig/lconf.c @@ -14,6 +14,7 @@ static int indent; static char line[128]; +static char *ask_from_user; static int get_depends(struct symbol *sym); @@ -57,6 +58,12 @@ static int conf_askvalue(struct symbol *sym, const char *def) return 0; } + if (ask_from_user) { + line[0] = 'y'; + line[1] = '\0'; + return 0; + } + fflush(stdout); xfgets(line, 128, stdin); @@ -232,8 +239,17 @@ static void kconfig_set(void) struct symbol *sym; char *config; char *setting; + char *allyes; int res; + allyes = getenv("ALLYES"); + if (allyes) { + if (strncmp(allyes, "y", 1) == 0) { + ask_from_user = "y"; + printf("Set all dependencies to yes.\n"); + } + } + config = getenv("CONFIG"); if (!config) return; -- 2.17.1