kconfig: a new command line tool to set configs
RFC 1/1 kconfig: a new command line tool to set configs
This is an ugly hack job I made last night and it barely works. It does two things:
1) Sometimes I want to search for a config so I have to load menuconfig, then search for the config entry, then exit. With this script I simply run:
./scripts/kconfig/kconfig search COMEDI
2) I quite often try to enable something by doing:
echo CONFIG_FOO=y >> .config
make oldconfig
grep CONFIG_FOO .config
The grep is to see if the setting worked. Now I can do:
./scripts/kconfig/kconfig set CONFIG_FOO=y
Parsing dependencies barely works, but that's just a matter of writing some more code in expr_parse().
The main questions I have at this point are:
1) If I have a symbol pointer, is it possible to get a help text from that?
2) For some reason, when I do sym_set_tristate_value() it doesn't
actually set anything until I write the config file so I have to do:
if (sym_set_tristate_value(sym, newval)) {
/* FIXME: if I don't write it doesn't save */
conf_write(NULL);
return 1;
}
It makes the output really messy.scripts/kconfig/Makefile +5 -1
@@ -33,6 +33,9 @@ config: $(obj)/conf nconfig: $(obj)/nconf $< $(silent) $(Kconfig) +lconfig: $(obj)/lconf + $< $(silent) $(Kconfig) + silentoldconfig: $(obj)/conf $(Q)mkdir -p include/config include/generated $< $(silent) --$@ $(Kconfig)
@@ -169,12 +172,13 @@ lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o conf-objs := conf.o zconf.tab.o mconf-objs := mconf.o zconf.tab.o $(lxdialog) nconf-objs := nconf.o zconf.tab.o nconf.gui.o +lconf-objs := lconf.o zconf.tab.o kxgettext-objs := kxgettext.o zconf.tab.o qconf-cxxobjs := qconf.o qconf-objs := zconf.tab.o gconf-objs := gconf.o zconf.tab.o -hostprogs-y := conf nconf mconf kxgettext qconf gconf +hostprogs-y := conf nconf mconf kxgettext qconf gconf lconf clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h
scripts/kconfig/kconfig new file +33 -0
@@ -0,0 +1,33 @@ +#!/bin/sh + +usage() { + echo "kconfig [search|set] string" + exit 1; +} + +if [ "$1" = "" ] ; then + usage +fi + +if [ "$1" = "search" ] ; then + + search=$2 + NCONFIG_MODE=kconfig_search SEARCH=${search} make lconfig + +elif [ "$1" = "set" ] ; then + + config=$2 + setting=$3 + + if [ $config = "" ] ; then + echo "nothing to set" + exit 1 + fi + + NCONFIG_MODE=kconfig_set CONFIG=${config} SETTING=${setting} make lconfig + +else + usage +fi + +
scripts/kconfig/lconf.c new file +314 -0
314 lines not on this page · raw message
Quoted 11 lines · Dan Carpenter
This is an ugly hack job I made last night and it barely works. It does two things:
1) Sometimes I want to search for a config so I have to load menuconfig, then search for the config entry, then exit. With this script I simply run:
./scripts/kconfig/kconfigsearch COMEDI2) I quite often try to enable something by doing:
Quoted 7 lines
echo
CONFIG_FOO=y>> .config
make oldconfig
grepCONFIG_FOO.configThe grep is to see if the setting worked. Now I can do:
./scripts/kconfig/kconfigsetCONFIG_FOO=y
The second use-case is provided by scripts/config already. It's is a lot simpler shell script, but it's maybe good enough for such task.
Michal
Quoted 16 lines · Michal Marek
Quoted 15 lines · Dan Carpenter
This is an ugly hack job I made last night and it barely works. It does two things:
1) Sometimes I want to search for a config so I have to load menuconfig, then search for the config entry, then exit. With this script I simply run:
./scripts/kconfig/kconfigsearch COMEDI2) I quite often try to enable something by doing:
echo
CONFIG_FOO=y>> .config
make oldconfig
grepCONFIG_FOO.config
Quoted 6 lines
Quoted 3 lines
The grep is to see if the setting worked. Now I can do:
./scripts/kconfig/kconfigsetCONFIG_FOO=yThe second use-case is provided by
scripts/configalready. It's is a lot simpler shell script, but it's maybe good enough for such task.
The scripts/config file doesn't check that the config is valid. It's the same as doing "echo CONFIG_FOO=y >> .config" which I was trying to fix.
regards,
dan carpenter