diff options
| -rw-r--r-- | kconfiglib.py | 7 | ||||
| -rw-r--r-- | makefile.patch | 29 |
2 files changed, 22 insertions, 14 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index ffae96f..08cec75 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -30,18 +30,19 @@ Kconfig-based configuration systems. Features include the following: For the Linux kernel, scripts are run using - $ make scriptconfig SCRIPT=<path to script> + $ make scriptconfig SCRIPT=<path to script> [SCRIPT_ARG=<arg>] Running scripts via the 'scriptconfig' target ensures that required environment variables (SRCARCH, ARCH, srctree, KERNELVERSION, etc.) are set up correctly. Alternative architectures can be specified like for other 'make *config' targets: - $ make scriptconfig ARCH=mips SCRIPT=<path to script> + $ make scriptconfig ARCH=mips SCRIPT=<path to script> [SCRIPT_ARG=<arg>] The script will receive the name of the Kconfig file to load in sys.argv[1]. (As of Linux 3.7.0-rc8 this is always "Kconfig" from the kernel top-level -directory.) +directory.) If an argument is provided with SCRIPT_ARG, it will appear in +sys.argv[2]. To get an interactive Python prompt with Kconfiglib preloaded and a Config object 'c' created, use diff --git a/makefile.patch b/makefile.patch index 2c8d56c..38f30ba 100644 --- a/makefile.patch +++ b/makefile.patch @@ -1,17 +1,17 @@ -From 79b531fed7fdf05069c04a3f78c3c97ab9d4d3a0 Mon Sep 17 00:00:00 2001 +From 7329f3d49ccc1bb698ab2d2556d85747ea2b168a Mon Sep 17 00:00:00 2001 From: Ulf Magnusson <ulfalizer@gmail.com> Date: Fri, 7 Dec 2012 03:58:36 +0100 Subject: [PATCH] Kconfiglib scripts/kconfig/Makefile patch. --- - scripts/kconfig/Makefile | 28 ++++++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) + scripts/kconfig/Makefile | 35 +++++++++++++++++++++++++++++++++++ + 1 file changed, 35 insertions(+) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile -index 3091794..d3bb0d6 100644 +index 3091794..0f29810 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile -@@ -11,6 +11,34 @@ else +@@ -11,6 +11,41 @@ else Kconfig := Kconfig endif @@ -21,13 +21,20 @@ index 3091794..d3bb0d6 100644 +PYTHONCMD ?= python +endif + ++ifneq ($(filter scriptconfig,$(MAKECMDGOALS)),) ++ifndef SCRIPT ++$(error Use "make scriptconfig SCRIPT=<path to script> [SCRIPT_ARG=<argument>]") ++endif ++endif ++ +scriptconfig: -+ $(Q)if [ -z "$(SCRIPT)" ]; then \ -+ echo 'No script argument provided; use "make scriptconfig SCRIPT=<path to script>".'; \ -+ else \ -+ PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" \ -+ "$(PYTHONCMD)" "$(SCRIPT)" $(srctree)/$(Kconfig); \ -+ fi ++ifdef SCRIPT_ARG ++ $(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" \ ++ "$(PYTHONCMD)" "$(SCRIPT)" "$(srctree)/$(Kconfig)" "$(SCRIPT_ARG)" ++else ++ $(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" \ ++ "$(PYTHONCMD)" "$(SCRIPT)" "$(srctree)/$(Kconfig)" ++endif + +iscriptconfig: + $(Q)PYTHONPATH="$(srctree)/Kconfiglib:$$PYTHONPATH" "$(PYTHONCMD)" -i -c \ |
