aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c81
1 files changed, 37 insertions, 44 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index dc11d51bd8b3..f7d89d7065b7 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -221,24 +221,23 @@ load:
221 while (fgets(line, sizeof(line), in)) { 221 while (fgets(line, sizeof(line), in)) {
222 conf_lineno++; 222 conf_lineno++;
223 sym = NULL; 223 sym = NULL;
224 switch (line[0]) { 224 if (line[0] == '#') {
225 case '#': 225 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
226 if (memcmp(line + 2, "CONFIG_", 7))
227 continue; 226 continue;
228 p = strchr(line + 9, ' '); 227 p = strchr(line + 2 + strlen(CONFIG_), ' ');
229 if (!p) 228 if (!p)
230 continue; 229 continue;
231 *p++ = 0; 230 *p++ = 0;
232 if (strncmp(p, "is not set", 10)) 231 if (strncmp(p, "is not set", 10))
233 continue; 232 continue;
234 if (def == S_DEF_USER) { 233 if (def == S_DEF_USER) {
235 sym = sym_find(line + 9); 234 sym = sym_find(line + 2 + strlen(CONFIG_));
236 if (!sym) { 235 if (!sym) {
237 sym_add_change_count(1); 236 sym_add_change_count(1);
238 break; 237 break;
239 } 238 }
240 } else { 239 } else {
241 sym = sym_lookup(line + 9, 0); 240 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
242 if (sym->type == S_UNKNOWN) 241 if (sym->type == S_UNKNOWN)
243 sym->type = S_BOOLEAN; 242 sym->type = S_BOOLEAN;
244 } 243 }
@@ -254,13 +253,8 @@ load:
254 default: 253 default:
255 ; 254 ;
256 } 255 }
257 break; 256 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
258 case 'C': 257 p = strchr(line + strlen(CONFIG_), '=');
259 if (memcmp(line, "CONFIG_", 7)) {
260 conf_warning("unexpected data");
261 continue;
262 }
263 p = strchr(line + 7, '=');
264 if (!p) 258 if (!p)
265 continue; 259 continue;
266 *p++ = 0; 260 *p++ = 0;
@@ -271,13 +265,13 @@ load:
271 *p2 = 0; 265 *p2 = 0;
272 } 266 }
273 if (def == S_DEF_USER) { 267 if (def == S_DEF_USER) {
274 sym = sym_find(line + 7); 268 sym = sym_find(line + strlen(CONFIG_));
275 if (!sym) { 269 if (!sym) {
276 sym_add_change_count(1); 270 sym_add_change_count(1);
277 break; 271 break;
278 } 272 }
279 } else { 273 } else {
280 sym = sym_lookup(line + 7, 0); 274 sym = sym_lookup(line + strlen(CONFIG_), 0);
281 if (sym->type == S_UNKNOWN) 275 if (sym->type == S_UNKNOWN)
282 sym->type = S_OTHER; 276 sym->type = S_OTHER;
283 } 277 }
@@ -286,12 +280,9 @@ load:
286 } 280 }
287 if (conf_set_sym_val(sym, def, def_flags, p)) 281 if (conf_set_sym_val(sym, def, def_flags, p))
288 continue; 282 continue;
289 break; 283 } else {
290 case '\r': 284 if (line[0] != '\r' && line[0] != '\n')
291 case '\n': 285 conf_warning("unexpected data");
292 break;
293 default:
294 conf_warning("unexpected data");
295 continue; 286 continue;
296 } 287 }
297 if (sym && sym_is_choice_value(sym)) { 288 if (sym && sym_is_choice_value(sym)) {
@@ -406,9 +397,9 @@ static void conf_write_string(bool headerfile, const char *name,
406{ 397{
407 int l; 398 int l;
408 if (headerfile) 399 if (headerfile)
409 fprintf(out, "#define CONFIG_%s \"", name); 400 fprintf(out, "#define %s%s \"", CONFIG_, name);
410 else 401 else
411 fprintf(out, "CONFIG_%s=\"", name); 402 fprintf(out, "%s%s=\"", CONFIG_, name);
412 403
413 while (1) { 404 while (1) {
414 l = strcspn(str, "\"\\"); 405 l = strcspn(str, "\"\\");
@@ -434,13 +425,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
434 switch (sym_get_tristate_value(sym)) { 425 switch (sym_get_tristate_value(sym)) {
435 case no: 426 case no:
436 if (write_no) 427 if (write_no)
437 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 428 fprintf(out, "# %s%s is not set\n",
429 CONFIG_, sym->name);
438 break; 430 break;
439 case mod: 431 case mod:
440 fprintf(out, "CONFIG_%s=m\n", sym->name); 432 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
441 break; 433 break;
442 case yes: 434 case yes:
443 fprintf(out, "CONFIG_%s=y\n", sym->name); 435 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
444 break; 436 break;
445 } 437 }
446 break; 438 break;
@@ -450,7 +442,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
450 case S_HEX: 442 case S_HEX:
451 case S_INT: 443 case S_INT:
452 str = sym_get_string_value(sym); 444 str = sym_get_string_value(sym);
453 fprintf(out, "CONFIG_%s=%s\n", sym->name, str); 445 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
454 break; 446 break;
455 case S_OTHER: 447 case S_OTHER:
456 case S_UNKNOWN: 448 case S_UNKNOWN:
@@ -582,8 +574,6 @@ int conf_write(const char *name)
582 if (!out) 574 if (!out)
583 return 1; 575 return 1;
584 576
585 sym = sym_lookup("KERNELVERSION", 0);
586 sym_calc_value(sym);
587 time(&now); 577 time(&now);
588 env = getenv("KCONFIG_NOTIMESTAMP"); 578 env = getenv("KCONFIG_NOTIMESTAMP");
589 if (env && *env) 579 if (env && *env)
@@ -591,10 +581,10 @@ int conf_write(const char *name)
591 581
592 fprintf(out, _("#\n" 582 fprintf(out, _("#\n"
593 "# Automatically generated make config: don't edit\n" 583 "# Automatically generated make config: don't edit\n"
594 "# Linux kernel version: %s\n" 584 "# %s\n"
595 "%s%s" 585 "%s%s"
596 "#\n"), 586 "#\n"),
597 sym_get_string_value(sym), 587 rootmenu.prompt->text,
598 use_timestamp ? "# " : "", 588 use_timestamp ? "# " : "",
599 use_timestamp ? ctime(&now) : ""); 589 use_timestamp ? ctime(&now) : "");
600 590
@@ -805,25 +795,23 @@ int conf_write_autoconf(void)
805 return 1; 795 return 1;
806 } 796 }
807 797
808 sym = sym_lookup("KERNELVERSION", 0);
809 sym_calc_value(sym);
810 time(&now); 798 time(&now);
811 fprintf(out, "#\n" 799 fprintf(out, "#\n"
812 "# Automatically generated make config: don't edit\n" 800 "# Automatically generated make config: don't edit\n"
813 "# Linux kernel version: %s\n" 801 "# %s\n"
814 "# %s" 802 "# %s"
815 "#\n", 803 "#\n",
816 sym_get_string_value(sym), ctime(&now)); 804 rootmenu.prompt->text, ctime(&now));
817 fprintf(tristate, "#\n" 805 fprintf(tristate, "#\n"
818 "# Automatically generated - do not edit\n" 806 "# Automatically generated - do not edit\n"
819 "\n"); 807 "\n");
820 fprintf(out_h, "/*\n" 808 fprintf(out_h, "/*\n"
821 " * Automatically generated C config: don't edit\n" 809 " * Automatically generated C config: don't edit\n"
822 " * Linux kernel version: %s\n" 810 " * %s\n"
823 " * %s" 811 " * %s"
824 " */\n" 812 " */\n"
825 "#define AUTOCONF_INCLUDED\n", 813 "#define AUTOCONF_INCLUDED\n",
826 sym_get_string_value(sym), ctime(&now)); 814 rootmenu.prompt->text, ctime(&now));
827 815
828 for_all_symbols(i, sym) { 816 for_all_symbols(i, sym) {
829 sym_calc_value(sym); 817 sym_calc_value(sym);
@@ -841,14 +829,17 @@ int conf_write_autoconf(void)
841 case no: 829 case no:
842 break; 830 break;
843 case mod: 831 case mod:
844 fprintf(tristate, "CONFIG_%s=M\n", sym->name); 832 fprintf(tristate, "%s%s=M\n",
845 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 833 CONFIG_, sym->name);
834 fprintf(out_h, "#define %s%s_MODULE 1\n",
835 CONFIG_, sym->name);
846 break; 836 break;
847 case yes: 837 case yes:
848 if (sym->type == S_TRISTATE) 838 if (sym->type == S_TRISTATE)
849 fprintf(tristate, "CONFIG_%s=Y\n", 839 fprintf(tristate,"%s%s=Y\n",
850 sym->name); 840 CONFIG_, sym->name);
851 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 841 fprintf(out_h, "#define %s%s 1\n",
842 CONFIG_, sym->name);
852 break; 843 break;
853 } 844 }
854 break; 845 break;
@@ -858,12 +849,14 @@ int conf_write_autoconf(void)
858 case S_HEX: 849 case S_HEX:
859 str = sym_get_string_value(sym); 850 str = sym_get_string_value(sym);
860 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { 851 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
861 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); 852 fprintf(out_h, "#define %s%s 0x%s\n",
853 CONFIG_, sym->name, str);
862 break; 854 break;
863 } 855 }
864 case S_INT: 856 case S_INT:
865 str = sym_get_string_value(sym); 857 str = sym_get_string_value(sym);
866 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); 858 fprintf(out_h, "#define %s%s %s\n",
859 CONFIG_, sym->name, str);
867 break; 860 break;
868 default: 861 default:
869 break; 862 break;