diff options
| author | nir.tzachar@gmail.com <nir.tzachar@gmail.com> | 2009-11-25 05:28:43 -0500 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2010-02-02 08:33:55 -0500 |
| commit | 692d97c380c6dce2c35a04c5dcbce4e831a42fa0 (patch) | |
| tree | eff5fc88659da67cce720dd643f50137ef5b906a /scripts | |
| parent | c64152bfd0106807c8d3ddbe6d0928e14a64f7bb (diff) | |
kconfig: new configuration interface (nconfig)
This patch was inspired by the kernel projects page, where an ncurses
replacement for menuconfig was mentioned (by Sam Ravnborg).
Building on menuconfig, this patch implements a more modern look
interface using ncurses and ncurses' satellite libraries (menu, panel,
form). The implementation does not depend on lxdialog, which is
currently distributed with the kernel.
Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/kconfig/Makefile | 16 | ||||
| -rw-r--r-- | scripts/kconfig/lkc.h | 2 | ||||
| -rw-r--r-- | scripts/kconfig/lkc_proto.h | 3 | ||||
| -rw-r--r-- | scripts/kconfig/mconf.c | 13 | ||||
| -rw-r--r-- | scripts/kconfig/menu.c | 16 | ||||
| -rw-r--r-- | scripts/kconfig/nconf.c | 1568 | ||||
| -rw-r--r-- | scripts/kconfig/nconf.gui.c | 617 | ||||
| -rw-r--r-- | scripts/kconfig/nconf.h | 95 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.tab.c_shipped | 2 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.y | 2 |
10 files changed, 2314 insertions, 20 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 999e8a7d5bf7..75bdf5ae202c 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -23,6 +23,9 @@ menuconfig: $(obj)/mconf | |||
| 23 | config: $(obj)/conf | 23 | config: $(obj)/conf |
| 24 | $< $(Kconfig) | 24 | $< $(Kconfig) |
| 25 | 25 | ||
| 26 | nconfig: $(obj)/nconf | ||
| 27 | $< $(Kconfig) | ||
| 28 | |||
| 26 | oldconfig: $(obj)/conf | 29 | oldconfig: $(obj)/conf |
| 27 | $< -o $(Kconfig) | 30 | $< -o $(Kconfig) |
| 28 | 31 | ||
| @@ -110,6 +113,7 @@ endif | |||
| 110 | # Help text used by make help | 113 | # Help text used by make help |
| 111 | help: | 114 | help: |
| 112 | @echo ' config - Update current config utilising a line-oriented program' | 115 | @echo ' config - Update current config utilising a line-oriented program' |
| 116 | @echo ' nconfig - Update current config utilising a ncurses menu based program' | ||
| 113 | @echo ' menuconfig - Update current config utilising a menu based program' | 117 | @echo ' menuconfig - Update current config utilising a menu based program' |
| 114 | @echo ' xconfig - Update current config utilising a QT based front-end' | 118 | @echo ' xconfig - Update current config utilising a QT based front-end' |
| 115 | @echo ' gconfig - Update current config utilising a GTK based front-end' | 119 | @echo ' gconfig - Update current config utilising a GTK based front-end' |
| @@ -137,6 +141,8 @@ HOST_EXTRACFLAGS += -DLOCALE | |||
| 137 | # =========================================================================== | 141 | # =========================================================================== |
| 138 | # Shared Makefile for the various kconfig executables: | 142 | # Shared Makefile for the various kconfig executables: |
| 139 | # conf: Used for defconfig, oldconfig and related targets | 143 | # conf: Used for defconfig, oldconfig and related targets |
| 144 | # nconf: Used for the nconfig target. | ||
| 145 | # Utilizes ncurses | ||
| 140 | # mconf: Used for the menuconfig target | 146 | # mconf: Used for the menuconfig target |
| 141 | # Utilizes the lxdialog package | 147 | # Utilizes the lxdialog package |
| 142 | # qconf: Used for the xconfig target | 148 | # qconf: Used for the xconfig target |
| @@ -149,11 +155,16 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o | |||
| 149 | lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o | 155 | lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o |
| 150 | 156 | ||
| 151 | conf-objs := conf.o zconf.tab.o | 157 | conf-objs := conf.o zconf.tab.o |
| 152 | mconf-objs := mconf.o zconf.tab.o $(lxdialog) | 158 | mconf-objs := mconf.o zconf.tab.o $(lxdialog) |
| 159 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | ||
| 153 | kxgettext-objs := kxgettext.o zconf.tab.o | 160 | kxgettext-objs := kxgettext.o zconf.tab.o |
| 154 | 161 | ||
| 155 | hostprogs-y := conf qconf gconf kxgettext | 162 | hostprogs-y := conf qconf gconf kxgettext |
| 156 | 163 | ||
| 164 | ifeq ($(MAKECMDGOALS),nconfig) | ||
| 165 | hostprogs-y += nconf | ||
| 166 | endif | ||
| 167 | |||
| 157 | ifeq ($(MAKECMDGOALS),menuconfig) | 168 | ifeq ($(MAKECMDGOALS),menuconfig) |
| 158 | hostprogs-y += mconf | 169 | hostprogs-y += mconf |
| 159 | endif | 170 | endif |
| @@ -177,7 +188,7 @@ endif | |||
| 177 | 188 | ||
| 178 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ | 189 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ |
| 179 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h | 190 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h |
| 180 | clean-files += mconf qconf gconf | 191 | clean-files += mconf qconf gconf nconf |
| 181 | clean-files += config.pot linux.pot | 192 | clean-files += config.pot linux.pot |
| 182 | 193 | ||
| 183 | # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) | 194 | # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) |
| @@ -202,6 +213,7 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | |||
| 202 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | 213 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
| 203 | -D LKC_DIRECT_LINK | 214 | -D LKC_DIRECT_LINK |
| 204 | 215 | ||
| 216 | HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses | ||
| 205 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck | 217 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck |
| 206 | 218 | ||
| 207 | ifeq ($(qconf-target),1) | 219 | ifeq ($(qconf-target),1) |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index e59dd0c5787a..ce6549cdaccf 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
| @@ -84,7 +84,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode); | |||
| 84 | void kconfig_load(void); | 84 | void kconfig_load(void); |
| 85 | 85 | ||
| 86 | /* menu.c */ | 86 | /* menu.c */ |
| 87 | void menu_init(void); | 87 | void _menu_init(void); |
| 88 | void menu_warn(struct menu *menu, const char *fmt, ...); | 88 | void menu_warn(struct menu *menu, const char *fmt, ...); |
| 89 | struct menu *menu_add_menu(void); | 89 | struct menu *menu_add_menu(void); |
| 90 | void menu_end_menu(void); | 90 | void menu_end_menu(void); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ffeb532b2cff..41e652a8d1f6 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
| @@ -17,7 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
| 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
| 18 | P(menu_has_help,bool,(struct menu *menu)); | 18 | P(menu_has_help,bool,(struct menu *menu)); |
| 19 | P(menu_get_help,const char *,(struct menu *menu)); | 19 | P(menu_get_help,const char *,(struct menu *menu)); |
| 20 | P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); | 20 | P(get_symbol_str, void, (struct gstr *r, struct symbol *sym)); |
| 21 | P(get_relations_str, struct gstr, (struct symbol **sym_arr)); | ||
| 21 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | 22 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); |
| 22 | 23 | ||
| 23 | /* symbol.c */ | 24 | /* symbol.c */ |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index ac1e9dacde97..a4a75190457c 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -282,19 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); | |||
| 282 | static void show_helptext(const char *title, const char *text); | 282 | static void show_helptext(const char *title, const char *text); |
| 283 | static void show_help(struct menu *menu); | 283 | static void show_help(struct menu *menu); |
| 284 | 284 | ||
| 285 | static struct gstr get_relations_str(struct symbol **sym_arr) | ||
| 286 | { | ||
| 287 | struct symbol *sym; | ||
| 288 | struct gstr res = str_new(); | ||
| 289 | int i; | ||
| 290 | |||
| 291 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) | ||
| 292 | get_symbol_str(&res, sym); | ||
| 293 | if (!i) | ||
| 294 | str_append(&res, _("No matches found.\n")); | ||
| 295 | return res; | ||
| 296 | } | ||
| 297 | |||
| 298 | static char filename[PATH_MAX+1]; | 285 | static char filename[PATH_MAX+1]; |
| 299 | static void set_config_filename(const char *config_filename) | 286 | static void set_config_filename(const char *config_filename) |
| 300 | { | 287 | { |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 059a2465c574..21bfb3dbc87a 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
| @@ -38,7 +38,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...) | |||
| 38 | va_end(ap); | 38 | va_end(ap); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void menu_init(void) | 41 | void _menu_init(void) |
| 42 | { | 42 | { |
| 43 | current_entry = current_menu = &rootmenu; | 43 | current_entry = current_menu = &rootmenu; |
| 44 | last_entry_ptr = &rootmenu.list; | 44 | last_entry_ptr = &rootmenu.list; |
| @@ -515,6 +515,20 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) | |||
| 515 | str_append(r, "\n\n"); | 515 | str_append(r, "\n\n"); |
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | struct gstr get_relations_str(struct symbol **sym_arr) | ||
| 519 | { | ||
| 520 | struct symbol *sym; | ||
| 521 | struct gstr res = str_new(); | ||
| 522 | int i; | ||
| 523 | |||
| 524 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) | ||
| 525 | get_symbol_str(&res, sym); | ||
| 526 | if (!i) | ||
| 527 | str_append(&res, _("No matches found.\n")); | ||
| 528 | return res; | ||
| 529 | } | ||
| 530 | |||
| 531 | |||
| 518 | void menu_get_ext_help(struct menu *menu, struct gstr *help) | 532 | void menu_get_ext_help(struct menu *menu, struct gstr *help) |
| 519 | { | 533 | { |
| 520 | struct symbol *sym = menu->sym; | 534 | struct symbol *sym = menu->sym; |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c new file mode 100644 index 000000000000..8c56150a757d --- /dev/null +++ b/scripts/kconfig/nconf.c | |||
| @@ -0,0 +1,1568 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com? | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | * | ||
| 5 | * Derived from menuconfig. | ||
| 6 | * | ||
| 7 | */ | ||
| 8 | #define LKC_DIRECT_LINK | ||
| 9 | #include "lkc.h" | ||
| 10 | #include "nconf.h" | ||
| 11 | |||
| 12 | static const char nconf_readme[] = N_( | ||
| 13 | "Overview\n" | ||
| 14 | "--------\n" | ||
| 15 | "Some kernel features may be built directly into the kernel.\n" | ||
| 16 | "Some may be made into loadable runtime modules. Some features\n" | ||
| 17 | "may be completely removed altogether. There are also certain\n" | ||
| 18 | "kernel parameters which are not really features, but must be\n" | ||
| 19 | "entered in as decimal or hexadecimal numbers or possibly text.\n" | ||
| 20 | "\n" | ||
| 21 | "Menu items beginning with following braces represent features that\n" | ||
| 22 | " [ ] can be built in or removed\n" | ||
| 23 | " < > can be built in, modularized or removed\n" | ||
| 24 | " { } can be built in or modularized (selected by other feature)\n" | ||
| 25 | " - - are selected by other feature,\n" | ||
