.libs/
-/frontends/conf/conf
-/frontends/conf/*-conf
-/frontends/gconf/gconf
-/frontends/gconf/*-gconf
-/frontends/mconf/mconf
-/frontends/mconf/*-mconf
-/frontends/nconf/nconf
-/frontends/nconf/*-nconf
-/frontends/qconf/qconf
-/frontends/qconf/*-qconf
+/frontends/conf/kconfig-conf
+/frontends/gconf/kconfig-gconf
+/frontends/mconf/kconfig-mconf
+/frontends/nconf/kconfig-nconf
+/frontends/qconf/kconfig-qconf
/frontends/qconf/qconf.moc
/libs/images/images.c
/libs/parser/lconf.c
/libs/parser/yconf.c
-/utils/tweak
-/utils/gettext
-/utils/*-gettext
+/utils/kconfig-tweak
+/utils/kconfig-gettext
aclocal.m4
configure
#----------------------------------------
# Prepare automake
-# We want to allow the user to override our default program-prefix,
-# so we must set-it now, before automake has a chance to interpret
-# it, but after the options are parsed, so as not to overwrite the
-# value (if any) set by the user
-AS_IF(
- [test "$program_prefix" = NONE],
- [program_prefix=kconfig-])
-
AM_INIT_AUTOMAKE([foreign])
# For releases, enable silent rules, unless the user explicitly
AC_MSG_NOTICE([ - root-menu prompt : $root_menu])
AC_MSG_NOTICE([ - config prefix : $config_prefix])
AC_MSG_NOTICE([- frontends :$fe_list])
-AC_MSG_NOTICE([ - transform name : $program_transform_name])
AC_MSG_NOTICE([ - localised : $has_gettext])
AC_MSG_NOTICE([- install utilities : $enable_utils])
AC_MSG_NOTICE([- CFLAGS CXXFLAGS : $wall_CFLAGS $werror_CFLAGS])
-bin_PROGRAMS = conf
+bin_PROGRAMS = kconfig-conf
-conf_SOURCES = conf.c
-conf_CPPFLAGS = $(AM_CPPFLAGS) \
- $(intl_CPPFLAGS) \
- -I$(top_srcdir)/libs/parser
-conf_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS)
-conf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(intl_LIBS) \
- $(conf_EXTRA_LIBS)
+kconfig_conf_SOURCES = conf.c
+kconfig_conf_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(intl_CPPFLAGS) \
+ -I$(top_srcdir)/libs/parser
+kconfig_conf_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS)
+kconfig_conf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(intl_LIBS) \
+ $(conf_EXTRA_LIBS)
-bin_PROGRAMS = gconf
+bin_PROGRAMS = kconfig-gconf
-gconf_SOURCES = gconf.c gconf.glade
-gconf_CPPFLAGS = $(AM_CPPFLAGS) \
- $(intl_CPPFLAGS) \
- -I$(top_srcdir)/libs/parser \
- -I$(top_builddir)/libs/images \
- -DGUI_PATH='"$(pkgdatadir)/gconf.glade"'
-gconf_CFLAGS = $(AM_CFLAGS) \
- $(kf_CFLAGS) \
- $(gtk_CFLAGS)
-gconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(top_builddir)/libs/images/libkconfig-images.a \
- $(intl_LIBS) $(gtk_LIBS) $(gconf_EXTRA_LIBS)
-gconfdir = $(pkgdatadir)
-gconf_DATA = gconf.glade
+kconfig_gconf_SOURCES = gconf.c gconf.glade
+kconfig_gconf_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(intl_CPPFLAGS) \
+ -I$(top_srcdir)/libs/parser \
+ -I$(top_builddir)/libs/images \
+ -DGUI_PATH='"$(pkgdatadir)/gconf.glade"'
+kconfig_gconf_CFLAGS = $(AM_CFLAGS) \
+ $(kf_CFLAGS) \
+ $(gtk_CFLAGS)
+kconfig_gconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(top_builddir)/libs/images/libkconfig-images.a \
+ $(intl_LIBS) $(gtk_LIBS) $(gconf_EXTRA_LIBS)
+kconfig_gconfdir = $(pkgdatadir)
+kconfig_gconf_DATA = gconf.glade
EXTRA_DIST = gconf.c.patch
-bin_PROGRAMS = mconf
+bin_PROGRAMS = kconfig-mconf
-mconf_SOURCES = mconf.c
-mconf_CPPFLAGS = $(AM_CPPFLAGS) \
- $(ncurses_mconf_CPPFLAGS) \
- $(intl_CPPFLAGS) \
- -I$(top_srcdir)/libs \
- -I$(top_srcdir)/libs/parser
-mconf_CFLAGS = $(AM_CFLAGS) \
- $(kf_CFLAGS)
-mconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(top_builddir)/libs/lxdialog/libkconfig-lxdialog.a \
- $(intl_LIBS) $(ncurses_LIBS) $(mconf_EXTRA_LIBS)
+kconfig_mconf_SOURCES = mconf.c
+kconfig_mconf_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(ncurses_mconf_CPPFLAGS) \
+ $(intl_CPPFLAGS) \
+ -I$(top_srcdir)/libs \
+ -I$(top_srcdir)/libs/parser
+kconfig_mconf_CFLAGS = $(AM_CFLAGS) \
+ $(kf_CFLAGS)
+kconfig_mconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(top_builddir)/libs/lxdialog/libkconfig-lxdialog.a \
+ $(intl_LIBS) $(ncurses_LIBS) $(mconf_EXTRA_LIBS)
-bin_PROGRAMS = nconf
+bin_PROGRAMS = kconfig-nconf
-nconf_SOURCES = nconf.c nconf.gui.c nconf.h
-nconf_CPPFLAGS = $(AM_CPPFLAGS) \
- $(intl_CPPFLAGS) \
- $(ncurses_nconf_CPPFLAGS) \
- -I$(top_srcdir)/libs/parser
-nconf_CFLAGS = $(AM_CFLAGS) \
- $(kf_CFLAGS)
-nconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(intl_LIBS) $(ncurses_panel_menu_LIBS) $(ncurses_LIBS) \
- $(nconf_EXTRA_LIBS)
+kconfig_nconf_SOURCES = nconf.c nconf.gui.c nconf.h
+kconfig_nconf_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(intl_CPPFLAGS) \
+ $(ncurses_nconf_CPPFLAGS) \
+ -I$(top_srcdir)/libs/parser
+kconfig_nconf_CFLAGS = $(AM_CFLAGS) \
+ $(kf_CFLAGS)
+kconfig_nconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(intl_LIBS) $(ncurses_panel_menu_LIBS) $(ncurses_LIBS) \
+ $(nconf_EXTRA_LIBS)
-bin_PROGRAMS = qconf
+bin_PROGRAMS = kconfig-qconf
-qconf_SOURCES = qconf.cc qconf.h
+kconfig_qconf_SOURCES = qconf.cc qconf.h
BUILT_SOURCES = qconf.moc
-qconf_CPPFLAGS = $(AM_CPPFLAGS) \
- $(intl_CPPFLAGS) \
- -I$(top_srcdir)/libs/parser \
- -I$(top_builddir)/libs/images
-qconf_CXXFLAGS = $(AM_CXXFLAGS) \
- $(kf_CFLAGS) \
- $(Qt5_CFLAGS) \
- -fPIC
-qconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(top_builddir)/libs/images/libkconfig-images.a \
- $(intl_LIBS) $(Qt5_LIBS) $(qconf_EXTRA_LIBS)
+kconfig_qconf_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(intl_CPPFLAGS) \
+ -I$(top_srcdir)/libs/parser \
+ -I$(top_builddir)/libs/images
+kconfig_qconf_CXXFLAGS = $(AM_CXXFLAGS) \
+ $(kf_CFLAGS) \
+ $(Qt5_CFLAGS) \
+ -fPIC
+kconfig_qconf_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(top_builddir)/libs/images/libkconfig-images.a \
+ $(intl_LIBS) $(Qt5_LIBS) $(qconf_EXTRA_LIBS)
CLEANFILES = qconf.moc
EXTRA_DIST = qconf.cc.patch
scripts/kconfig/symbol.c --> libs/parser/symbol.c
scripts/kconfig/util.c --> libs/parser/util.c
scripts/kconfig/zconf.y --> libs/parser/yconf.y
-scripts/config --> utils/tweak.in
-scripts/diffconfig --> utils/diff
-scripts/kconfig/merge_config.sh --> utils/merge
+scripts/config --> utils/kconfig-tweak.in
+scripts/diffconfig --> utils/kconfig-diff
+scripts/kconfig/merge_config.sh --> utils/kconfig-merge
scripts/kconfig/kxgettext.c --> utils/gettext.c
Documentation/kbuild/kconfig-language.txt --> docs/kconfig-language.txt
Documentation/kbuild/kconfig.txt --> docs/kconfig.txt
-bin_SCRIPTS = tweak
-dist_bin_SCRIPTS = diff merge
+bin_SCRIPTS = kconfig-tweak
+dist_bin_SCRIPTS = kconfig-diff kconfig-merge
if COND_utils_gettext
- MAYBE_utils_gettext = gettext
+ MAYBE_utils_gettext = kconfig-gettext
endif
bin_PROGRAMS = $(MAYBE_utils_gettext)
-gettext_SOURCES = gettext.c
-gettext_CPPFLAGS = $(AM_CPPFLAGS) \
- -I$(top_srcdir)/libs/parser
-gettext_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS)
-gettext_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
- $(intl_LIBS)
-CLEANFILES = tweak
-EXTRA_DIST = tweak.in tweak.in.patch
+kconfig_gettext_SOURCES = gettext.c
+kconfig_gettext_CPPFLAGS = $(AM_CPPFLAGS) \
+ -I$(top_srcdir)/libs/parser
+kconfig_gettext_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS)
+kconfig_gettext_LDADD = $(top_builddir)/libs/parser/libkconfig-parser.la \
+ $(intl_LIBS)
+CLEANFILES = kconfig-tweak
+EXTRA_DIST = kconfig-tweak.in kconfig-tweak.in.patch
-tweak: tweak.in
+kconfig-tweak: kconfig-tweak.in
$(AM_V_GEN)$(SED) -e "s/@CONFIG_@/$(config_prefix)/g" \
$< >$@
@chmod +x $@
+++ /dev/null
-#!/usr/bin/python
-#
-# diffconfig - a tool to compare .config files.
-#
-# originally written in 2006 by Matt Mackall
-# (at least, this was in his bloatwatch source code)
-# last worked on 2008 by Tim Bird
-#
-
-import sys, os
-
-def usage():
- print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
-
-Diffconfig is a simple utility for comparing two .config files.
-Using standard diff to compare .config files often includes extraneous and
-distracting information. This utility produces sorted output with only the
-changes in configuration values between the two files.
-
-Added and removed items are shown with a leading plus or minus, respectively.
-Changed items show the old and new values on a single line.
-
-If -m is specified, then output will be in "merge" style, which has the
-changed and new values in kernel config option format.
-
-If no config files are specified, .config and .config.old are used.
-
-Example usage:
- $ diffconfig .config config-with-some-changes
--EXT2_FS_XATTR n
- CRAMFS n -> y
- EXT2_FS y -> n
- LOG_BUF_SHIFT 14 -> 16
- PRINTK_TIME n -> y
-""")
- sys.exit(0)
-
-# returns a dictionary of name/value pairs for config items in the file
-def readconfig(config_file):
- d = {}
- for line in config_file:
- line = line[:-1]
- if line[:7] == "CONFIG_":
- name, val = line[7:].split("=", 1)
- d[name] = val
- if line[-11:] == " is not set":
- d[line[9:-11]] = "n"
- return d
-
-def print_config(op, config, value, new_value):
- global merge_style
-
- if merge_style:
- if new_value:
- if new_value=="n":
- print("# CONFIG_%s is not set" % config)
- else:
- print("CONFIG_%s=%s" % (config, new_value))
- else:
- if op=="-":
- print("-%s %s" % (config, value))
- elif op=="+":
- print("+%s %s" % (config, new_value))
- else:
- print(" %s %s -> %s" % (config, value, new_value))
-
-def main():
- global merge_style
-
- # parse command line args
- if ("-h" in sys.argv or "--help" in sys.argv):
- usage()
-
- merge_style = 0
- if "-m" in sys.argv:
- merge_style = 1
- sys.argv.remove("-m")
-
- argc = len(sys.argv)
- if not (argc==1 or argc == 3):
- print("Error: incorrect number of arguments or unrecognized option")
- usage()
-
- if argc == 1:
- # if no filenames given, assume .config and .config.old
- build_dir=""
- if "KBUILD_OUTPUT" in os.environ:
- build_dir = os.environ["KBUILD_OUTPUT"]+"/"
- configa_filename = build_dir + ".config.old"
- configb_filename = build_dir + ".config"
- else:
- configa_filename = sys.argv[1]
- configb_filename = sys.argv[2]
-
- try:
- a = readconfig(open(configa_filename))
- b = readconfig(open(configb_filename))
- except (IOError):
- e = sys.exc_info()[1]
- print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
- usage()
-
- # print items in a but not b (accumulate, sort and print)
- old = []
- for config in a:
- if config not in b:
- old.append(config)
- old.sort()
- for config in old:
- print_config("-", config, a[config], None)
- del a[config]
-
- # print items that changed (accumulate, sort, and print)
- changed = []
- for config in a:
- if a[config] != b[config]:
- changed.append(config)
- else:
- del b[config]
- changed.sort()
- for config in changed:
- print_config("->", config, a[config], b[config])
- del b[config]
-
- # now print items in b but not in a
- # (items from b that were in a were removed above)
- new = sorted(b.keys())
- for config in new:
- print_config("+", config, None, b[config])
-
-main()
--- /dev/null
+#!/usr/bin/python
+#
+# diffconfig - a tool to compare .config files.
+#
+# originally written in 2006 by Matt Mackall
+# (at least, this was in his bloatwatch source code)
+# last worked on 2008 by Tim Bird
+#
+
+import sys, os
+
+def usage():
+ print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
+
+Diffconfig is a simple utility for comparing two .config files.
+Using standard diff to compare .config files often includes extraneous and
+distracting information. This utility produces sorted output with only the
+changes in configuration values between the two files.
+
+Added and removed items are shown with a leading plus or minus, respectively.
+Changed items show the old and new values on a single line.
+
+If -m is specified, then output will be in "merge" style, which has the
+changed and new values in kernel config option format.
+
+If no config files are specified, .config and .config.old are used.
+
+Example usage:
+ $ diffconfig .config config-with-some-changes
+-EXT2_FS_XATTR n
+ CRAMFS n -> y
+ EXT2_FS y -> n
+ LOG_BUF_SHIFT 14 -> 16
+ PRINTK_TIME n -> y
+""")
+ sys.exit(0)
+
+# returns a dictionary of name/value pairs for config items in the file
+def readconfig(config_file):
+ d = {}
+ for line in config_file:
+ line = line[:-1]
+ if line[:7] == "CONFIG_":
+ name, val = line[7:].split("=", 1)
+ d[name] = val
+ if line[-11:] == " is not set":
+ d[line[9:-11]] = "n"
+ return d
+
+def print_config(op, config, value, new_value):
+ global merge_style
+
+ if merge_style:
+ if new_value:
+ if new_value=="n":
+ print("# CONFIG_%s is not set" % config)
+ else:
+ print("CONFIG_%s=%s" % (config, new_value))
+ else:
+ if op=="-":
+ print("-%s %s" % (config, value))
+ elif op=="+":
+ print("+%s %s" % (config, new_value))
+ else:
+ print(" %s %s -> %s" % (config, value, new_value))
+
+def main():
+ global merge_style
+
+ # parse command line args
+ if ("-h" in sys.argv or "--help" in sys.argv):
+ usage()
+
+ merge_style = 0
+ if "-m" in sys.argv:
+ merge_style = 1
+ sys.argv.remove("-m")
+
+ argc = len(sys.argv)
+ if not (argc==1 or argc == 3):
+ print("Error: incorrect number of arguments or unrecognized option")
+ usage()
+
+ if argc == 1:
+ # if no filenames given, assume .config and .config.old
+ build_dir=""
+ if "KBUILD_OUTPUT" in os.environ:
+ build_dir = os.environ["KBUILD_OUTPUT"]+"/"
+ configa_filename = build_dir + ".config.old"
+ configb_filename = build_dir + ".config"
+ else:
+ configa_filename = sys.argv[1]
+ configb_filename = sys.argv[2]
+
+ try:
+ a = readconfig(open(configa_filename))
+ b = readconfig(open(configb_filename))
+ except (IOError):
+ e = sys.exc_info()[1]
+ print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
+ usage()
+
+ # print items in a but not b (accumulate, sort and print)
+ old = []
+ for config in a:
+ if config not in b:
+ old.append(config)
+ old.sort()
+ for config in old:
+ print_config("-", config, a[config], None)
+ del a[config]
+
+ # print items that changed (accumulate, sort, and print)
+ changed = []
+ for config in a:
+ if a[config] != b[config]:
+ changed.append(config)
+ else:
+ del b[config]
+ changed.sort()
+ for config in changed:
+ print_config("->", config, a[config], b[config])
+ del b[config]
+
+ # now print items in b but not in a
+ # (items from b that were in a were removed above)
+ new = sorted(b.keys())
+ for config in new:
+ print_config("+", config, None, b[config])
+
+main()
--- /dev/null
+#!/bin/sh
+# merge_config.sh - Takes a list of config fragment values, and merges
+# them one by one. Provides warnings on overridden values, and specified
+# values that did not make it to the resulting .config file (due to missed
+# dependencies or config symbol removal).
+#
+# Portions reused from kconf_check and generate_cfg:
+# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check
+# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg
+#
+# Copyright (c) 2009-2010 Wind River Systems, Inc.
+# Copyright 2011 Linaro
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+
+clean_up() {
+ rm -f $TMP_FILE
+ exit
+}
+trap clean_up HUP INT TERM
+
+usage() {
+ echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
+ echo " -h display this help text"
+ echo " -m only merge the fragments, do not execute the make command"
+ echo " -n use allnoconfig instead of alldefconfig"
+ echo " -r list redundant entries when merging fragments"
+ echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
+}
+
+RUNMAKE=true
+ALLTARGET=alldefconfig
+WARNREDUN=false
+OUTPUT=.
+
+while true; do
+ case $1 in
+ "-n")
+ ALLTARGET=allnoconfig
+ shift
+ continue
+ ;;
+ "-m")
+ RUNMAKE=false
+ shift
+ continue
+ ;;
+ "-h")
+ usage
+ exit
+ ;;
+ "-r")
+ WARNREDUN=true
+ shift
+ continue
+ ;;
+ "-O")
+ if [ -d $2 ];then
+ OUTPUT=$(echo $2 | sed 's/\/*$//')
+ else
+ echo "output directory $2 does not exist" 1>&2
+ exit 1
+ fi
+ shift 2
+ continue
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+if [ "$#" -lt 1 ] ; then
+ usage
+ exit
+fi
+
+if [ -z "$KCONFIG_CONFIG" ]; then
+ if [ "$OUTPUT" != . ]; then
+ KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config")
+ else
+ KCONFIG_CONFIG=.config
+ fi
+fi
+
+INITFILE=$1
+shift;
+
+if [ ! -r "$INITFILE" ]; then
+ echo "The base file '$INITFILE' does not exist. Exit." >&2
+ exit 1
+fi
+
+MERGE_LIST=$*
+SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
+TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
+
+echo "Using $INITFILE as base"
+cat $INITFILE > $TMP_FILE
+
+# Merge files, printing warnings on overridden values
+for MERGE_FILE in $MERGE_LIST ; do
+ echo "Merging $MERGE_FILE"
+ if [ ! -r "$MERGE_FILE" ]; then
+ echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2
+ exit 1
+ fi
+ CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
+
+ for CFG in $CFG_LIST ; do
+ grep -q -w $CFG $TMP_FILE || continue
+ PREV_VAL=$(grep -w $CFG $TMP_FILE)
+ NEW_VAL=$(grep -w $CFG $MERGE_FILE)
+ if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
+ echo Value of $CFG is redefined by fragment $MERGE_FILE:
+ echo Previous value: $PREV_VAL
+ echo New value: $NEW_VAL
+ echo
+ elif [ "$WARNREDUN" = "true" ]; then
+ echo Value of $CFG is redundant by fragment $MERGE_FILE:
+ fi
+ sed -i "/$CFG[ =]/d" $TMP_FILE
+ done
+ cat $MERGE_FILE >> $TMP_FILE
+done
+
+if [ "$RUNMAKE" = "false" ]; then
+ cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
+ echo "#"
+ echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
+ echo "#"
+ clean_up
+ exit
+fi
+
+# If we have an output dir, setup the O= argument, otherwise leave
+# it blank, since O=. will create an unnecessary ./source softlink
+OUTPUT_ARG=""
+if [ "$OUTPUT" != "." ] ; then
+ OUTPUT_ARG="O=$OUTPUT"
+fi
+
+
+# Use the merged file as the starting point for:
+# alldefconfig: Fills in any missing symbols with Kconfig default
+# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
+make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
+
+
+# Check all specified config values took (might have missed-dependency issues)
+for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
+
+ REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
+ ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
+ if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
+ echo "Value requested for $CFG not in final .config"
+ echo "Requested value: $REQUESTED_VAL"
+ echo "Actual value: $ACTUAL_VAL"
+ echo ""
+ fi
+done
+
+clean_up
--- /dev/null
+#!/bin/bash
+# Manipulate options in a .config file from the command line
+
+myname=${0##*/}
+
+# If no prefix forced, use the default @CONFIG_@
+CONFIG_="${CONFIG_-@CONFIG_@}"
+
+usage() {
+ cat >&2 <<EOL
+Manipulate options in a .config file from the command line.
+Usage:
+$myname options command ...
+commands:
+ --enable|-e option Enable option
+ --disable|-d option Disable option
+ --module|-m option Turn option into a module
+ --set-str option string
+ Set option to "string"
+ --set-val option value
+ Set option to value
+ --undefine|-u option Undefine option
+ --state|-s option Print state of option (n,y,m,undef)
+
+ --enable-after|-E beforeopt option
+ Enable option directly after other option
+ --disable-after|-D beforeopt option
+ Disable option directly after other option
+ --module-after|-M beforeopt option
+ Turn option into module directly after other option
+
+ commands can be repeated multiple times
+
+options:
+ --file config-file .config file to change (default .config)
+ --keep-case|-k Keep next symbols' case (dont' upper-case it)
+
+$myname doesn't check the validity of the .config file. This is done at next
+make time.
+
+By default, $myname will upper-case the given symbol. Use --keep-case to keep
+the case of all following symbols unchanged.
+
+$myname uses '@CONFIG_@' as the default symbol prefix. Set the environment
+variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
+EOL
+ exit 1
+}
+
+checkarg() {
+ ARG="$1"
+ if [ "$ARG" = "" ] ; then
+ usage
+ fi
+ case "$ARG" in
+ ${CONFIG_}*)
+ ARG="${ARG/${CONFIG_}/}"
+ ;;
+ esac
+ if [ "$MUNGE_CASE" = "yes" ] ; then
+ ARG="`echo $ARG | tr a-z A-Z`"
+ fi
+}
+
+txt_append() {
+ local anchor="$1"
+ local insert="$2"
+ local infile="$3"
+ local tmpfile="$infile.swp"
+
+ # sed append cmd: 'a\' + newline + text + newline
+ cmd="$(printf "a\\%b$insert" "\n")"
+
+ sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
+ # replace original file with the edited one
+ mv "$tmpfile" "$infile"
+}
+
+txt_subst() {
+ local before="$1"
+ local after="$2"
+ local infile="$3"
+ local tmpfile="$infile.swp"
+
+ sed -e "s:$before:$after:" "$infile" >"$tmpfile"
+ # replace original file with the edited one
+ mv "$tmpfile" "$infile"
+}
+
+txt_delete() {
+ local text="$1"
+ local infile="$2"
+ local tmpfile="$infile.swp"
+
+ sed -e "/$text/d" "$infile" >"$tmpfile"
+ # replace original file with the edited one
+ mv "$tmpfile" "$infile"
+}
+
+set_var() {
+ local name=$1 new=$2 before=$3
+
+ name_re="^($name=|# $name is not set)"
+ before_re="^($before=|# $before is not set)"
+ if test -n "$before" && grep -Eq "$before_re" "$FN"; then
+ txt_append "^$before=" "$new" "$FN"
+ txt_append "^# $before is not set" "$new" "$FN"
+ elif grep -Eq "$name_re" "$FN"; then
+ txt_subst "^$name=.*" "$new" "$FN"
+ txt_subst "^# $name is not set" "$new" "$FN"
+ else
+ echo "$new" >>"$FN"
+ fi
+}
+
+undef_var() {
+ local name=$1
+
+ txt_delete "^$name=" "$FN"
+ txt_delete "^# $name is not set" "$FN"
+}
+
+if [ "$1" = "--file" ]; then
+ FN="$2"
+ if [ "$FN" = "" ] ; then
+ usage
+ fi
+ shift 2
+else
+ FN=.config
+fi
+
+if [ "$1" = "" ] ; then
+ usage
+fi
+
+MUNGE_CASE=yes
+while [ "$1" != "" ] ; do
+ CMD="$1"
+ shift
+ case "$CMD" in
+ --keep-case|-k)
+ MUNGE_CASE=no
+ continue
+ ;;
+ --refresh)
+ ;;
+ --*-after|-E|-D|-M)
+ checkarg "$1"
+ A=$ARG
+ checkarg "$2"
+ B=$ARG
+ shift 2
+ ;;
+ -*)
+ checkarg "$1"
+ shift
+ ;;
+ esac
+ case "$CMD" in
+ --enable|-e)
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
+ ;;
+
+ --disable|-d)
+ set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
+ ;;
+
+ --module|-m)
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
+ ;;
+
+ --set-str)
+ # sed swallows one level of escaping, so we need double-escaping
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
+ shift
+ ;;
+
+ --set-val)
+ set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
+ shift
+ ;;
+ --undefine|-u)
+ undef_var "${CONFIG_}$ARG"
+ ;;
+
+ --state|-s)
+ if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
+ echo n
+ else
+ V="$(grep "^${CONFIG_}$ARG=" $FN)"
+ if [ $? != 0 ] ; then
+ echo undef
+ else
+ V="${V/#${CONFIG_}$ARG=/}"
+ V="${V/#\"/}"
+ V="${V/%\"/}"
+ V="${V//\\\"/\"}"
+ echo "${V}"
+ fi
+ fi
+ ;;
+
+ --enable-after|-E)
+ set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
+ ;;
+
+ --disable-after|-D)
+ set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
+ ;;
+
+ --module-after|-M)
+ set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
+ ;;
+
+ # undocumented because it ignores --file (fixme)
+ --refresh)
+ yes "" | make oldconfig
+ ;;
+
+ *)
+ usage
+ ;;
+ esac
+done
--- /dev/null
+diff --git a/utils/kconfig-tweak.in b/utils/kconfig-tweak.in
+--- a/utils/kconfig-tweak.in
++++ b/utils/kconfig-tweak.in
+@@ -3,8 +3,8 @@
+
+ myname=${0##*/}
+
+-# If no prefix forced, use the default CONFIG_
+-CONFIG_="${CONFIG_-CONFIG_}"
++# If no prefix forced, use the default @CONFIG_@
++CONFIG_="${CONFIG_-@CONFIG_@}"
+
+ usage() {
+ cat >&2 <<EOL
+@@ -41,7 +41,7 @@
+ By default, $myname will upper-case the given symbol. Use --keep-case to keep
+ the case of all following symbols unchanged.
+
+-$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
++$myname uses '@CONFIG_@' as the default symbol prefix. Set the environment
+ variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
+ EOL
+ exit 1
+++ /dev/null
-#!/bin/sh
-# merge_config.sh - Takes a list of config fragment values, and merges
-# them one by one. Provides warnings on overridden values, and specified
-# values that did not make it to the resulting .config file (due to missed
-# dependencies or config symbol removal).
-#
-# Portions reused from kconf_check and generate_cfg:
-# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check
-# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg
-#
-# Copyright (c) 2009-2010 Wind River Systems, Inc.
-# Copyright 2011 Linaro
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details.
-
-clean_up() {
- rm -f $TMP_FILE
- exit
-}
-trap clean_up HUP INT TERM
-
-usage() {
- echo "Usage: $0 [OPTIONS] [CONFIG [...]]"
- echo " -h display this help text"
- echo " -m only merge the fragments, do not execute the make command"
- echo " -n use allnoconfig instead of alldefconfig"
- echo " -r list redundant entries when merging fragments"
- echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
-}
-
-RUNMAKE=true
-ALLTARGET=alldefconfig
-WARNREDUN=false
-OUTPUT=.
-
-while true; do
- case $1 in
- "-n")
- ALLTARGET=allnoconfig
- shift
- continue
- ;;
- "-m")
- RUNMAKE=false
- shift
- continue
- ;;
- "-h")
- usage
- exit
- ;;
- "-r")
- WARNREDUN=true
- shift
- continue
- ;;
- "-O")
- if [ -d $2 ];then
- OUTPUT=$(echo $2 | sed 's/\/*$//')
- else
- echo "output directory $2 does not exist" 1>&2
- exit 1
- fi
- shift 2
- continue
- ;;
- *)
- break
- ;;
- esac
-done
-
-if [ "$#" -lt 1 ] ; then
- usage
- exit
-fi
-
-if [ -z "$KCONFIG_CONFIG" ]; then
- if [ "$OUTPUT" != . ]; then
- KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config")
- else
- KCONFIG_CONFIG=.config
- fi
-fi
-
-INITFILE=$1
-shift;
-
-if [ ! -r "$INITFILE" ]; then
- echo "The base file '$INITFILE' does not exist. Exit." >&2
- exit 1
-fi
-
-MERGE_LIST=$*
-SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p"
-TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX)
-
-echo "Using $INITFILE as base"
-cat $INITFILE > $TMP_FILE
-
-# Merge files, printing warnings on overridden values
-for MERGE_FILE in $MERGE_LIST ; do
- echo "Merging $MERGE_FILE"
- if [ ! -r "$MERGE_FILE" ]; then
- echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2
- exit 1
- fi
- CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE)
-
- for CFG in $CFG_LIST ; do
- grep -q -w $CFG $TMP_FILE || continue
- PREV_VAL=$(grep -w $CFG $TMP_FILE)
- NEW_VAL=$(grep -w $CFG $MERGE_FILE)
- if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then
- echo Value of $CFG is redefined by fragment $MERGE_FILE:
- echo Previous value: $PREV_VAL
- echo New value: $NEW_VAL
- echo
- elif [ "$WARNREDUN" = "true" ]; then
- echo Value of $CFG is redundant by fragment $MERGE_FILE:
- fi
- sed -i "/$CFG[ =]/d" $TMP_FILE
- done
- cat $MERGE_FILE >> $TMP_FILE
-done
-
-if [ "$RUNMAKE" = "false" ]; then
- cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
- echo "#"
- echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
- echo "#"
- clean_up
- exit
-fi
-
-# If we have an output dir, setup the O= argument, otherwise leave
-# it blank, since O=. will create an unnecessary ./source softlink
-OUTPUT_ARG=""
-if [ "$OUTPUT" != "." ] ; then
- OUTPUT_ARG="O=$OUTPUT"
-fi
-
-
-# Use the merged file as the starting point for:
-# alldefconfig: Fills in any missing symbols with Kconfig default
-# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
-make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
-
-
-# Check all specified config values took (might have missed-dependency issues)
-for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
-
- REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
- ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
- if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
- echo "Value requested for $CFG not in final .config"
- echo "Requested value: $REQUESTED_VAL"
- echo "Actual value: $ACTUAL_VAL"
- echo ""
- fi
-done
-
-clean_up
+++ /dev/null
-#!/bin/bash
-# Manipulate options in a .config file from the command line
-
-myname=${0##*/}
-
-# If no prefix forced, use the default @CONFIG_@
-CONFIG_="${CONFIG_-@CONFIG_@}"
-
-usage() {
- cat >&2 <<EOL
-Manipulate options in a .config file from the command line.
-Usage:
-$myname options command ...
-commands:
- --enable|-e option Enable option
- --disable|-d option Disable option
- --module|-m option Turn option into a module
- --set-str option string
- Set option to "string"
- --set-val option value
- Set option to value
- --undefine|-u option Undefine option
- --state|-s option Print state of option (n,y,m,undef)
-
- --enable-after|-E beforeopt option
- Enable option directly after other option
- --disable-after|-D beforeopt option
- Disable option directly after other option
- --module-after|-M beforeopt option
- Turn option into module directly after other option
-
- commands can be repeated multiple times
-
-options:
- --file config-file .config file to change (default .config)
- --keep-case|-k Keep next symbols' case (dont' upper-case it)
-
-$myname doesn't check the validity of the .config file. This is done at next
-make time.
-
-By default, $myname will upper-case the given symbol. Use --keep-case to keep
-the case of all following symbols unchanged.
-
-$myname uses '@CONFIG_@' as the default symbol prefix. Set the environment
-variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
-EOL
- exit 1
-}
-
-checkarg() {
- ARG="$1"
- if [ "$ARG" = "" ] ; then
- usage
- fi
- case "$ARG" in
- ${CONFIG_}*)
- ARG="${ARG/${CONFIG_}/}"
- ;;
- esac
- if [ "$MUNGE_CASE" = "yes" ] ; then
- ARG="`echo $ARG | tr a-z A-Z`"
- fi
-}
-
-txt_append() {
- local anchor="$1"
- local insert="$2"
- local infile="$3"
- local tmpfile="$infile.swp"
-
- # sed append cmd: 'a\' + newline + text + newline
- cmd="$(printf "a\\%b$insert" "\n")"
-
- sed -e "/$anchor/$cmd" "$infile" >"$tmpfile"
- # replace original file with the edited one
- mv "$tmpfile" "$infile"
-}
-
-txt_subst() {
- local before="$1"
- local after="$2"
- local infile="$3"
- local tmpfile="$infile.swp"
-
- sed -e "s:$before:$after:" "$infile" >"$tmpfile"
- # replace original file with the edited one
- mv "$tmpfile" "$infile"
-}
-
-txt_delete() {
- local text="$1"
- local infile="$2"
- local tmpfile="$infile.swp"
-
- sed -e "/$text/d" "$infile" >"$tmpfile"
- # replace original file with the edited one
- mv "$tmpfile" "$infile"
-}
-
-set_var() {
- local name=$1 new=$2 before=$3
-
- name_re="^($name=|# $name is not set)"
- before_re="^($before=|# $before is not set)"
- if test -n "$before" && grep -Eq "$before_re" "$FN"; then
- txt_append "^$before=" "$new" "$FN"
- txt_append "^# $before is not set" "$new" "$FN"
- elif grep -Eq "$name_re" "$FN"; then
- txt_subst "^$name=.*" "$new" "$FN"
- txt_subst "^# $name is not set" "$new" "$FN"
- else
- echo "$new" >>"$FN"
- fi
-}
-
-undef_var() {
- local name=$1
-
- txt_delete "^$name=" "$FN"
- txt_delete "^# $name is not set" "$FN"
-}
-
-if [ "$1" = "--file" ]; then
- FN="$2"
- if [ "$FN" = "" ] ; then
- usage
- fi
- shift 2
-else
- FN=.config
-fi
-
-if [ "$1" = "" ] ; then
- usage
-fi
-
-MUNGE_CASE=yes
-while [ "$1" != "" ] ; do
- CMD="$1"
- shift
- case "$CMD" in
- --keep-case|-k)
- MUNGE_CASE=no
- continue
- ;;
- --refresh)
- ;;
- --*-after|-E|-D|-M)
- checkarg "$1"
- A=$ARG
- checkarg "$2"
- B=$ARG
- shift 2
- ;;
- -*)
- checkarg "$1"
- shift
- ;;
- esac
- case "$CMD" in
- --enable|-e)
- set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=y"
- ;;
-
- --disable|-d)
- set_var "${CONFIG_}$ARG" "# ${CONFIG_}$ARG is not set"
- ;;
-
- --module|-m)
- set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=m"
- ;;
-
- --set-str)
- # sed swallows one level of escaping, so we need double-escaping
- set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=\"${1//\"/\\\\\"}\""
- shift
- ;;
-
- --set-val)
- set_var "${CONFIG_}$ARG" "${CONFIG_}$ARG=$1"
- shift
- ;;
- --undefine|-u)
- undef_var "${CONFIG_}$ARG"
- ;;
-
- --state|-s)
- if grep -q "# ${CONFIG_}$ARG is not set" $FN ; then
- echo n
- else
- V="$(grep "^${CONFIG_}$ARG=" $FN)"
- if [ $? != 0 ] ; then
- echo undef
- else
- V="${V/#${CONFIG_}$ARG=/}"
- V="${V/#\"/}"
- V="${V/%\"/}"
- V="${V//\\\"/\"}"
- echo "${V}"
- fi
- fi
- ;;
-
- --enable-after|-E)
- set_var "${CONFIG_}$B" "${CONFIG_}$B=y" "${CONFIG_}$A"
- ;;
-
- --disable-after|-D)
- set_var "${CONFIG_}$B" "# ${CONFIG_}$B is not set" "${CONFIG_}$A"
- ;;
-
- --module-after|-M)
- set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A"
- ;;
-
- # undocumented because it ignores --file (fixme)
- --refresh)
- yes "" | make oldconfig
- ;;
-
- *)
- usage
- ;;
- esac
-done
+++ /dev/null
-diff --git a/utils/tweak.in b/utils/tweak.in
---- a/utils/tweak.in
-+++ b/utils/tweak.in
-@@ -3,8 +3,8 @@
-
- myname=${0##*/}
-
--# If no prefix forced, use the default CONFIG_
--CONFIG_="${CONFIG_-CONFIG_}"
-+# If no prefix forced, use the default @CONFIG_@
-+CONFIG_="${CONFIG_-@CONFIG_@}"
-
- usage() {
- cat >&2 <<EOL
-@@ -41,7 +41,7 @@
- By default, $myname will upper-case the given symbol. Use --keep-case to keep
- the case of all following symbols unchanged.
-
--$myname uses 'CONFIG_' as the default symbol prefix. Set the environment
-+$myname uses '@CONFIG_@' as the default symbol prefix. Set the environment
- variable CONFIG_ to the prefix to use. Eg.: CONFIG_="FOO_" $myname ...
- EOL
- exit 1