mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-30 09:38:52 +00:00
Update to latest kconfig from linux-2.6.20.7.
I'm not sure of the improvements, but at least we're up-to-date, and updating in the future will be easier.
This commit is contained in:
parent
5fbbd29ee6
commit
afaffaea38
@ -557,7 +557,7 @@ int main(int ac, char **av)
|
|||||||
case ask_silent:
|
case ask_silent:
|
||||||
if (stat(".config", &tmpstat)) {
|
if (stat(".config", &tmpstat)) {
|
||||||
printf(_("***\n"
|
printf(_("***\n"
|
||||||
"*** You have not yet configured your "PROJECT_NAME"!\n"
|
"*** You have not yet configured "PROJECT_NAME"!\n"
|
||||||
"***\n"
|
"***\n"
|
||||||
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
|
"*** Please run some configurator (e.g. \"make oldconfig\" or\n"
|
||||||
"*** \"make menuconfig\" or \"make xconfig\").\n"
|
"*** \"make menuconfig\" or \"make xconfig\").\n"
|
||||||
@ -600,7 +600,7 @@ int main(int ac, char **av)
|
|||||||
input_mode = ask_silent;
|
input_mode = ask_silent;
|
||||||
valid_stdin = 1;
|
valid_stdin = 1;
|
||||||
}
|
}
|
||||||
} else if (sym_change_count) {
|
} else if (conf_get_changed()) {
|
||||||
name = getenv("KCONFIG_NOSILENTUPDATE");
|
name = getenv("KCONFIG_NOSILENTUPDATE");
|
||||||
if (name && *name) {
|
if (name && *name) {
|
||||||
fprintf(stderr, _("\n*** "PROJECT_NAME" configuration requires explicit update.\n\n"));
|
fprintf(stderr, _("\n*** "PROJECT_NAME" configuration requires explicit update.\n\n"));
|
||||||
@ -613,11 +613,11 @@ int main(int ac, char **av)
|
|||||||
conf_cnt = 0;
|
conf_cnt = 0;
|
||||||
check_conf(&rootmenu);
|
check_conf(&rootmenu);
|
||||||
} while (conf_cnt);
|
} while (conf_cnt);
|
||||||
|
if (conf_write(NULL)) {
|
||||||
if (!conf_write(NULL)) {
|
fprintf(stderr, _("\n*** Error during writing of "PROJECT_NAME" configuration.\n\n"));
|
||||||
skip_check:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fprintf(stderr, _("\n*** Error writing "PROJECT_NAME" configuration.\n\n"));
|
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
skip_check:
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -23,9 +21,7 @@ static void conf_warning(const char *fmt, ...)
|
|||||||
static const char *conf_filename;
|
static const char *conf_filename;
|
||||||
static int conf_lineno, conf_warnings, conf_unsaved;
|
static int conf_lineno, conf_warnings, conf_unsaved;
|
||||||
|
|
||||||
#ifndef conf_defname
|
|
||||||
const char conf_defname[] = "arch/$ARCH/defconfig";
|
const char conf_defname[] = "arch/$ARCH/defconfig";
|
||||||
#endif
|
|
||||||
|
|
||||||
static void conf_warning(const char *fmt, ...)
|
static void conf_warning(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@ -104,7 +100,7 @@ int conf_read_simple(const char *name, int def)
|
|||||||
in = zconf_fopen(name);
|
in = zconf_fopen(name);
|
||||||
if (in)
|
if (in)
|
||||||
goto load;
|
goto load;
|
||||||
sym_change_count++;
|
sym_add_change_count(1);
|
||||||
if (!sym_defconfig_list)
|
if (!sym_defconfig_list)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -316,7 +312,7 @@ int conf_read(const char *name)
|
|||||||
struct expr *e;
|
struct expr *e;
|
||||||
int i, flags;
|
int i, flags;
|
||||||
|
|
||||||
sym_change_count = 0;
|
sym_set_change_count(0);
|
||||||
|
|
||||||
if (conf_read_simple(name, S_DEF_USER))
|
if (conf_read_simple(name, S_DEF_USER))
|
||||||
return 1;
|
return 1;
|
||||||
@ -368,26 +364,11 @@ int conf_read(const char *name)
|
|||||||
sym->flags &= flags | ~SYMBOL_DEF_USER;
|
sym->flags &= flags | ~SYMBOL_DEF_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
sym_change_count += conf_warnings || conf_unsaved;
|
sym_add_change_count(conf_warnings || conf_unsaved);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct menu *next_menu(struct menu *menu)
|
|
||||||
{
|
|
||||||
if (menu->list) return menu->list;
|
|
||||||
do {
|
|
||||||
if (menu->next) {
|
|
||||||
menu = menu->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while ((menu = menu->parent));
|
|
||||||
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define SYMBOL_FORCEWRITE (1<<31)
|
|
||||||
|
|
||||||
int conf_write(const char *name)
|
int conf_write(const char *name)
|
||||||
{
|
{
|
||||||
FILE *out;
|
FILE *out;
|
||||||
@ -395,7 +376,7 @@ int conf_write(const char *name)
|
|||||||
struct menu *menu;
|
struct menu *menu;
|
||||||
const char *basename;
|
const char *basename;
|
||||||
char dirname[128], tmpname[128], newname[128];
|
char dirname[128], tmpname[128], newname[128];
|
||||||
int type, l, writetype;
|
int type, l;
|
||||||
const char *str;
|
const char *str;
|
||||||
time_t now;
|
time_t now;
|
||||||
int use_timestamp = 1;
|
int use_timestamp = 1;
|
||||||
@ -451,20 +432,9 @@ int conf_write(const char *name)
|
|||||||
use_timestamp ? "# " : "",
|
use_timestamp ? "# " : "",
|
||||||
use_timestamp ? ctime(&now) : "");
|
use_timestamp ? ctime(&now) : "");
|
||||||
|
|
||||||
if (!sym_change_count)
|
if (!conf_get_changed())
|
||||||
sym_clear_all_valid();
|
sym_clear_all_valid();
|
||||||
|
|
||||||
// Write out all symbols (even in closed sub-menus).
|
|
||||||
if (1) {
|
|
||||||
for (menu = rootmenu.list; menu; menu = next_menu(menu))
|
|
||||||
if (menu->sym) menu->sym->flags |= SYMBOL_FORCEWRITE;
|
|
||||||
writetype = SYMBOL_FORCEWRITE;
|
|
||||||
|
|
||||||
// Don't write out symbols in closed menus.
|
|
||||||
|
|
||||||
} else writetype = SYMBOL_WRITE;
|
|
||||||
|
|
||||||
|
|
||||||
menu = rootmenu.list;
|
menu = rootmenu.list;
|
||||||
while (menu) {
|
while (menu) {
|
||||||
sym = menu->sym;
|
sym = menu->sym;
|
||||||
@ -478,9 +448,9 @@ int conf_write(const char *name)
|
|||||||
"#\n", str);
|
"#\n", str);
|
||||||
} else if (!(sym->flags & SYMBOL_CHOICE)) {
|
} else if (!(sym->flags & SYMBOL_CHOICE)) {
|
||||||
sym_calc_value(sym);
|
sym_calc_value(sym);
|
||||||
if (!(sym->flags & writetype))
|
if (!(sym->flags & SYMBOL_WRITE))
|
||||||
goto next;
|
goto next;
|
||||||
sym->flags &= ~writetype;
|
sym->flags &= ~SYMBOL_WRITE;
|
||||||
type = sym->type;
|
type = sym->type;
|
||||||
if (type == S_TRISTATE) {
|
if (type == S_TRISTATE) {
|
||||||
sym_calc_value(modules_sym);
|
sym_calc_value(modules_sym);
|
||||||
@ -520,18 +490,17 @@ int conf_write(const char *name)
|
|||||||
case S_HEX:
|
case S_HEX:
|
||||||
str = sym_get_string_value(sym);
|
str = sym_get_string_value(sym);
|
||||||
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
|
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
|
||||||
fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
|
fprintf(out, "CT_%s=%s\n", sym->name, str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case S_INT:
|
case S_INT:
|
||||||
str = sym_get_string_value(sym);
|
str = sym_get_string_value(sym);
|
||||||
fprintf(out, "CT_%s=%s\n", sym->name, *str ? str : "0");
|
fprintf(out, "CT_%s=%s\n", sym->name, str);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
if (writetype == SYMBOL_WRITE) {
|
|
||||||
if (menu->list) {
|
if (menu->list) {
|
||||||
menu = menu->list;
|
menu = menu->list;
|
||||||
continue;
|
continue;
|
||||||
@ -544,8 +513,6 @@ int conf_write(const char *name)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
menu = next_menu(menu);
|
|
||||||
}
|
}
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
@ -561,7 +528,7 @@ int conf_write(const char *name)
|
|||||||
"# configuration written to %s\n"
|
"# configuration written to %s\n"
|
||||||
"#\n"), newname);
|
"#\n"), newname);
|
||||||
|
|
||||||
sym_change_count = 0;
|
sym_set_change_count(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -798,3 +765,30 @@ int conf_write_autoconf(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sym_change_count;
|
||||||
|
static void (*conf_changed_callback)(void);
|
||||||
|
|
||||||
|
void sym_set_change_count(int count)
|
||||||
|
{
|
||||||
|
int _sym_change_count = sym_change_count;
|
||||||
|
sym_change_count = count;
|
||||||
|
if (conf_changed_callback &&
|
||||||
|
(bool)_sym_change_count != (bool)count)
|
||||||
|
conf_changed_callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sym_add_change_count(int count)
|
||||||
|
{
|
||||||
|
sym_set_change_count(count + sym_change_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool conf_get_changed(void)
|
||||||
|
{
|
||||||
|
return sym_change_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void conf_set_changed_callback(void (*fn)(void))
|
||||||
|
{
|
||||||
|
conf_changed_callback = fn;
|
||||||
|
}
|
||||||
|
@ -6,12 +6,6 @@
|
|||||||
#ifndef LKC_H
|
#ifndef LKC_H
|
||||||
#define LKC_H
|
#define LKC_H
|
||||||
|
|
||||||
#define PROJECT_NAME "crosstool-NG"
|
|
||||||
|
|
||||||
// Make some warnings go away
|
|
||||||
#define YYENABLE_NLS 0
|
|
||||||
#define YYLTYPE_IS_TRIVIAL 0
|
|
||||||
|
|
||||||
#include "expr.h"
|
#include "expr.h"
|
||||||
|
|
||||||
#ifndef KBUILD_NO_NLS
|
#ifndef KBUILD_NO_NLS
|
||||||
@ -37,6 +31,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define SRCTREE "srctree"
|
#define SRCTREE "srctree"
|
||||||
|
|
||||||
|
#define PROJECT_NAME "crosstool-NG"
|
||||||
#define PACKAGE "crosstool-NG"
|
#define PACKAGE "crosstool-NG"
|
||||||
#define LOCALEDIR "/usr/share/locale"
|
#define LOCALEDIR "/usr/share/locale"
|
||||||
|
|
||||||
@ -71,6 +66,8 @@ char *zconf_curname(void);
|
|||||||
|
|
||||||
/* confdata.c */
|
/* confdata.c */
|
||||||
char *conf_get_default_confname(void);
|
char *conf_get_default_confname(void);
|
||||||
|
void sym_set_change_count(int count);
|
||||||
|
void sym_add_change_count(int count);
|
||||||
|
|
||||||
/* kconfig_load.c */
|
/* kconfig_load.c */
|
||||||
void kconfig_load(void);
|
void kconfig_load(void);
|
||||||
|
@ -5,6 +5,8 @@ P(conf_read,int,(const char *name));
|
|||||||
P(conf_read_simple,int,(const char *name, int));
|
P(conf_read_simple,int,(const char *name, int));
|
||||||
P(conf_write,int,(const char *name));
|
P(conf_write,int,(const char *name));
|
||||||
P(conf_write_autoconf,int,(void));
|
P(conf_write_autoconf,int,(void));
|
||||||
|
P(conf_get_changed,bool,(void));
|
||||||
|
P(conf_set_changed_callback, void,(void (*fn)(void)));
|
||||||
|
|
||||||
/* menu.c */
|
/* menu.c */
|
||||||
P(rootmenu,struct menu,);
|
P(rootmenu,struct menu,);
|
||||||
@ -16,7 +18,6 @@ P(menu_get_parent_menu,struct menu *,(struct menu *menu));
|
|||||||
|
|
||||||
/* symbol.c */
|
/* symbol.c */
|
||||||
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
|
P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
|
||||||
P(sym_change_count,int,);
|
|
||||||
|
|
||||||
P(sym_lookup,struct symbol *,(const char *name, int isconst));
|
P(sym_lookup,struct symbol *,(const char *name, int isconst));
|
||||||
P(sym_find,struct symbol *,(const char *name));
|
P(sym_find,struct symbol *,(const char *name));
|
||||||
|
@ -868,7 +868,7 @@ int main(int ac, char **av)
|
|||||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||||
textdomain(PACKAGE);
|
textdomain(PACKAGE);
|
||||||
|
|
||||||
conf_parse(av[1] ? av[1] : "");
|
conf_parse(av[1]);
|
||||||
conf_read(NULL);
|
conf_read(NULL);
|
||||||
|
|
||||||
sym = sym_lookup("PROJECTVERSION", 0);
|
sym = sym_lookup("PROJECTVERSION", 0);
|
||||||
@ -890,26 +890,33 @@ int main(int ac, char **av)
|
|||||||
do {
|
do {
|
||||||
conf(&rootmenu);
|
conf(&rootmenu);
|
||||||
dialog_clear();
|
dialog_clear();
|
||||||
|
if (conf_get_changed())
|
||||||
res = dialog_yesno(NULL,
|
res = dialog_yesno(NULL,
|
||||||
_("Do you wish to save your "
|
_("Do you wish to save your "
|
||||||
"new "PROJECT_NAME" configuration?\n"
|
"new "PROJECT_NAME" configuration?\n"
|
||||||
"<ESC><ESC> to continue."),
|
"<ESC><ESC> to continue."),
|
||||||
6, 60);
|
6, 60);
|
||||||
|
else
|
||||||
|
res = -1;
|
||||||
} while (res == KEY_ESC);
|
} while (res == KEY_ESC);
|
||||||
end_dialog();
|
end_dialog();
|
||||||
if (res == 0) {
|
|
||||||
|
switch (res) {
|
||||||
|
case 0:
|
||||||
if (conf_write(NULL)) {
|
if (conf_write(NULL)) {
|
||||||
fprintf(stderr, _("\n\n"
|
fprintf(stderr, _("\n\n"
|
||||||
"Error writing "PROJECT_NAME" configuration.\n"
|
"Error during writing of "PROJECT_NAME" configuration.\n"
|
||||||
"Your configuration changes were NOT saved."
|
"Your kernel configuration changes were NOT saved."
|
||||||
"\n\n"));
|
"\n\n"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
case -1:
|
||||||
printf(_("\n\n"
|
printf(_("\n\n"
|
||||||
"*** End of "PROJECT_NAME" configuration.\n"
|
"*** End of "PROJECT_NAME" configuration.\n"
|
||||||
"*** Execute 'make' to build, or try 'make help'."
|
"*** Execute 'make' to build the kernel or try 'make help'."
|
||||||
"\n\n"));
|
"\n\n"));
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
fprintf(stderr, _("\n\n"
|
fprintf(stderr, _("\n\n"
|
||||||
"Your configuration changes were NOT saved."
|
"Your configuration changes were NOT saved."
|
||||||
"\n\n"));
|
"\n\n"));
|
||||||
|
@ -30,7 +30,6 @@ struct symbol symbol_yes = {
|
|||||||
.flags = SYMBOL_VALID,
|
.flags = SYMBOL_VALID,
|
||||||
};
|
};
|
||||||
|
|
||||||
int sym_change_count;
|
|
||||||
struct symbol *sym_defconfig_list;
|
struct symbol *sym_defconfig_list;
|
||||||
struct symbol *modules_sym;
|
struct symbol *modules_sym;
|
||||||
tristate modules_val;
|
tristate modules_val;
|
||||||
@ -379,7 +378,7 @@ void sym_clear_all_valid(void)
|
|||||||
|
|
||||||
for_all_symbols(i, sym)
|
for_all_symbols(i, sym)
|
||||||
sym->flags &= ~SYMBOL_VALID;
|
sym->flags &= ~SYMBOL_VALID;
|
||||||
sym_change_count++;
|
sym_add_change_count(1);
|
||||||
if (modules_sym)
|
if (modules_sym)
|
||||||
sym_calc_value(modules_sym);
|
sym_calc_value(modules_sym);
|
||||||
}
|
}
|
||||||
|
@ -2135,7 +2135,7 @@ void conf_parse(const char *name)
|
|||||||
sym_check_deps(sym);
|
sym_check_deps(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
sym_change_count = 1;
|
sym_set_change_count(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *zconf_tokenname(int token)
|
const char *zconf_tokenname(int token)
|
||||||
|
Loading…
Reference in New Issue
Block a user