annotate kconfig/confdata.c @ 683:8d7fbb4c2205

Add vconfig.c - Creates virtual ethernet devices.
author Kyungwan Han <asura321@gmail.com>
date Thu, 01 Nov 2012 09:55:29 -0500
parents a3b8838c3908
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
1 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
3 * Released under the terms of the GNU GPL v2.0.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
4 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
5
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
6 #include <sys/stat.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
7 #include <ctype.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
8 #include <errno.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
9 #include <fcntl.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
10 #include <limits.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
11 #include <stdio.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
12 #include <stdlib.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
13 #include <string.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
14 #include <time.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
15 #include <unistd.h>
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
16
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
17 #define LKC_DIRECT_LINK
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
18 #include "lkc.h"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
19
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
20 static void conf_warning(const char *fmt, ...)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
21 __attribute__ ((format (printf, 1, 2)));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
22
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
23 static const char *conf_filename;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
24 static int conf_lineno, conf_warnings, conf_unsaved;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
25
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
26 #ifndef conf_defname
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
27 const char conf_defname[] = "arch/$ARCH/defconfig";
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
28 #endif
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
29
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
30 #ifndef CONFIG_PREFIX
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
31 #define CONFIG_PREFIX "CONFIG_"
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
32 #endif
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
33
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
34 static void conf_warning(const char *fmt, ...)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
35 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
36 va_list ap;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
37 va_start(ap, fmt);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
38 fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
39 vfprintf(stderr, fmt, ap);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
40 fprintf(stderr, "\n");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
41 va_end(ap);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
42 conf_warnings++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
43 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
44
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
45 const char *conf_get_configname(void)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
46 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
47 char *name = getenv("KCONFIG_CONFIG");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
48
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
49 return name ? name : ".config";
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
50 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
51
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
52 static char *conf_expand_value(const char *in)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
53 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
54 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
55 const char *src;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
56 static char res_value[SYMBOL_MAXLENGTH];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
57 char *dst, name[SYMBOL_MAXLENGTH];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
58
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
59 res_value[0] = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
60 dst = name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
61 while ((src = strchr(in, '$'))) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
62 strncat(res_value, in, src - in);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
63 src++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
64 dst = name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
65 while (isalnum(*src) || *src == '_')
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
66 *dst++ = *src++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
67 *dst = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
68 sym = sym_lookup(name, 0);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
69 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
70 strcat(res_value, sym_get_string_value(sym));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
71 in = src;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
72 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
73 strcat(res_value, in);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
74
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
75 return res_value;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
76 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
77
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
78 char *conf_get_default_confname(void)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
79 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
80 struct stat buf;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
81 static char fullname[PATH_MAX+1];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
82 char *env, *name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
83
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
84 name = conf_expand_value(conf_defname);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
85 env = getenv(SRCTREE);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
86 if (env) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
87 sprintf(fullname, "%s/%s", env, name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
88 if (!stat(fullname, &buf))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
89 return fullname;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
90 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
91 return name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
92 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
93
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
94 int conf_read_simple(const char *name, int def)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
95 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
96 FILE *in = NULL;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
97 char line[1024];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
98 char *p, *p2;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
99 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
100 int i, def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
101
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
102 if (name) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
103 in = zconf_fopen(name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
104 } else {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
105 struct property *prop;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
106
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
107 name = conf_get_configname();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
108 in = zconf_fopen(name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
109 if (in)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
110 goto load;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
111 sym_change_count++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
112 if (!sym_defconfig_list)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
113 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
114
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
115 for_all_defaults(sym_defconfig_list, prop) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
116 if (expr_calc_value(prop->visible.expr) == no ||
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
117 prop->expr->type != E_SYMBOL)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
118 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
119 name = conf_expand_value(prop->expr->left.sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
120 in = zconf_fopen(name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
121 if (in) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
122 printf(_("#\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
123 "# using defaults found in %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
124 "#\n"), name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
125 goto load;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
126 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
127 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
128 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
129 if (!in)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
130 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
131
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
132 load:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
133 conf_filename = name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
134 conf_lineno = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
135 conf_warnings = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
136 conf_unsaved = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
137
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
138 def_flags = SYMBOL_DEF << def;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
139 for_all_symbols(i, sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
140 sym->flags |= SYMBOL_CHANGED;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
141 sym->flags &= ~(def_flags|SYMBOL_VALID);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
142 if (sym_is_choice(sym))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
143 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
144 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
145 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
146 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
147 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
148 if (sym->def[def].val)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
149 free(sym->def[def].val);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
150 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
151 sym->def[def].val = NULL;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
152 sym->def[def].tri = no;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
153 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
154 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
155
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
156 while (fgets(line, sizeof(line), in)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
157 conf_lineno++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
158 sym = NULL;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
159 switch (line[0]) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
160 case '#':
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
161 if (line[1]!=' ' || memcmp(line + 2, CONFIG_PREFIX,
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
162 strlen(CONFIG_PREFIX))) {
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
163 continue;
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
164 }
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
165 p = strchr(line + 2 + strlen(CONFIG_PREFIX), ' ');
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
166 if (!p)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
167 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
168 *p++ = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
169 if (strncmp(p, "is not set", 10))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
170 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
171 if (def == S_DEF_USER) {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
172 sym = sym_find(line + 2 + strlen(CONFIG_PREFIX));
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
173 if (!sym) {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
174 conf_warning("trying to assign nonexistent symbol %s", line + 2 + strlen(CONFIG_PREFIX));
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
175 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
176 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
177 } else {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
178 sym = sym_lookup(line + 9, 0);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
179 if (sym->type == S_UNKNOWN)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
180 sym->type = S_BOOLEAN;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
181 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
182 if (sym->flags & def_flags) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
183 conf_warning("trying to reassign symbol %s", sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
184 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
185 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
186 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
187 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
188 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
189 sym->def[def].tri = no;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
190 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
191 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
192 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
193 ;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
194 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
195 break;
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
196 case 'A' ... 'Z':
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
197 if (memcmp(line, CONFIG_PREFIX, strlen(CONFIG_PREFIX))) {
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
198 conf_warning("unexpected data");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
199 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
200 }
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
201 p = strchr(line + strlen(CONFIG_PREFIX), '=');
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
202 if (!p)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
203 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
204 *p++ = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
205 p2 = strchr(p, '\n');
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
206 if (p2) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
207 *p2-- = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
208 if (*p2 == '\r')
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
209 *p2 = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
210 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
211 if (def == S_DEF_USER) {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
212 sym = sym_find(line + strlen(CONFIG_PREFIX));
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
213 if (!sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
214 conf_warning("trying to assign nonexistent symbol %s", line + 7);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
215 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
216 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
217 } else {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
218 sym = sym_lookup(line + strlen(CONFIG_PREFIX), 0);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
219 if (sym->type == S_UNKNOWN)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
220 sym->type = S_OTHER;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
221 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
222 if (sym->flags & def_flags) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
223 conf_warning("trying to reassign symbol %s", sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
224 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
225 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
226 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
227 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
228 if (p[0] == 'm') {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
229 sym->def[def].tri = mod;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
230 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
231 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
232 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
233 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
234 if (p[0] == 'y') {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
235 sym->def[def].tri = yes;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
236 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
237 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
238 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
239 if (p[0] == 'n') {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
240 sym->def[def].tri = no;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
241 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
242 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
243 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
244 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
245 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
246 case S_OTHER:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
247 if (*p != '"') {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
248 for (p2 = p; *p2 && !isspace(*p2); p2++)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
249 ;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
250 sym->type = S_STRING;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
251 goto done;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
252 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
253 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
254 if (*p++ != '"')
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
255 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
256 for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
257 if (*p2 == '"') {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
258 *p2 = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
259 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
260 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
261 memmove(p2, p2 + 1, strlen(p2));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
262 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
263 if (!p2) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
264 conf_warning("invalid string found");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
265 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
266 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
267 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
268 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
269 done:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
270 if (sym_string_valid(sym, p)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
271 sym->def[def].val = strdup(p);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
272 sym->flags |= def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
273 } else {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
274 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
275 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
276 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
277 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
278 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
279 ;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
280 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
281 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
282 case '\r':
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
283 case '\n':
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
284 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
285 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
286 conf_warning("unexpected data");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
287 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
288 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
289 if (sym && sym_is_choice_value(sym)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
290 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
291 switch (sym->def[def].tri) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
292 case no:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
293 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
294 case mod:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
295 if (cs->def[def].tri == yes) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
296 conf_warning("%s creates inconsistent choice state", sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
297 cs->flags &= ~def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
298 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
299 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
300 case yes:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
301 if (cs->def[def].tri != no) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
302 conf_warning("%s creates inconsistent choice state", sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
303 cs->flags &= ~def_flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
304 } else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
305 cs->def[def].val = sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
306 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
307 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
308 cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
309 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
310 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
311 fclose(in);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
312
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
313 if (modules_sym)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
314 sym_calc_value(modules_sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
315 return 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
316 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
317
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
318 int conf_read(const char *name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
319 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
320 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
321 struct property *prop;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
322 struct expr *e;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
323 int i, flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
324
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
325 sym_change_count = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
326
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
327 if (conf_read_simple(name, S_DEF_USER))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
328 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
329
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
330 for_all_symbols(i, sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
331 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
332 if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
333 goto sym_ok;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
334 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
335 /* check that calculated value agrees with saved value */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
336 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
337 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
338 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
339 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
340 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
341 if (!sym_is_choice(sym))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
342 goto sym_ok;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
343 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
344 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
345 goto sym_ok;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
346 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
347 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
348 } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
349 /* no previous value and not saved */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
350 goto sym_ok;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
351 conf_unsaved++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
352 /* maybe print value in verbose mode... */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
353 sym_ok:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
354 if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
355 if (sym->visible == no)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
356 sym->flags &= ~SYMBOL_DEF_USER;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
357 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
358 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
359 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
360 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
361 if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
362 sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
363 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
364 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
365 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
366 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
367 if (!sym_is_choice(sym))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
368 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
369 prop = sym_get_choice_prop(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
370 flags = sym->flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
371 for (e = prop->expr; e; e = e->left.expr)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
372 if (e->right.sym->visible != no)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
373 flags &= e->right.sym->flags;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
374 sym->flags &= flags | ~SYMBOL_DEF_USER;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
375 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
376
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
377 sym_change_count += conf_warnings || conf_unsaved;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
378
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
379 return 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
380 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
381
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
382 struct menu *next_menu(struct menu *menu)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
383 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
384 if (menu->list) return menu->list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
385 do {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
386 if (menu->next) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
387 menu = menu->next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
388 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
389 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
390 } while ((menu = menu->parent));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
391
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
392 return menu;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
393 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
394
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
395 #define SYMBOL_FORCEWRITE (1<<31)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
396
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
397 int conf_write(const char *name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
398 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
399 FILE *out;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
400 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
401 struct menu *menu;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
402 const char *basename;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
403 char dirname[128], tmpname[128], newname[128];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
404 int type, l, writetype;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
405 const char *str;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
406 time_t now;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
407 int use_timestamp = 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
408 char *env;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
409
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
410 dirname[0] = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
411 if (name && name[0]) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
412 struct stat st;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
413 char *slash;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
414
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
415 if (!stat(name, &st) && S_ISDIR(st.st_mode)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
416 strcpy(dirname, name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
417 strcat(dirname, "/");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
418 basename = conf_get_configname();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
419 } else if ((slash = strrchr(name, '/'))) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
420 int size = slash - name + 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
421 memcpy(dirname, name, size);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
422 dirname[size] = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
423 if (slash[1])
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
424 basename = slash + 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
425 else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
426 basename = conf_get_configname();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
427 } else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
428 basename = name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
429 } else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
430 basename = conf_get_configname();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
431
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
432 sprintf(newname, "%s%s", dirname, basename);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
433 env = getenv("KCONFIG_OVERWRITECONFIG");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
434 if (!env || !*env) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
435 sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
436 out = fopen(tmpname, "w");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
437 } else {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
438 *tmpname = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
439 out = fopen(newname, "w");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
440 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
441 if (!out)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
442 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
443
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
444 sym = sym_lookup("KCONFIG_VERSION", 0);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
445 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
446 time(&now);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
447 env = getenv("KCONFIG_NOTIMESTAMP");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
448 if (env && *env)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
449 use_timestamp = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
450
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
451 fprintf(out, _("#\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
452 "# Automatically generated make config: don't edit\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
453 "# "PROJECT_NAME" version: %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
454 "%s%s"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
455 "#\n"),
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
456 sym_get_string_value(sym),
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
457 use_timestamp ? "# " : "",
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
458 use_timestamp ? ctime(&now) : "");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
459
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
460 if (!sym_change_count)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
461 sym_clear_all_valid();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
462
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
463 // Write out all symbols (even in closed sub-menus).
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
464 if (1) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
465 for (menu = rootmenu.list; menu; menu = next_menu(menu))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
466 if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
467 writetype = SYMBOL_FORCEWRITE;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
468
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
469 // Don't write out symbols in closed menus.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
470
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
471 } else writetype = SYMBOL_WRITE;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
472
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
473
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
474 menu = rootmenu.list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
475 while (menu) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
476 sym = menu->sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
477 if (!sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
478 if (!menu_is_visible(menu))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
479 goto next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
480 str = menu_get_prompt(menu);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
481 fprintf(out, "\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
482 "#\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
483 "# %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
484 "#\n", str);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
485 } else if (!(sym->flags & SYMBOL_CHOICE)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
486 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
487 if (!(sym->flags & writetype))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
488 goto next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
489 sym->flags &= ~writetype;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
490 type = sym->type;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
491 if (type == S_TRISTATE) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
492 sym_calc_value(modules_sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
493 if (modules_sym->curr.tri == no)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
494 type = S_BOOLEAN;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
495 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
496 switch (type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
497 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
498 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
499 switch (sym_get_tristate_value(sym)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
500 case no:
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
501 fprintf(out, "# "CONFIG_PREFIX"%s is not set\n", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
502 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
503 case mod:
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
504 fprintf(out, CONFIG_PREFIX"%s=m\n", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
505 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
506 case yes:
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
507 fprintf(out, CONFIG_PREFIX"%s=y\n", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
508 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
509 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
510 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
511 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
512 str = sym_get_string_value(sym);
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
513 fprintf(out, CONFIG_PREFIX"%s=\"", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
514 while (1) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
515 l = strcspn(str, "\"\\");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
516 if (l) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
517 fwrite(str, l, 1, out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
518 str += l;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
519 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
520 if (!*str)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
521 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
522 fprintf(out, "\\%c", *str++);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
523 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
524 fputs("\"\n", out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
525 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
526 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
527 str = sym_get_string_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
528 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
529 fprintf(out, CONFIG_PREFIX"%s=%s\n", sym->name, *str ? str : "0");
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
530 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
531 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
532 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
533 str = sym_get_string_value(sym);
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
534 fprintf(out, CONFIG_PREFIX"%s=%s\n", sym->name, *str ? str : "0");
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
535 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
536 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
537 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
538
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
539 next:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
540 if (writetype == SYMBOL_WRITE) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
541 if (menu->list) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
542 menu = menu->list;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
543 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
544 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
545 if (menu->next)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
546 menu = menu->next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
547 else while ((menu = menu->parent)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
548 if (menu->next) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
549 menu = menu->next;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
550 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
551 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
552 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
553 } else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
554 menu = next_menu(menu);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
555 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
556 fclose(out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
557
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
558 if (*tmpname) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
559 strcat(dirname, basename);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
560 strcat(dirname, ".old");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
561 rename(newname, dirname);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
562 if (rename(tmpname, newname))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
563 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
564 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
565
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
566 printf(_("#\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
567 "# configuration written to %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
568 "#\n"), newname);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
569
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
570 sym_change_count = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
571
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
572 return 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
573 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
574
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
575 int conf_split_config(void)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
576 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
577 char *name, path[128];
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
578 char *s, *d, c;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
579 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
580 struct stat sb;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
581 int res, i, fd;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
582
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
583 name = getenv("KCONFIG_AUTOCONFIG");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
584 if (!name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
585 name = "include/config/auto.conf";
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
586 conf_read_simple(name, S_DEF_AUTO);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
587
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
588 if (chdir("include/config"))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
589 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
590
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
591 res = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
592 for_all_symbols(i, sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
593 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
594 if ((sym->flags & SYMBOL_AUTO) || !sym->name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
595 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
596 if (sym->flags & SYMBOL_WRITE) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
597 if (sym->flags & SYMBOL_DEF_AUTO) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
598 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
599 * symbol has old and new value,
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
600 * so compare them...
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
601 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
602 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
603 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
604 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
605 if (sym_get_tristate_value(sym) ==
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
606 sym->def[S_DEF_AUTO].tri)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
607 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
608 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
609 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
610 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
611 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
612 if (!strcmp(sym_get_string_value(sym),
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
613 sym->def[S_DEF_AUTO].val))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
614 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
615 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
616 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
617 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
618 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
619 } else {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
620 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
621 * If there is no old value, only 'no' (unset)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
622 * is allowed as new value.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
623 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
624 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
625 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
626 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
627 if (sym_get_tristate_value(sym) == no)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
628 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
629 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
630 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
631 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
632 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
633 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
634 } else if (!(sym->flags & SYMBOL_DEF_AUTO))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
635 /* There is neither an old nor a new value. */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
636 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
637 /* else
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
638 * There is an old value, but no new value ('no' (unset)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
639 * isn't saved in auto.conf, so the old value is always
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
640 * different from 'no').
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
641 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
642
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
643 /* Replace all '_' and append ".h" */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
644 s = sym->name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
645 d = path;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
646 while ((c = *s++)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
647 c = tolower(c);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
648 *d++ = (c == '_') ? '/' : c;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
649 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
650 strcpy(d, ".h");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
651
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
652 /* Assume directory path already exists. */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
653 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
654 if (fd == -1) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
655 if (errno != ENOENT) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
656 res = 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
657 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
658 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
659 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
660 * Create directory components,
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
661 * unless they exist already.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
662 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
663 d = path;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
664 while ((d = strchr(d, '/'))) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
665 *d = 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
666 if (stat(path, &sb) && mkdir(path, 0755)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
667 res = 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
668 goto out;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
669 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
670 *d++ = '/';
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
671 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
672 /* Try it again. */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
673 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
674 if (fd == -1) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
675 res = 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
676 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
677 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
678 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
679 close(fd);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
680 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
681 out:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
682 if (chdir("../.."))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
683 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
684
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
685 return res;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
686 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
687
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
688 int conf_write_autoconf(void)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
689 {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
690 struct symbol *sym;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
691 const char *str;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
692 char *name;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
693 FILE *out, *out_h;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
694 time_t now;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
695 int i, l;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
696
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
697 sym_clear_all_valid();
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
698
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
699 file_write_dep("include/config/auto.conf.cmd");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
700
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
701 if (conf_split_config())
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
702 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
703
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
704 out = fopen(".tmpconfig", "w");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
705 if (!out)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
706 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
707
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
708 out_h = fopen(".tmpconfig.h", "w");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
709 if (!out_h) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
710 fclose(out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
711 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
712 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
713
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
714 sym = sym_lookup("KCONFIG_VERSION", 0);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
715 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
716 time(&now);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
717 fprintf(out, "#\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
718 "# Automatically generated make config: don't edit\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
719 "# "PROJECT_NAME" version: %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
720 "# %s"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
721 "#\n",
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
722 sym_get_string_value(sym), ctime(&now));
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
723 fprintf(out_h, "/*\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
724 " * Automatically generated C config: don't edit\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
725 " * "PROJECT_NAME" version: %s\n"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
726 " * %s"
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
727 " */\n"
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
728 // "#define AUTOCONF_INCLUDED\n"
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
729 , sym_get_string_value(sym), ctime(&now));
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
730
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
731 for_all_symbols(i, sym) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
732 sym_calc_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
733 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
734 continue;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
735 switch (sym->type) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
736 case S_BOOLEAN:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
737 case S_TRISTATE:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
738 switch (sym_get_tristate_value(sym)) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
739 case no:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
740 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
741 case mod:
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
742 fprintf(out, CONFIG_PREFIX"%s=m\n", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
743 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
744 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
745 case yes:
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
746 fprintf(out, CONFIG_PREFIX"%s=y\n", sym->name);
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
747 fprintf(out_h, "#define "CONFIG_PREFIX"%s 1\n", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
748 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
749 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
750 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
751 case S_STRING:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
752 str = sym_get_string_value(sym);
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
753 fprintf(out, CONFIG_PREFIX"%s=\"", sym->name);
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
754 fprintf(out_h, "#define "CONFIG_PREFIX"%s \"", sym->name);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
755 while (1) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
756 l = strcspn(str, "\"\\");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
757 if (l) {
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
758 fwrite(str, l, 1, out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
759 fwrite(str, l, 1, out_h);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
760 str += l;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
761 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
762 if (!*str)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
763 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
764 fprintf(out, "\\%c", *str);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
765 fprintf(out_h, "\\%c", *str);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
766 str++;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
767 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
768 fputs("\"\n", out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
769 fputs("\"\n", out_h);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
770 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
771 case S_HEX:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
772 str = sym_get_string_value(sym);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
773 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
774 fprintf(out, CONFIG_PREFIX"%s=%s\n", sym->name, str);
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
775 fprintf(out_h, "#define "CONFIG_PREFIX"%s 0x%s\n", sym->name, str);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
776 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
777 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
778 case S_INT:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
779 str = sym_get_string_value(sym);
111
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
780 fprintf(out, CONFIG_PREFIX"%s=%s\n", sym->name, str);
a3b8838c3908 Apply uClibc's changes to this kconfig.
Rob Landley <rob@landley.net>
parents: 10
diff changeset
781 fprintf(out_h, "#define "CONFIG_PREFIX"%s %s\n", sym->name, str);
10
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
782 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
783 default:
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
784 break;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
785 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
786 }
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
787 fclose(out);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
788 fclose(out_h);
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
789
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
790 name = getenv("KCONFIG_AUTOHEADER");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
791 if (!name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
792 name = "include/linux/autoconf.h";
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
793 if (rename(".tmpconfig.h", name))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
794 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
795 name = getenv("KCONFIG_AUTOCONFIG");
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
796 if (!name)
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
797 name = "include/config/auto.conf";
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
798 /*
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
799 * This must be the last step, kbuild has a dependency on auto.conf
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
800 * and this marks the successful completion of the previous steps.
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
801 */
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
802 if (rename(".tmpconfig", name))
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
803 return 1;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
804
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
805 return 0;
4d21d59f3206 Add menuconfig, plus some basic Config info, lots of which is just future
landley@driftwood
parents:
diff changeset
806 }