From ec33e7cf05a984c0a1df4dd01878bece32e7ddc7 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 10 Jul 2012 21:18:36 +0200 Subject: Upload Kconfiglib, patch level 3. --- makefile.patch | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 makefile.patch (limited to 'makefile.patch') diff --git a/makefile.patch b/makefile.patch new file mode 100644 index 0000000..6f7a33c --- /dev/null +++ b/makefile.patch @@ -0,0 +1,105 @@ +--- a/Documentation/kbuild/kconfig-language.txt ++++ b/Documentation/kbuild/kconfig-language.txt +@@ -381,3 +381,8 @@ config FOO + + limits FOO to module (=m) or disabled (=n). + ++Kconfiglib ++~~~~~~~~~~ ++If you need to programmatically generate a .config or parse Kconfig files, ++Kconfiglib might come handy. See 'scriptconfig' and 'iscriptconfig' in ++'make help' and scripts/kconfig/kconfiglib.py. +diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt +index cca46b1..73cf58f 100644 +--- a/Documentation/kbuild/kconfig.txt ++++ b/Documentation/kbuild/kconfig.txt +@@ -195,4 +195,12 @@ Searching in gconfig: + however, gconfig does have a few more viewing choices than + xconfig does. + ++====================================================================== ++scriptconfig ++-------------------------------------------------- ++ ++If you need to programmatically generate a .config or parse Kconfig files, ++Kconfiglib might come handy. See 'scriptconfig' and 'iscriptconfig' in ++'make help' and scripts/kconfig/kconfiglib.py. ++ + ### +diff --git a/README b/README +index 1b81d28..bb5e68f 100644 +--- a/README ++++ b/README +@@ -196,6 +196,19 @@ CONFIGURING the kernel: + values to 'n' as much as possible. + "make randconfig" Create a ./.config file by setting symbol + values to random values. ++ "make scriptconfig SCRIPT=" Run a Kconfiglib ++ script (see scripts/kconfig/kconfiglib.py). This ++ can be used to programatically generate a ++ ./.config, and for applications that need to ++ extract information from Kconfig files. ++ "make iscriptconfig" Launch an interactive Python shell ++ for running Kconfiglib on the architecture's ++ Kconfig configuration. The kconfiglib and sys ++ (for sys.argv[1] - the base Kconfig file) modules ++ will be imported automatically, and a Config ++ instance 'c' will be created for the architecture ++ (using c = kconfiglib.Config(sys.argv[1])). ++ + + You can find more information on using the Linux kernel config tools + in Documentation/kbuild/kconfig.txt. +diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile +index 368ae30..0044933 100644 +--- a/scripts/kconfig/Makefile ++++ b/scripts/kconfig/Makefile +@@ -3,7 +3,7 @@ + # These targets are used from top-level makefile + + PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config \ +- localmodconfig localyesconfig ++ localmodconfig localyesconfig scriptconfig iscriptconfig kconfiglibtestconfig + + ifdef KBUILD_KCONFIG + Kconfig := $(KBUILD_KCONFIG) +@@ -33,6 +33,30 @@ silentoldconfig: $(obj)/conf + $(Q)mkdir -p include/generated + $< --$@ $(Kconfig) + ++ifneq ($(filter scriptconfig iscriptconfig,$(MAKECMDGOALS)),) ++PYTHONCMD ?= python ++endif ++ ++scriptconfig: ++ $(Q)if [ ! -n "$(SCRIPT)" ]; then \ ++ echo 'No script argument provided; use "make scriptconfig SCRIPT=".'; \ ++ else \ ++ PYTHONPATH="$(srctree)/$(src):$$PYTHONPATH" \ ++ "$(PYTHONCMD)" "$(SCRIPT)" $(srctree)/$(Kconfig); \ ++ fi ++ ++iscriptconfig: ++ $(Q)PYTHONPATH="$(srctree)/$(src):$$PYTHONPATH" "$(PYTHONCMD)" -i -c \ ++ "import kconfiglib; \ ++ import sys; \ ++ c = kconfiglib.Config(sys.argv[1]); \ ++ print \"A Config instance 'c' for the architecture ({0}) has been created.\".format(c.get_arch())" \ ++ $(srctree)/$(Kconfig) ++ ++# Used by kconfigtest.py to prevent an 'option defconfig' .config from being loaded ++kconfiglibtestconfig: $(obj)/conf ++ $(Q)$< --defconfig=.config $(srctree)/$(Kconfig) ++ + # if no path is given, then use src directory to find file + ifdef LSMOD + LSMOD_F := $(LSMOD) +@@ -139,6 +163,8 @@ help: + @echo ' randconfig - New config with random answer to all options' + @echo ' listnewconfig - List new options' + @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' ++ @echo ' scriptconfig - Run a kconfiglib script (see scripts/kconfig/kconfiglib.py)' ++ @echo ' iscriptconfig - Launch interactive Python shell for using kconfiglib' + + # lxdialog stuff + check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh -- cgit v1.2.3