mb/google/rauru: Add pwrsel init in romstage
[coreboot2.git] / util / kconfig / patches / 0009-util-kconfig-Allow-emitting-false-booleans-into-kconfig-output.patch
blob6fd2eab740436b58cd504dfd1dcb26cbeea6b922
1 commit ab0cc6067d5a00182e89fbec82b942eb3d803204
2 Author: Patrick Georgi <pgeorgi@google.com>
3 Date: Fri Nov 22 22:08:15 2019 +0100
5 util/kconfig: Allow emitting false booleans into kconfig output
7 This is controlled by an environment variable so the same tool is
8 useful in different contexts.
10 Change-Id: I9e62b05e45709f1539e455e2eed37308609be15e
11 Signed-off-by: Patrick Georgi <pgeorgi@google.com>
13 Index: kconfig/confdata.c
14 ===================================================================
15 --- kconfig.orig/confdata.c
16 +++ kconfig/confdata.c
17 @@ -731,7 +731,12 @@ static void print_symbol_for_dotconfig(F
19 static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym)
21 - __print_symbol(fp, sym, OUTPUT_N_NONE, false);
22 + int print_negatives = getenv("KCONFIG_NEGATIVES") != NULL;
23 + enum output_n out = OUTPUT_N_NONE;
24 + if (print_negatives) {
25 + out = OUTPUT_N;
26 + }
27 + __print_symbol(fp, sym, out, false);
30 void print_symbol_for_listconfig(struct symbol *sym)
31 @@ -756,6 +761,10 @@ static void print_symbol_for_c(FILE *fp,
32 case S_TRISTATE:
33 switch (*val) {
34 case 'n':
35 + if (getenv("KCONFIG_NEGATIVES") != NULL) {
36 + val = "0";
37 + break;
38 + }
39 return;
40 case 'm':
41 sym_suffix = "_MODULE";
42 @@ -767,6 +776,12 @@ static void print_symbol_for_c(FILE *fp,
43 case S_HEX:
44 if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X'))
45 val_prefix = "0x";
46 + /* fall through */
47 + case S_INT:
48 + if (val[0] == '\0') {
49 + val = "0";
50 + val_prefix = "";
51 + }
52 break;
53 case S_STRING:
54 escaped = escape_string_value(val);
55 @@ -1183,8 +1198,9 @@ static int __conf_write_autoconf(const c
57 conf_write_heading(file, comment_style);
59 + int print_negatives = getenv("KCONFIG_NEGATIVES") != NULL;
60 for_all_symbols(i, sym)
61 - if ((sym->flags & SYMBOL_WRITE) && sym->name)
62 + if (((sym->flags & SYMBOL_WRITE) || (print_negatives && sym->type != S_STRING)) && sym->name)
63 print_symbol(file, sym);
65 fflush(file);