summaryrefslogtreecommitdiff
path: root/examples/print_sym_info.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2012-12-06 17:01:09 +0100
committerUlf Magnusson <ulfalizer@gmail.com>2012-12-06 17:01:29 +0100
commitc805e3143bada2df897927996ae23a469cf83eb3 (patch)
tree38212ced8df505ee2814ac5b8d29460f0fa5e98b /examples/print_sym_info.py
parent94fb111d02b95413f7c36d923dabd4ec1ca1c90e (diff)
Move examples into separate directory.
Diffstat (limited to 'examples/print_sym_info.py')
-rw-r--r--examples/print_sym_info.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/print_sym_info.py b/examples/print_sym_info.py
new file mode 100644
index 0000000..8c69cac
--- /dev/null
+++ b/examples/print_sym_info.py
@@ -0,0 +1,18 @@
+# Loads a Kconfig and a .config and prints information about a symbol.
+
+import kconfiglib
+import sys
+
+# Create a Config object representing a Kconfig configuration. (Any number of
+# these can be created -- the library has no global state.)
+conf = kconfiglib.Config(sys.argv[1])
+
+# Load values from a .config file. 'srctree' is an environment variable set by
+# the Linux makefiles to the top-level directory of the kernel tree. It needs
+# to be used here for the script to work with alternative build directories
+# (specified e.g. with O=).
+conf.load_config("$srctree/arch/x86/configs/i386_defconfig")
+
+# Print some information about a symbol. (The Config class implements
+# __getitem__() to provide a handy syntax for getting symbols.)
+print conf["SERIAL_UARTLITE_CONSOLE"]