Skip to content

Commit 692d97c

Browse files
tzacharmichal42
authored andcommitted
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>
1 parent c64152b commit 692d97c

10 files changed

Lines changed: 2314 additions & 20 deletions

File tree

‎scripts/kconfig/Makefile‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ menuconfig: $(obj)/mconf
2323
config: $(obj)/conf
2424
$< $(Kconfig)
2525

26+
nconfig: $(obj)/nconf
27+
$< $(Kconfig)
28+
2629
oldconfig: $(obj)/conf
2730
$< -o $(Kconfig)
2831

@@ -110,6 +113,7 @@ endif
110113
# Help text used by make help
111114
help:
112115
@echo ' config - Update current config utilising a line-oriented program'
116+
@echo ' nconfig - Update current config utilising a ncurses menu based program'
113117
@echo ' menuconfig - Update current config utilising a menu based program'
114118
@echo ' xconfig - Update current config utilising a QT based front-end'
115119
@echo ' gconfig - Update current config utilising a GTK based front-end'
@@ -137,6 +141,8 @@ HOST_EXTRACFLAGS += -DLOCALE
137141
# ===========================================================================
138142
# Shared Makefile for the various kconfig executables:
139143
# conf: Used for defconfig, oldconfig and related targets
144+
# nconf: Used for the nconfig target.
145+
# Utilizes ncurses
140146
# mconf: Used for the menuconfig target
141147
# Utilizes the lxdialog package
142148
# qconf: Used for the xconfig target
@@ -149,11 +155,16 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
149155
lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o
150156

151157
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
153160
kxgettext-objs := kxgettext.o zconf.tab.o
154161

155162
hostprogs-y := conf qconf gconf kxgettext
156163

164+
ifeq ($(MAKECMDGOALS),nconfig)
165+
hostprogs-y += nconf
166+
endif
167+
157168
ifeq ($(MAKECMDGOALS),menuconfig)
158169
hostprogs-y += mconf
159170
endif
@@ -177,7 +188,7 @@ endif
177188

178189
clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
179190
.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
181192
clean-files += config.pot linux.pot
182193

183194
# 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`
202213
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
203214
-D LKC_DIRECT_LINK
204215

216+
HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
205217
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
206218

207219
ifeq ($(qconf-target),1)

‎scripts/kconfig/lkc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode);
8484
void kconfig_load(void);
8585

8686
/* menu.c */
87-
void menu_init(void);
87+
void _menu_init(void);
8888
void menu_warn(struct menu *menu, const char *fmt, ...);
8989
struct menu *menu_add_menu(void);
9090
void menu_end_menu(void);

‎scripts/kconfig/lkc_proto.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu));
1717
P(menu_get_parent_menu,struct menu *,(struct menu *menu));
1818
P(menu_has_help,bool,(struct menu *menu));
1919
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));
2122
P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
2223

2324
/* symbol.c */

‎scripts/kconfig/mconf.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,19 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c);
282282
static void show_helptext(const char *title, const char *text);
283283
static void show_help(struct menu *menu);
284284

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-
298285
static char filename[PATH_MAX+1];
299286
static void set_config_filename(const char *config_filename)
300287
{

‎scripts/kconfig/menu.c‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...)
3838
va_end(ap);
3939
}
4040

41-
void menu_init(void)
41+
void _menu_init(void)
4242
{
4343
current_entry = current_menu = &rootmenu;
4444
last_entry_ptr = &rootmenu.list;
@@ -515,6 +515,20 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)
515515
str_append(r, "\n\n");
516516
}
517517

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+
518532
void menu_get_ext_help(struct menu *menu, struct gstr *help)
519533
{
520534
struct symbol *sym = menu->sym;

0 commit comments

Comments
 (0)