aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authornir.tzachar@gmail.com <nir.tzachar@gmail.com>2009-11-25 05:28:43 -0500
committerMichal Marek <mmarek@suse.cz>2010-02-02 08:33:55 -0500
commit692d97c380c6dce2c35a04c5dcbce4e831a42fa0 (patch)
treeeff5fc88659da67cce720dd643f50137ef5b906a /scripts
parentc64152bfd0106807c8d3ddbe6d0928e14a64f7bb (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/Makefile16
-rw-r--r--scripts/kconfig/lkc.h2
-rw-r--r--scripts/kconfig/lkc_proto.h3
-rw-r--r--scripts/kconfig/mconf.c13
-rw-r--r--scripts/kconfig/menu.c16
-rw-r--r--scripts/kconfig/nconf.c1568
-rw-r--r--scripts/kconfig/nconf.gui.c617
-rw-r--r--scripts/kconfig/nconf.h95
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped2
-rw-r--r--scripts/kconfig/zconf.y2
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
23config: $(obj)/conf 23config: $(obj)/conf
24 $< $(Kconfig) 24 $< $(Kconfig)
25 25
26nconfig: $(obj)/nconf
27 $< $(Kconfig)
28
26oldconfig: $(obj)/conf 29oldconfig: $(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
111help: 114help:
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
149lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o 155lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
150 156
151conf-objs := conf.o zconf.tab.o 157conf-objs := conf.o zconf.tab.o
152mconf-objs := mconf.o zconf.tab.o $(lxdialog) 158mconf-objs := mconf.o zconf.tab.o $(lxdialog)
159nconf-objs := nconf.o zconf.tab.o nconf.gui.o
153kxgettext-objs := kxgettext.o zconf.tab.o 160kxgettext-objs := kxgettext.o zconf.tab.o
154 161
155hostprogs-y := conf qconf gconf kxgettext 162hostprogs-y := conf qconf gconf kxgettext
156 163
164ifeq ($(MAKECMDGOALS),nconfig)
165 hostprogs-y += nconf
166endif
167
157ifeq ($(MAKECMDGOALS),menuconfig) 168ifeq ($(MAKECMDGOALS),menuconfig)
158 hostprogs-y += mconf 169 hostprogs-y += mconf
159endif 170endif
@@ -177,7 +188,7 @@ endif
177 188
178clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ 189clean-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
180clean-files += mconf qconf gconf 191clean-files += mconf qconf gconf nconf
181clean-files += config.pot linux.pot 192clean-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`
202HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 213HOSTCFLAGS_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
216HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
205$(obj)/qconf.o: $(obj)/.tmp_qtcheck 217$(obj)/qconf.o: $(obj)/.tmp_qtcheck
206 218
207ifeq ($(qconf-target),1) 219ifeq ($(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);
84void kconfig_load(void); 84void kconfig_load(void);
85 85
86/* menu.c */ 86/* menu.c */
87void menu_init(void); 87void _menu_init(void);
88void menu_warn(struct menu *menu, const char *fmt, ...); 88void menu_warn(struct menu *menu, const char *fmt, ...);
89struct menu *menu_add_menu(void); 89struct menu *menu_add_menu(void);
90void menu_end_menu(void); 90void 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));
17P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 17P(menu_get_parent_menu,struct menu *,(struct menu *menu));
18P(menu_has_help,bool,(struct menu *menu)); 18P(menu_has_help,bool,(struct menu *menu));
19P(menu_get_help,const char *,(struct menu *menu)); 19P(menu_get_help,const char *,(struct menu *menu));
20P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); 20P(get_symbol_str, void, (struct gstr *r, struct symbol *sym));
21P(get_relations_str, struct gstr, (struct symbol **sym_arr));
21P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); 22P(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);
282static void show_helptext(const char *title, const char *text); 282static void show_helptext(const char *title, const char *text);
283static void show_help(struct menu *menu); 283static void show_help(struct menu *menu);
284 284
285static 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
298static char filename[PATH_MAX+1]; 285static char filename[PATH_MAX+1];
299static void set_config_filename(const char *config_filename) 286static 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
41void menu_init(void) 41void _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
518struct 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
518void menu_get_ext_help(struct menu *menu, struct gstr *help) 532void 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
12static 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"