Skip to content

Commit da85d34

Browse files
committed
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig changes from Michal Marek: - Error handling for make KCONFIG_ALLCONFIG=<...> all*config plus a fix for a bug that was exposed by this - Fix for the script/config utility. * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/config: properly report and set string options kbuild: all{no,yes,mod,def,rand}config only read files when instructed to. kconfig: Add error handling to KCONFIG_ALLCONFIG
2 parents 1347a2c + d6686da commit da85d34

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

Documentation/kbuild/kconfig.txt

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ KCONFIG_ALLCONFIG
5353
--------------------------------------------------
5454
(partially based on lkml email from/by Rob Landley, re: miniconfig)
5555
--------------------------------------------------
56-
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
57-
also use the environment variable KCONFIG_ALLCONFIG as a flag or a
58-
filename that contains config symbols that the user requires to be
59-
set to a specific value. If KCONFIG_ALLCONFIG is used without a
60-
filename, "make *config" checks for a file named
61-
"all{yes/mod/no/def/random}.config" (corresponding to the *config command
62-
that was used) for symbol values that are to be forced. If this file
63-
is not found, it checks for a file named "all.config" to contain forced
64-
values.
56+
The allyesconfig/allmodconfig/allnoconfig/randconfig variants can also
57+
use the environment variable KCONFIG_ALLCONFIG as a flag or a filename
58+
that contains config symbols that the user requires to be set to a
59+
specific value. If KCONFIG_ALLCONFIG is used without a filename where
60+
KCONFIG_ALLCONFIG == "" or KCONFIG_ALLCONFIG == "1", "make *config"
61+
checks for a file named "all{yes/mod/no/def/random}.config"
62+
(corresponding to the *config command that was used) for symbol values
63+
that are to be forced. If this file is not found, it checks for a
64+
file named "all.config" to contain forced values.
6565

6666
This enables you to create "miniature" config (miniconfig) or custom
6767
config files containing just the config symbols that you are interested

scripts/config

+7-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ while [ "$1" != "" ] ; do
107107
;;
108108

109109
--set-str)
110-
set_var "CONFIG_$ARG" "CONFIG_$ARG=\"$1\""
110+
# sed swallows one level of escaping, so we need double-escaping
111+
set_var "CONFIG_$ARG" "CONFIG_$ARG=\"${1//\"/\\\\\"}\""
111112
shift
112113
;;
113114

@@ -124,9 +125,11 @@ while [ "$1" != "" ] ; do
124125
if [ $? != 0 ] ; then
125126
echo undef
126127
else
127-
V="${V/CONFIG_$ARG=/}"
128-
V="${V/\"/}"
129-
echo "$V"
128+
V="${V/#CONFIG_$ARG=/}"
129+
V="${V/#\"/}"
130+
V="${V/%\"/}"
131+
V="${V/\\\"/\"}"
132+
echo "${V}"
130133
fi
131134
fi
132135
;;

scripts/kconfig/conf.c

+16-6
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,15 @@ int main(int ac, char **av)
574574
case alldefconfig:
575575
case randconfig:
576576
name = getenv("KCONFIG_ALLCONFIG");
577-
if (name && !stat(name, &tmpstat)) {
578-
conf_read_simple(name, S_DEF_USER);
577+
if (!name)
578+
break;
579+
if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) {
580+
if (conf_read_simple(name, S_DEF_USER)) {
581+
fprintf(stderr,
582+
_("*** Can't read seed configuration \"%s\"!\n"),
583+
name);
584+
exit(1);
585+
}
579586
break;
580587
}
581588
switch (input_mode) {
@@ -586,10 +593,13 @@ int main(int ac, char **av)
586593
case randconfig: name = "allrandom.config"; break;
587594
default: break;
588595
}
589-
if (!stat(name, &tmpstat))
590-
conf_read_simple(name, S_DEF_USER);
591-
else if (!stat("all.config", &tmpstat))
592-
conf_read_simple("all.config", S_DEF_USER);
596+
if (conf_read_simple(name, S_DEF_USER) &&
597+
conf_read_simple("all.config", S_DEF_USER)) {
598+
fprintf(stderr,
599+
_("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"),
600+
name);
601+
exit(1);
602+
}
593603
break;
594604
default:
595605
break;

0 commit comments

Comments
 (0)