diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-02-14 08:21:06 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-02-14 08:21:06 +0000 |
commit | 43a95b8896b0d271de3bbb28cc18810f39b2e15b (patch) | |
tree | d5a2c3215fb3de4cefaedb54b7d607cf0a951595 /extra/config | |
parent | 38d85080f672b7f1815e81e6f10b4d4e1e2d45aa (diff) |
pull latest kconfig from kernel
Diffstat (limited to 'extra/config')
42 files changed, 10252 insertions, 5237 deletions
diff --git a/extra/config/Makefile b/extra/config/Makefile index 519d55844..84a0ed34f 100644 --- a/extra/config/Makefile +++ b/extra/config/Makefile @@ -1,13 +1,35 @@ -# Makefile for uClibc -# -# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> -# -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# - +obj := . +src := . top_srcdir=../../ top_builddir=../../ +srctree := . include $(top_builddir)Rules.mak -all: objs -include Makefile.in -include $(top_srcdir)Makerules + +include Makefile.kconfig + +__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) +host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) +host-cmulti := $(foreach m,$(__hostprogs),\ + $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) +host-cobjs := $(sort $(foreach m,$(__hostprogs),$($(m)-objs))) + +$(host-csingle): %: %.c FORCE + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $< -o $@ + +$(host-cmulti): %: $(host-cobjs) $(host-cshlib) FORCE + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(HOST_LOADLIBES) $($@-objs) -o $@ + +$(host-cobjs): %.o: %.c FORCE + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) -c $< -o $@ + +$(obj)/%:: $(src)/%_shipped + $(Q)cat $< > $@ + +clean: + $(Q)rm -f $(clean-files) +distclean: clean + $(Q)rm -f $(lxdialog) $(conf-objs) $(mconf-objs) $(kxgettext-objs) \ + $(hostprogs-y) $(qconf-cxxobjs) $(qconf-objs) $(gconf-objs) + +FORCE: +.PHONY: FORCE clean distclean diff --git a/extra/config/Makefile.in b/extra/config/Makefile.in deleted file mode 100644 index 9d9b70e3b..000000000 --- a/extra/config/Makefile.in +++ /dev/null @@ -1,128 +0,0 @@ -# Makefile for uClibc -# -# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> -# -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# - -ifeq ($(shell uname),SunOS) -HOSTLIBNCURSES = -lcurses -else -HOSTLIBNCURSES = -lncurses -endif -ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) - HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" -else -ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) - HOSTNCURSES = -I/usr/include/ncurses -DCURSES_LOC="<curses.h>" -else -ifeq (/usr/local/include/ncurses/ncurses.h, $(wildcard /usr/local/include/ncurses/ncurses.h)) - HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<ncurses.h>" -else -ifeq (/usr/local/include/ncurses/curses.h, $(wildcard /usr/local/include/ncurses/curses.h)) - HOSTNCURSES = -I/usr/local/include/ncurses -DCURSES_LOC="<curses.h>" -else -ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) - HOSTNCURSES = -DCURSES_LOC="<ncurses.h>" -else - HOSTNCURSES = -DCURSES_LOC="<curses.h>" -endif -endif -endif -endif -endif - -BUILD_CFLAGS-config := -I. - -BUILD_CFLAGS-mconf.o := $(HOSTNCURSES) -BUILD_CFLAGS-lxdialog := $(HOSTNCURSES) - -BUILD_LDFLAGS-mconf := $(HOSTLIBNCURSES) - -config_DIR := $(top_srcdir)extra/config -config_OUT := $(top_builddir)extra/config - -config_SHIPPED_SRC := $(patsubst %,$(config_OUT)/%,lex.zconf.c zconf.tab.c zconf.tab.h) - -config_CONF_SRC := conf.c -config_MCONF_SRC := mconf.c -config_LXD_SRC := \ - lxdialog/checklist.c lxdialog/menubox.c lxdialog/textbox.c \ - lxdialog/yesno.c lxdialog/inputbox.c lxdialog/util.c \ - lxdialog/msgbox.c -config_SHARED_SRC := $(config_OUT)/zconf.tab.c -config_SHARED_DEP1 := $(patsubst %,$(config_DIR)/%,lkc.h lkc_proto.h expr.h) -config_SHARED_DEP2 := $(patsubst %,$(config_OUT)/%,lkc_defs.h zconf.tab.h) -config_SHARED_DEPS := $(config_SHARED_DEP1) $(config_SHARED_DEP2) -config_CONF_OBJS := $(patsubst %.c,$(config_OUT)/%.o,$(config_CONF_SRC)) -config_MCONF_OBJS := $(patsubst %.c,$(config_OUT)/%.o,$(config_MCONF_SRC) $(config_LXD_SRC)) -config_SHARED_OBJS := $(patsubst %.c,%.o,$(config_SHARED_SRC)) - -objs: ncurses $(config_OUT)/conf $(config_OUT)/mconf - -conf $(config_OUT)/conf: $(config_CONF_OBJS) $(config_SHARED_OBJS) - $(hcompile.u) - -mconf $(config_OUT)/mconf: $(config_MCONF_OBJS) $(config_SHARED_OBJS) | ncurses - $(hcompile.u) - -$(config_CONF_OBJS) $(config_MCONF_OBJS): $(config_OUT)/%.o : $(config_DIR)/%.c | $(config_SHARED_DEPS) - $(hcompile.o) - -$(config_OUT)/lkc_defs.h: $(config_DIR)/lkc_proto.h - @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' - -### -# The following requires flex/bison -# By default we use the _shipped versions, uncomment the -# following line if you are modifying the flex/bison src. -#LKC_GENPARSER := 1 - -ifdef LKC_GENPARSER - -%.tab.c %.tab.h: %.y - bison -t -d -v -b $* -p $(notdir $*) $< - -lex.%.c: %.l - flex -P$(notdir $*) -o$@ $< -else - -$(config_OUT)/lex.zconf.o: $(config_OUT)/lex.zconf.c | $(config_SHARED_DEPS) - $(hcompile.o) - -$(config_SHIPPED_SRC): $(config_OUT)/% : $(config_DIR)/%_shipped - cp $< $@ - -$(config_OUT)/zconf.tab.o: $(config_SHARED_SRC) | $(config_OUT)/lex.zconf.c $(patsubst %,$(config_DIR)/%,confdata.c expr.c symbol.c menu.c) $(config_SHARED_DEPS) - $(hcompile.o) - -endif - -.PHONY: ncurses - -ncurses: - @echo "main() {}" > $(config_OUT)/lxtemp.c - @if $(HOSTCC) $(config_OUT)/lxtemp.c -o $(config_OUT)/a.out $(HOSTLIBNCURSES) ; then \ - $(RM) $(config_OUT)/{lxtemp.c,a.out}; \ - else \ - $(RM) $(config_OUT)/lxtemp.c; \ - echo -e "\007" ;\ - echo ">> Unable to find the Ncurses libraries." ;\ - echo ">>" ;\ - echo ">> You must have Ncurses installed in order" ;\ - echo ">> to use 'make menuconfig'" ;\ - echo ">>" ;\ - echo ">> Maybe you want to try 'make config', which" ;\ - echo ">> doesn't depend on the Ncurses libraries." ;\ - echo ;\ - exit 1 ;\ - fi - -objclean-y += config_clean - -# to be removed after including into top Makefile.in -clean: config_clean - -config_clean: - $(RM) $(config_OUT)/*.o $(config_OUT)/lxdialog/*.o $(config_SHIPPED_SRC) $(MCONF_OBJS) $(CONF_OBJS) \ - conf mconf lkc_defs.h diff --git a/extra/config/Makefile.kconfig b/extra/config/Makefile.kconfig new file mode 100644 index 000000000..e67947d53 --- /dev/null +++ b/extra/config/Makefile.kconfig @@ -0,0 +1,278 @@ +# =========================================================================== +# Kernel configuration targets +# These targets are used from top-level makefile + +PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config + +xconfig: $(obj)/qconf + $< arch/$(ARCH)/Kconfig + +gconfig: $(obj)/gconf + $< arch/$(ARCH)/Kconfig + +menuconfig: $(obj)/mconf + $< arch/$(ARCH)/Kconfig + +config: $(obj)/conf + $< arch/$(ARCH)/Kconfig + +oldconfig: $(obj)/conf + $< -o arch/$(ARCH)/Kconfig + +silentoldconfig: $(obj)/conf + $< -s arch/$(ARCH)/Kconfig + +update-po-config: $(obj)/kxgettext + xgettext --default-domain=linux \ + --add-comments --keyword=_ --keyword=N_ \ + --files-from=scripts/kconfig/POTFILES.in \ + --output scripts/kconfig/config.pot + $(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch + $(Q)for i in `ls arch/`; \ + do \ + scripts/kconfig/kxgettext arch/$$i/Kconfig \ + | msguniq -o scripts/kconfig/linux_$${i}.pot; \ + done + $(Q)msgcat scripts/kconfig/config.pot \ + `find scripts/kconfig/ -type f -name linux_*.pot` \ + --output scripts/kconfig/linux_raw.pot + $(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \ + --output scripts/kconfig/linux.pot + $(Q)rm -f arch/um/Kconfig_arch + $(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot + +PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig + +randconfig: $(obj)/conf + $< -r arch/$(ARCH)/Kconfig + +allyesconfig: $(obj)/conf + $< -y arch/$(ARCH)/Kconfig + +allnoconfig: $(obj)/conf + $< -n arch/$(ARCH)/Kconfig + +allmodconfig: $(obj)/conf + $< -m arch/$(ARCH)/Kconfig + +defconfig: $(obj)/conf +ifeq ($(KBUILD_DEFCONFIG),) + $< -d arch/$(ARCH)/Kconfig +else + @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' + $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig +endif + +%_defconfig: $(obj)/conf + $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig + +# Help text used by make help +help: + @echo ' config - Update current config utilising a line-oriented program' + @echo ' menuconfig - Update current config utilising a menu based program' + @echo ' xconfig - Update current config utilising a QT based front-end' + @echo ' gconfig - Update current config utilising a GTK based front-end' + @echo ' oldconfig - Update current config utilising a provided .config as base' + @echo ' silentoldconfig - Same as oldconfig, but quietly' + @echo ' randconfig - New config with random answer to all options' + @echo ' defconfig - New config with default answer to all options' + @echo ' allmodconfig - New config selecting modules when possible' + @echo ' allyesconfig - New config where all options are accepted with yes' + @echo ' allnoconfig - New config where all options are answered with no' + +# lxdialog stuff +check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh + +# Use reursively expanded variables so we do not call gcc unless +# we really need to do so. (Do not call gcc as part of make mrproper) +HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) +HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) + +HOST_EXTRACFLAGS += -DLOCALE + +PHONY += $(obj)/dochecklxdialog +$(obj)/dochecklxdialog: + $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) + +always := dochecklxdialog + + +# =========================================================================== +# Shared Makefile for the various kconfig executables: +# conf: Used for defconfig, oldconfig and related targets +# mconf: Used for the mconfig target. +# Utilizes the lxdialog package +# qconf: Used for the xconfig target +# Based on QT which needs to be installed to compile it +# gconf: Used for the gconfig target +# Based on GTK which needs to be installed to compile it +# object files used by all kconfig flavours + +lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o +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) +kxgettext-objs := kxgettext.o zconf.tab.o + +hostprogs-y := conf qconf gconf kxgettext + +#ifeq ($(MAKECMDGOALS),menuconfig) + hostprogs-y += mconf +#endif + +ifeq ($(MAKECMDGOALS),xconfig) + qconf-target := 1 +endif +ifeq ($(MAKECMDGOALS),gconfig) + gconf-target := 1 +endif + + +ifeq ($(qconf-target),1) +qconf-cxxobjs := qconf.o +qconf-objs := kconfig_load.o zconf.tab.o +endif + +ifeq ($(gconf-target),1) +gconf-objs := gconf.o kconfig_load.o zconf.tab.o +endif + +clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ + .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c + +# Needed for systems without gettext +KBUILD_HAVE_NLS := $(shell \ + if echo "\#include <libintl.h>" | $(HOSTCC) $(HOSTCFLAGS) -E - > /dev/null 2>&1 ; \ + then echo yes ; \ + else echo no ; fi) +ifeq ($(KBUILD_HAVE_NLS),no) +HOSTCFLAGS += -DKBUILD_NO_NLS +endif + +# generated files seem to need this to find local include files +HOSTCFLAGS_lex.zconf.o := -I$(src) +HOSTCFLAGS_zconf.tab.o := -I$(src) + +HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl +HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK + +HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` +HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ + -D LKC_DIRECT_LINK + +$(obj)/qconf.o: $(obj)/.tmp_qtcheck + +ifeq ($(qconf-target),1) +$(obj)/.tmp_qtcheck: $(src)/Makefile +-include $(obj)/.tmp_qtcheck + +# QT needs some extra effort... +$(obj)/.tmp_qtcheck: + @set -e; echo " CHECK qt"; dir=""; pkg=""; \ + pkg-config --exists qt 2> /dev/null && pkg=qt; \ + pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ + if [ -n "$$pkg" ]; then \ + cflags="\$$(shell pkg-config $$pkg --cflags)"; \ + libs="\$$(shell pkg-config $$pkg --libs)"; \ + moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ + dir="$$(pkg-config $$pkg --variable=prefix)"; \ + else \ + for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ + if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ + done; \ + if [ -z "$$dir" ]; then \ + echo "*"; \ + echo "* Unable to find the QT installation. Please make sure that"; \ + echo "* the QT development package is correctly installed and"; \ + echo "* either install pkg-config or set the QTDIR environment"; \ + echo "* variable to the correct location."; \ + echo "*"; \ + false; \ + fi; \ + libpath=$$dir/lib; lib=qt; osdir=""; \ + $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ + osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ + test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ + test -f $$libpath/libqt-mt.so && lib=qt-mt; \ + cflags="-I$$dir/include"; \ + libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ + moc="$$dir/bin/moc"; \ + fi; \ + if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ + echo "*"; \ + echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ + echo "*"; \ + moc="/usr/bin/moc"; \ + fi; \ + echo "KC_QT_CFLAGS=$$cflags" > $@; \ + echo "KC_QT_LIBS=$$libs" >> $@; \ + echo "KC_QT_MOC=$$moc" >> $@ +endif + +$(obj)/gconf.o: $(obj)/.tmp_gtkcheck + +ifeq ($(gconf-target),1) +-include $(obj)/.tmp_gtkcheck + +# GTK needs some extra effort, too... +$(obj)/.tmp_gtkcheck: + @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ + if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ + touch $@; \ + else \ + echo "*"; \ + echo "* GTK+ is present but version >= 2.0.0 is required."; \ + echo "*"; \ + false; \ + fi \ + else \ + echo "*"; \ + echo "* Unable to find the GTK+ installation. Please make sure that"; \ + echo "* the GTK+ 2.0 development package is correctly installed..."; \ + echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ + echo "*"; \ + false; \ + fi +endif + +$(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c + +$(obj)/kconfig_load.o: $(obj)/lkc_defs.h + +$(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h + +$(obj)/gconf.o: $(obj)/lkc_defs.h + +$(obj)/%.moc: $(src)/%.h + $(KC_QT_MOC) -i $< -o $@ + +$(obj)/lkc_defs.h: $(src)/lkc_proto.h + sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' + + +### +# The following requires flex/bison/gperf +# By default we use the _shipped versions, uncomment the following line if +# you are modifying the flex/bison src. +# LKC_GENPARSER := 1 + +ifdef LKC_GENPARSER + +$(obj)/zconf.tab.c: $(src)/zconf.y +$(obj)/lex.zconf.c: $(src)/zconf.l +$(obj)/zconf.hash.c: $(src)/zconf.gperf + +%.tab.c: %.y + bison -l -b $* -p $(notdir $*) $< + cp $@ $@_shipped + +lex.%.c: %.l + flex -L -P$(notdir $*) -o$@ $< + cp $@ $@_shipped + +%.hash.c: %.gperf + gperf < $< > $@ + cp $@ $@_shipped + +endif diff --git a/extra/config/POTFILES.in b/extra/config/POTFILES.in new file mode 100644 index 000000000..cc94e46a7 --- /dev/null +++ b/extra/config/POTFILES.in @@ -0,0 +1,5 @@ +scripts/kconfig/mconf.c +scripts/kconfig/conf.c +scripts/kconfig/confdata.c +scripts/kconfig/gconf.c +scripts/kconfig/qconf.cc diff --git a/extra/config/README.uClibc b/extra/config/README.uClibc new file mode 100644 index 000000000..a20d89963 --- /dev/null +++ b/extra/config/README.uClibc @@ -0,0 +1,18 @@ +This is a copy of the kconfig code in the kernel tweaked to suite uClibc. + +To update: + cp -r /usr/src/linux/scripts/kconfig extra/config.new + cd extra/config.new + cp /usr/src/linux/Documentation/kbuild/kconfig-language.txt . + mv Makefile Makefile.kconfig + patch -p1 < ../config/kconfig-to-uclibc.patch + cp ../config/conf-header.sh ../config/README.uClibc . + cd .. + rm -rf config + mv config.new config + +Then verify the toplevel targets work: + config + defconfig + menuconfig + oldconfig diff --git a/extra/config/conf-header.sh b/extra/config/conf-header.sh new file mode 100755 index 000000000..90dfa999a --- /dev/null +++ b/extra/config/conf-header.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +# Turn .config into a header file + +if [ -z "$1" ] ; then + echo "Usage: conf-header.sh <.config>" + exit 1 +fi + +cat <<EOF +#if !defined __FEATURES_H && !defined __need_uClibc_config_h +# error Never include <bits/uClibc_config.h> directly; use <features.h> instead +#endif + +#define __UCLIBC_MAJOR__ ${MAJOR_VERSION} +#define __UCLIBC_MINOR__ ${MINOR_VERSION} +#define __UCLIBC_SUBLEVEL__ ${SUBLEVEL} +EOF + +exec \ +sed \ + -e '/^#$/d' \ + -e '/^[^#]/s:^\([^=]*\)=\(.*\):#define __\1__ \2:' \ + -e '/^#define /s: y$: 1:' \ + -e '/^# .* is not set$/s:^# \(.*\) is not set$:#undef __\1__:' \ + -e 's:^# \(.*\)$:/* \1 */:' \ + $1 diff --git a/extra/config/conf.c b/extra/config/conf.c index 0907369dd..8ad8d9d4f 100644 --- a/extra/config/conf.c +++ b/extra/config/conf.c @@ -5,6 +5,7 @@ #include <ctype.h> #include <stdlib.h> +#include <stdio.h> #include <string.h> #include <unistd.h> #include <time.h> @@ -82,6 +83,15 @@ static void conf_askvalue(struct symbol *sym, const char *def) } switch (input_mode) { + case set_no: + case set_mod: + case set_yes: + case set_random: + if (sym_has_value(sym)) { + printf("%s\n", def); + return; + } + break; case ask_new: case ask_silent: if (sym_has_value(sym)) { @@ -305,8 +315,7 @@ static int conf_choice(struct menu *menu) printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); cnt = def = 0; - line[0] = '0'; - line[1] = 0; + line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; @@ -467,15 +476,14 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym) { - if (sym_is_changable(sym) && !sym_has_value(sym)) { + if (sym && !sym_has_value(sym)) { + if (sym_is_changable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); conf(rootEntry); } - if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod) - return; } for (child = menu->list; child; child = child->next) @@ -524,13 +532,14 @@ int main(int ac, char **av) break; case 'h': case '?': - printf("%s [-o|-s] config\n", av[0]); + fprintf(stderr, "See README for usage info\n"); exit(0); } } name = av[i]; if (!name) { printf(_("%s: Kconfig file missing\n"), av[0]); + exit(1); } conf_parse(name); //zconfdump(stdout); @@ -559,6 +568,27 @@ int main(int ac, char **av) case ask_new: conf_read(NULL); break; + case set_no: + case set_mod: + case set_yes: + case set_random: + name = getenv("KCONFIG_ALLCONFIG"); + if (name && !stat(name, &tmpstat)) { + conf_read_simple(name, S_DEF_USER); + break; + } + switch (input_mode) { + case set_no: name = "allno.config"; break; + case set_mod: name = "allmod.config"; break; + case set_yes: name = "allyes.config"; break; + case set_random: name = "allrandom.config"; break; + default: break; + } + if (!stat(name, &tmpstat)) + conf_read_simple(name, S_DEF_USER); + else if (!stat("all.config", &tmpstat)) + conf_read_simple("all.config", S_DEF_USER); + break; default: break; } @@ -570,14 +600,28 @@ int main(int ac, char **av) input_mode = ask_silent; valid_stdin = 1; } - } + } else if (conf_get_changed()) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + fprintf(stderr, _("\n*** uClibc configuration requires explicit update.\n\n")); + return 1; + } + } else + goto skip_check; + do { conf_cnt = 0; check_conf(&rootmenu); } while (conf_cnt); if (conf_write(NULL)) { - fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); + fprintf(stderr, _("\n*** Error during writing of the uClibc configuration.\n\n")); return 1; } +skip_check: + if (/*input_mode == ask_silent &&*/ conf_write_autoconf()) { + fprintf(stderr, _("\n*** Error during writing of the uClibc configuration.\n\n")); + return 1; + } + return 0; } diff --git a/extra/config/confdata.c b/extra/config/confdata.c index 60bfe77c4..0dbd14152 100644 --- a/extra/config/confdata.c +++ b/extra/config/confdata.c @@ -5,6 +5,7 @@ #include <sys/stat.h> #include <ctype.h> +#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -14,15 +15,31 @@ #define LKC_DIRECT_LINK #include "lkc.h" -const char conf_def_filename[] = ".config"; +static void conf_warning(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); -const char conf_defname[] = "extra/Configs/Config.default"; +static const char *conf_filename; +static int conf_lineno, conf_warnings, conf_unsaved; -const char *conf_confnames[] = { - ".config", - conf_defname, - NULL, -}; +const char conf_defname[] = "extra/Configs/defconfigs/$ARCH"; + +static void conf_warning(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "%s:%d:warning: ", conf_filename, conf_lineno); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + conf_warnings++; +} + +const char *conf_get_configname(void) +{ + char *name = getenv("KCONFIG_CONFIG"); + + return name ? name : ".config"; +} static char *conf_expand_value(const char *in) { @@ -66,53 +83,70 @@ char *conf_get_default_confname(void) return name; } -int conf_read(const char *name) +int conf_read_simple(const char *name, int def) { FILE *in = NULL; char line[1024]; char *p, *p2; - int lineno = 0; struct symbol *sym; - struct property *prop; - struct expr *e; - int i; + int i, def_flags; if (name) { in = zconf_fopen(name); } else { - const char **names = conf_confnames; - while ((name = *names++)) { - name = conf_expand_value(name); + struct property *prop; + + name = conf_get_configname(); + in = zconf_fopen(name); + if (in) + goto load; + sym_add_change_count(1); + if (!sym_defconfig_list) + return 1; + + for_all_defaults(sym_defconfig_list, prop) { + if (expr_calc_value(prop->visible.expr) == no || + prop->expr->type != E_SYMBOL) + continue; + name = conf_expand_value(prop->expr->left.sym->name); in = zconf_fopen(name); if (in) { printf(_("#\n" - "# using defaults found in %s\n" - "#\n"), name); - break; + "# using defaults found in %s\n" + "#\n"), name); + goto load; } } } - if (!in) return 1; +load: + conf_filename = name; + conf_lineno = 0; + conf_warnings = 0; + conf_unsaved = 0; + + def_flags = SYMBOL_DEF << def; for_all_symbols(i, sym) { - sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; - sym->flags &= ~SYMBOL_VALID; + sym->flags |= SYMBOL_CHANGED; + sym->flags &= ~(def_flags|SYMBOL_VALID); + if (sym_is_choice(sym)) + sym->flags |= def_flags; |